Shrink EclEquilInitializer::initialFluidStates_.

There is not reason to it as a vector of cartesian size as we access
its entries by the compressed element index. This should save space
and speedup the lookup.
This commit is contained in:
Markus Blatt 2020-03-08 16:25:35 +01:00
parent f90cfa7ef9
commit 9ccd4be5e3

View File

@ -109,7 +109,6 @@ public:
const auto& eclState = vanguard.eclState();
unsigned numElems = vanguard.grid().size(0);
unsigned numCartesianElems = vanguard.cartesianSize();
EQUIL::DeckDependent::InitialStateComputer<TypeTag> initialState(materialLawManager,
eclState,
@ -117,10 +116,9 @@ public:
simulator.problem().gravity()[dimWorld - 1]);
// copy the result into the array of initial fluid states
initialFluidStates_.resize(numCartesianElems);
initialFluidStates_.resize(numElems);
for (unsigned int elemIdx = 0; elemIdx < numElems; ++elemIdx) {
unsigned cartesianElemIdx = vanguard.cartesianIndex(elemIdx);
auto& fluidState = initialFluidStates_[cartesianElemIdx];
auto& fluidState = initialFluidStates_[elemIdx];
// get the PVT region index of the current element
unsigned regionIdx = simulator_.problem().pvtRegionIndex(elemIdx);
@ -173,10 +171,7 @@ public:
*/
const ScalarFluidState& initialFluidState(unsigned elemIdx) const
{
const auto& vanguard = simulator_.vanguard();
unsigned cartesianElemIdx = vanguard.cartesianIndex(elemIdx);
return initialFluidStates_[cartesianElemIdx];
return initialFluidStates_[elemIdx];
}
protected: