From 36f81bfb66b1d9a9cfb2235e0a9c38ae86c2f4df Mon Sep 17 00:00:00 2001
From: babushkina <babushkina@mi.fu-berlin.de>
Date: Thu, 10 Nov 2016 16:38:45 +0100
Subject: [PATCH] leafbegin/leafend removed

---
 .../fufem/estimators/hierarchicalestimator.hh | 22 +++++++------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/dune/fufem/estimators/hierarchicalestimator.hh b/dune/fufem/estimators/hierarchicalestimator.hh
index 266e5f27..311975f3 100644
--- a/dune/fufem/estimators/hierarchicalestimator.hh
+++ b/dune/fufem/estimators/hierarchicalestimator.hh
@@ -88,13 +88,10 @@ public:
 
         refinementIndicator.clear();
 
-        typename GridType::LeafGridView::template Codim<0>::Iterator eIt    = grid_->template leafbegin<0>();
-        typename GridType::LeafGridView::template Codim<0>::Iterator eEndIt = grid_->template leafend<0>();
-
         // Extract all contributions that correspond to edges
-        for (; eIt!=eEndIt; ++eIt) {
+        for (const auto& e : elements(grid_->leafGridView())) {
 
-            const Lfe& lfe = enlargedGlobalBasis.getLocalFiniteElement(*eIt);
+            const Lfe& lfe = enlargedGlobalBasis.getLocalFiniteElement(e);
 
             int numLocalDofs = lfe.localCoefficients().size();
 
@@ -103,12 +100,12 @@ public:
                 int codim     = lfe.localCoefficients().localKey(j).codim();
                 int subEntity = lfe.localCoefficients().localKey(j).subEntity();
 
-                unsigned int globalIdx = enlargedGlobalBasis.index(*eIt, j);
+                unsigned int globalIdx = enlargedGlobalBasis.index(e, j);
 
                 if (codim==dim)
                     assert(hierarchicalError_[globalIdx].two_norm() < 1e-5);
 
-                refinementIndicator.set(*eIt, codim, subEntity, hierarchicalError_[globalIdx].two_norm());
+                refinementIndicator.set(e, codim, subEntity, hierarchicalError_[globalIdx].two_norm());
 
             }
 
@@ -168,13 +165,10 @@ public:
 
         refinementIndicator.clear();
 
-        typename GridType::LeafGridView::template Codim<0>::Iterator eIt    = grid_->template leafbegin<0>();
-        typename GridType::LeafGridView::template Codim<0>::Iterator eEndIt = grid_->template leafend<0>();
-
         // Extract all contributions that correspond to edges
-        for (; eIt!=eEndIt; ++eIt) {
+        for (const auto& e : elements(grid_->leafGridView())) {
 
-            const Lfe& lfe = enlargedGlobalBasis.getLocalFiniteElement(*eIt);
+            const Lfe& lfe = enlargedGlobalBasis.getLocalFiniteElement(e);
             int numLocalDofs = lfe.localCoefficients().size();
 
             for (int j=0; j<numLocalDofs; j++) {
@@ -182,12 +176,12 @@ public:
                 int codim     = lfe.localCoefficients().localKey(j).codim();
                 int subEntity = lfe.localCoefficients().localKey(j).subEntity();
 
-                unsigned int globalIdx = enlargedGlobalBasis.index(*eIt, j);
+                unsigned int globalIdx = enlargedGlobalBasis.index(e, j);
 
              //   if (codim==dim)
               //      assert(hierarchicalError_[globalIdx].two_norm() < 1e-5);
 
-                refinementIndicator.set(*eIt, codim, subEntity, hierarchicalError_[globalIdx].two_norm());
+                refinementIndicator.set(e, codim, subEntity, hierarchicalError_[globalIdx].two_norm());
 
             }
 
-- 
GitLab