mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
cache the remaining element iterator dereferences
they were forgotten in a place or two. With this, ebos' performance using ALUGrid is comparable to its performance using a "raw" Dune::CpGrid. (also, make the naming of the local variable for the element more consistent, i.e., replace 'entity' by 'elem' for the few places where 'entity' was used.)
This commit is contained in:
@@ -97,15 +97,15 @@ public:
|
||||
auto elemIt = gridView.template begin</*codim=*/ 0>();
|
||||
const auto& elemEndIt = gridView.template end</*codim=*/ 0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const auto& entity = *elemIt;
|
||||
const auto& elem = *elemIt;
|
||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
|
||||
int elemIdx = elementMapper.index( entity );
|
||||
int elemIdx = elementMapper.index(elem);
|
||||
#else
|
||||
int elemIdx = elementMapper.map( entity );
|
||||
int elemIdx = elementMapper.map(elem);
|
||||
#endif
|
||||
|
||||
// get the geometry of the current element
|
||||
const auto& geom = entity.geometry();
|
||||
const auto& geom = elem.geometry();
|
||||
|
||||
// compute the axis specific "centroids" used for the
|
||||
// transmissibilities
|
||||
@@ -154,9 +154,9 @@ public:
|
||||
// compute the transmissibilities for all intersections
|
||||
elemIt = gridView.template begin</*codim=*/ 0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const auto& entity = *elemIt;
|
||||
auto isIt = gridView.ibegin( entity );
|
||||
const auto& isEndIt = gridView.iend( entity );
|
||||
const auto& elem = *elemIt;
|
||||
auto isIt = gridView.ibegin(elem);
|
||||
const auto& isEndIt = gridView.iend(elem);
|
||||
for (; isIt != isEndIt; ++ isIt) {
|
||||
// store intersection, this might be costly
|
||||
const auto& intersection = *isIt;
|
||||
|
||||
@@ -64,6 +64,8 @@ class EclWellManager
|
||||
typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
||||
|
||||
typedef typename GridView::template Codim<0>::Entity Element;
|
||||
|
||||
typedef Ewoms::EclPeacemanWell<TypeTag> Well;
|
||||
|
||||
typedef std::map<int, std::pair<const Opm::Completion*, std::shared_ptr<Well> > > WellCompletionsMap;
|
||||
@@ -372,10 +374,11 @@ public:
|
||||
auto elemIt = simulator_.gridManager().gridView().template begin</*codim=*/0>();
|
||||
const auto &elemEndIt = simulator_.gridManager().gridView().template end</*codim=*/0>();
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
if (elemIt->partitionType() != Dune::InteriorEntity)
|
||||
const Element& elem = *elemIt;
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
continue;
|
||||
|
||||
elemCtx.updateStencil(*elemIt);
|
||||
elemCtx.updateStencil(elem);
|
||||
elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);
|
||||
|
||||
for (size_t wellIdx = 0; wellIdx < wells_.size(); ++wellIdx)
|
||||
@@ -555,11 +558,11 @@ protected:
|
||||
const auto elemEndIt = gridView.template end</*codim=*/0>();
|
||||
std::set<std::shared_ptr<Well> > wells;
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const auto& entity = *elemIt;
|
||||
if (entity.partitionType() != Dune::InteriorEntity)
|
||||
const auto& elem = *elemIt;
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
continue; // non-local entities need to be skipped
|
||||
|
||||
elemCtx.updateStencil( entity );
|
||||
elemCtx.updateStencil(elem);
|
||||
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
||||
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
int cartesianDofIdx = cartesianCellId[globalDofIdx];
|
||||
@@ -635,11 +638,11 @@ protected:
|
||||
const auto elemEndIt = gridView.template end</*codim=*/0>();
|
||||
|
||||
for (; elemIt != elemEndIt; ++elemIt) {
|
||||
const auto& entity = *elemIt;
|
||||
if (entity.partitionType() != Dune::InteriorEntity)
|
||||
const auto& elem = *elemIt;
|
||||
if (elem.partitionType() != Dune::InteriorEntity)
|
||||
continue; // non-local entities need to be skipped
|
||||
|
||||
elemCtx.updateStencil( entity );
|
||||
elemCtx.updateStencil(elem);
|
||||
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
||||
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||
int cartesianDofIdx = cartesianCellId[globalDofIdx];
|
||||
|
||||
Reference in New Issue
Block a user