ElementBorderListFromGrid: use elements range generator

This commit is contained in:
Arne Morten Kvarving 2022-10-17 10:47:48 +02:00
parent 85ac4160ee
commit ce8d626872

View File

@ -32,6 +32,7 @@
#include <dune/grid/common/datahandleif.hh> #include <dune/grid/common/datahandleif.hh>
#include <dune/grid/common/gridenums.hh> #include <dune/grid/common/gridenums.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/scalarproducts.hh> #include <dune/istl/scalarproducts.hh>
#include <dune/istl/operators.hh> #include <dune/istl/operators.hh>
@ -68,11 +69,9 @@ class ElementBorderListFromGrid
, blackList_(blackList) , blackList_(blackList)
, borderList_(borderList) , borderList_(borderList)
{ {
auto elemIt = gridView_.template begin<0>(); for (const auto& elem : elements(gridView_)) {
const auto& elemEndIt = gridView_.template end<0>(); if (elem.partitionType() != Dune::InteriorEntity) {
for (; elemIt != elemEndIt; ++elemIt) { Index elemIdx = static_cast<Index>(map_.index(elem));
if (elemIt->partitionType() != Dune::InteriorEntity) {
Index elemIdx = static_cast<Index>(map_.index(*elemIt));
blackList_.addIndex(elemIdx); blackList_.addIndex(elemIdx);
} }
} }