mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: do not copy primary variables into element context
hold a const pointer instead.
This commit is contained in:
parent
1e1f6f5b50
commit
f93d748603
@ -62,7 +62,7 @@ class FvBaseElementContext
|
||||
|
||||
struct DofStore_ {
|
||||
IntensiveQuantities intensiveQuantities[timeDiscHistorySize];
|
||||
PrimaryVariables priVars[timeDiscHistorySize];
|
||||
const PrimaryVariables* priVars[timeDiscHistorySize];
|
||||
const IntensiveQuantities *thermodynamicHint[timeDiscHistorySize];
|
||||
};
|
||||
using DofVarsVector = std::vector<DofStore_>;
|
||||
@ -452,7 +452,7 @@ public:
|
||||
const PrimaryVariables& primaryVars(unsigned dofIdx, unsigned timeIdx) const
|
||||
{
|
||||
assert(dofIdx < numDof(timeIdx));
|
||||
return dofVars_[dofIdx].priVars[timeIdx];
|
||||
return *dofVars_[dofIdx].priVars[timeIdx];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -483,7 +483,7 @@ public:
|
||||
assert(dofIdx < numDof(/*timeIdx=*/0));
|
||||
|
||||
intensiveQuantitiesStashed_ = dofVars_[dofIdx].intensiveQuantities[/*timeIdx=*/0];
|
||||
priVarsStashed_ = dofVars_[dofIdx].priVars[/*timeIdx=*/0];
|
||||
priVarsStashed_ = *dofVars_[dofIdx].priVars[/*timeIdx=*/0];
|
||||
stashedDofIdx_ = static_cast<int>(dofIdx);
|
||||
}
|
||||
|
||||
@ -494,7 +494,7 @@ public:
|
||||
*/
|
||||
void restoreIntensiveQuantities(unsigned dofIdx)
|
||||
{
|
||||
dofVars_[dofIdx].priVars[/*timeIdx=*/0] = priVarsStashed_;
|
||||
dofVars_[dofIdx].priVars[/*timeIdx=*/0] = &priVarsStashed_;
|
||||
dofVars_[dofIdx].intensiveQuantities[/*timeIdx=*/0] = intensiveQuantitiesStashed_;
|
||||
stashedDofIdx_ = -1;
|
||||
}
|
||||
@ -554,7 +554,7 @@ protected:
|
||||
for (unsigned dofIdx = 0; dofIdx < numDof; dofIdx++) {
|
||||
unsigned globalIdx = globalSpaceIndex(dofIdx, timeIdx);
|
||||
const PrimaryVariables& dofSol = globalSol[globalIdx];
|
||||
dofVars_[dofIdx].priVars[timeIdx] = dofSol;
|
||||
dofVars_[dofIdx].priVars[timeIdx] = &dofSol;
|
||||
|
||||
dofVars_[dofIdx].thermodynamicHint[timeIdx] =
|
||||
model().thermodynamicHint(globalIdx, timeIdx);
|
||||
@ -580,7 +580,7 @@ protected:
|
||||
"for the most-recent substep (i.e. time index 0) are available!");
|
||||
#endif
|
||||
|
||||
dofVars_[dofIdx].priVars[timeIdx] = priVars;
|
||||
dofVars_[dofIdx].priVars[timeIdx] = &priVars;
|
||||
dofVars_[dofIdx].intensiveQuantities[timeIdx].update(/*context=*/asImp_(), dofIdx, timeIdx);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user