Fix vector sizing bug.

This commit is contained in:
Atgeirr Flø Rasmussen 2015-05-26 11:41:34 +02:00
parent 143b213f53
commit 52d035940e

View File

@ -466,8 +466,7 @@ namespace detail {
BlackoilModelBase<Grid, Implementation>::variableStateIndices() const BlackoilModelBase<Grid, Implementation>::variableStateIndices() const
{ {
assert(active_[Oil]); assert(active_[Oil]);
const int np = fluid_.numPhases(); std::vector<int> indices(5, -1);
std::vector<int> indices(np + 2, -1);
int next = 0; int next = 0;
indices[Pressure] = next++; indices[Pressure] = next++;
if (active_[Water]) { if (active_[Water]) {
@ -478,7 +477,7 @@ namespace detail {
} }
indices[Qs] = next++; indices[Qs] = next++;
indices[Bhp] = next++; indices[Bhp] = next++;
assert(next == np + 2); assert(next == fluid_.numPhases() + 2);
return indices; return indices;
} }