assignPermeability(): Don't build an Inspector to count global cells.

Thus, assingPermeability() is applicable to simulation decks that
aren't based on corner-point descriptions (e.g., the (DXV,DYV,DZV)
grid type).
This commit is contained in:
Bård Skaflestad 2012-05-15 12:07:04 +02:00
parent 43bb6eac78
commit 8ed2e18e15

View File

@ -35,6 +35,8 @@ namespace Opm
PermeabilityKind fillTensor(const EclipseGridParser& parser,
std::vector<const std::vector<double>*>& tensor,
std::tr1::array<int,9>& kmap);
int numGlobalCells(const EclipseGridParser& parser);
} // anonymous namespace
@ -82,10 +84,8 @@ namespace Opm
const std::vector<int>& global_cell,
double perm_threshold)
{
const int dim = 3;
EclipseGridInspector insp(parser);
std::tr1::array<int, 3> dims = insp.gridSize();
int num_global_cells = dims[0]*dims[1]*dims[2];
const int dim = 3;
const int num_global_cells = numGlobalCells(parser);
ASSERT (num_global_cells > 0);
permeability_.assign(dim * dim * global_cell.size(), 0.0);
@ -330,6 +330,26 @@ namespace Opm
return kind;
}
int numGlobalCells(const EclipseGridParser& parser)
{
int ngc = -1;
if (parser.hasField("DIMENS")) {
const std::vector<int>&
dims = parser.getIntegerValue("DIMENS");
ngc = dims[0] * dims[1] * dims[2];
}
else if (parser.hasField("SPECGRID")) {
const SPECGRID& sgr = parser.getSPECGRID();
ngc = sgr.dimensions[ 0 ];
ngc *= sgr.dimensions[ 1 ];
ngc *= sgr.dimensions[ 2 ];
}
return ngc;
}
} // anonymous namespace
} // namespace Opm