simplify updateStorageCache

use the elements() range generator. while at it, fix some cosmetics
This commit is contained in:
Arne Morten Kvarving 2022-10-05 15:53:16 +02:00
parent 2f80274100
commit 0d1c989a25

View File

@ -394,15 +394,13 @@ protected:
tr.concentrationInitial_ = tr.concentration_;
ElementContext elemCtx(simulator_);
auto elemIt = simulator_.gridView().template begin</*codim=*/0>();
auto elemEndIt = simulator_.gridView().template end</*codim=*/0>();
for (; elemIt != elemEndIt; ++ elemIt) {
elemCtx.updatePrimaryStencil(*elemIt);
for (const auto& elem : elements(simulator_.gridView())) {
elemCtx.updatePrimaryStencil(elem);
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
int globalDofIdx = elemCtx.globalSpaceIndex(0, /*timIdx=*/0);
int globalDofIdx = elemCtx.globalSpaceIndex(0, /*timeIdx=*/0);
Scalar fVolume;
computeVolume_(fVolume, tr.phaseIdx_, elemCtx, 0, /*timIdx=*/0);
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
computeVolume_(fVolume, tr.phaseIdx_, elemCtx, 0, /*timeIdx=*/0);
for (int tIdx = 0; tIdx < tr.numTracer(); ++tIdx) {
tr.storageOfTimeIndex1_[tIdx][globalDofIdx] = fVolume*tr.concentrationInitial_[tIdx][globalDofIdx];
}
}