diff --git a/opm/simulators/linalg/elementborderlistfromgrid.hh b/opm/simulators/linalg/elementborderlistfromgrid.hh index f0399099c..8c4affe31 100644 --- a/opm/simulators/linalg/elementborderlistfromgrid.hh +++ b/opm/simulators/linalg/elementborderlistfromgrid.hh @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -68,11 +69,9 @@ class ElementBorderListFromGrid , blackList_(blackList) , borderList_(borderList) { - auto elemIt = gridView_.template begin<0>(); - const auto& elemEndIt = gridView_.template end<0>(); - for (; elemIt != elemEndIt; ++elemIt) { - if (elemIt->partitionType() != Dune::InteriorEntity) { - Index elemIdx = static_cast(map_.index(*elemIt)); + for (const auto& elem : elements(gridView_)) { + if (elem.partitionType() != Dune::InteriorEntity) { + Index elemIdx = static_cast(map_.index(elem)); blackList_.addIndex(elemIdx); } }