ECL grid manager: make the cartesianCellId() method take an integer and return one

the fact that this is implemented via a std::vector<int> is an
implementation detail which should not be visible to the outside of
this class.
This commit is contained in:
Andreas Lauser 2015-01-27 13:15:06 +01:00
parent a720a322c3
commit 019c272a11
2 changed files with 18 additions and 23 deletions

View File

@ -526,12 +526,12 @@ public:
if (!deck->hasKeyword("PVTNUM"))
return 0;
const auto &cartesianCellId = this->simulator().gridManager().cartesianCellId();
const auto& gridManager = this->simulator().gridManager();
// this is quite specific to the ECFV discretization. But so is everything in an
// ECL deck, i.e., we don't need to care here...
int compressedDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
int cartesianDofIdx = cartesianCellId[compressedDofIdx];
int cartesianDofIdx = gridManager.cartesianCellId(compressedDofIdx);
return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1;
}
@ -662,9 +662,9 @@ private:
void readMaterialParameters_()
{
auto deck = this->simulator().gridManager().deck();
auto eclState = this->simulator().gridManager().eclState();
const auto &cartesianCellId = this->simulator().gridManager().cartesianCellId();
const auto &gridManager = this->simulator().gridManager();
auto deck = gridManager.deck();
auto eclState = gridManager.eclState();
size_t numDof = this->model().numGridDof();
@ -689,7 +689,7 @@ private:
permzData = eclState->getDoubleGridProperty("PERMZ")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = cartesianCellId[dofIdx];
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
intrinsicPermeability_[dofIdx] = 0.0;
intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx];
intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx];
@ -712,7 +712,7 @@ private:
eclState->getDoubleGridProperty("PORO")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = cartesianCellId[dofIdx];
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
porosity_[dofIdx] = poroData[cartesianElemIdx];
}
}
@ -726,10 +726,8 @@ private:
const std::vector<double> &ntgData =
eclState->getDoubleGridProperty("NTG")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = cartesianCellId[dofIdx];
porosity_[dofIdx] *= ntgData[cartesianElemIdx];
}
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx)
porosity_[dofIdx] *= ntgData[gridManager.cartesianCellId(dofIdx)];
}
// apply the MULTPV keyword to the porosity
@ -737,10 +735,8 @@ private:
const std::vector<double> &multpvData =
eclState->getDoubleGridProperty("MULTPV")->getData();
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = cartesianCellId[dofIdx];
porosity_[dofIdx] *= multpvData[cartesianElemIdx];
}
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx)
porosity_[dofIdx] *= multpvData[gridManager.cartesianCellId(dofIdx)];
}
////////////////////////////////
@ -802,7 +798,7 @@ private:
materialParamTableIdx_.resize(numDof);
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
int cartesianElemIdx = cartesianCellId[dofIdx];
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
// make sure that all values are in the correct range
assert(1 <= satnumData[dofIdx]);
@ -849,7 +845,6 @@ private:
{
const auto deck = this->simulator().gridManager().deck();
const auto &gridManager = this->simulator().gridManager();
const auto &cartesianCellId = gridManager.cartesianCellId();
if (!deck->hasKeyword("SWAT") ||
!deck->hasKeyword("SGAS"))
@ -903,7 +898,7 @@ private:
for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
auto &dofFluidState = initialFluidStates_[dofIdx];
size_t cartesianDofIdx = cartesianCellId[dofIdx];
size_t cartesianDofIdx = gridManager.cartesianCellId(dofIdx);
assert(0 <= cartesianDofIdx);
assert(cartesianDofIdx <= numCartesianCells);

View File

@ -534,7 +534,7 @@ protected:
void updateWellTopology_(int reportStepIdx, const WellCompletionsMap& wellCompletions)
{
auto& model = simulator_.model();
const auto& cartesianCellId = simulator_.gridManager().cartesianCellId();
const auto& gridManager = simulator_.gridManager();
// first, remove all wells from the reservoir
model.clearAuxiliaryModules();
@ -557,7 +557,7 @@ protected:
elemCtx.updateStencil(elem);
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
int cartesianDofIdx = cartesianCellId[globalDofIdx];
int cartesianDofIdx = gridManager.cartesianCellId(globalDofIdx);
if (wellCompletions.count(cartesianDofIdx) == 0)
// the current DOF is not contained in any well, so we must skip
@ -635,8 +635,8 @@ protected:
// associate the well completions with grid cells and register them in the
// Peaceman well object
const GridView gridView = simulator_.gridManager().gridView();
const auto& cartesianCellId = simulator_.gridManager().cartesianCellId();
const auto& gridManager = simulator_.gridManager();
const GridView gridView = gridManager.gridView();
ElementContext elemCtx(simulator_);
auto elemIt = gridView.template begin</*codim=*/0>();
@ -650,7 +650,7 @@ protected:
elemCtx.updateStencil(elem);
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
int cartesianDofIdx = cartesianCellId[globalDofIdx];
int cartesianDofIdx = gridManager.cartesianCellId(globalDofIdx);
if (wellCompletions.count(cartesianDofIdx) == 0)
// the current DOF is not contained in any well, so we must skip