Assert non-empty state quantities.

This avoids generating a null-pointer dereference for

   &s[0]

in case of s.empty().
This commit is contained in:
Bård Skaflestad 2013-05-08 13:02:51 +02:00
parent 3ff5347ac9
commit ea1cdcd478

View File

@ -75,6 +75,8 @@ namespace Opm {
{
const std::vector<double>& s = state.saturation();
assert (s.size() == std::vector<double>::size_type(nc_ * np_));
double* dkrds = 0; // Ignore rel-perm derivatives
fluid_.relperm(nc_, & s[0], & cells_[0],
kr_.data(), dkrds);
@ -86,6 +88,9 @@ namespace Opm {
const std::vector<double>& p = state.pressure();
const std::vector<double>& z = state.surfacevol();
assert (p.size() == std::vector<double>::size_type(nc_ * 1 ));
assert (z.size() == std::vector<double>::size_type(nc_ * np_));
fluid_.matrix (nc_, & p[0], & z[0], & cells_[0],
A_ .data(), dA_ .data());