From 4e43ef445709249c8616a7f60b49f8be9253680c Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de>
Date: Thu, 28 Apr 2016 17:55:09 +0200
Subject: [PATCH] Remove preprocessor conditionals for old DUNE versions

dune-fufem requires at least version 2.4 of the core modules.
---
 .../assemblers/boundaryfunctionalassembler.hh |  6 +-----
 .../assemblers/boundaryoperatorassembler.hh   | 12 ++---------
 .../generalizedboundarymassassembler.hh       |  5 -----
 .../neumannboundaryassembler.hh               |  5 -----
 .../normalstressboundaryassembler.hh          |  7 +------
 dune/fufem/facehierarchy.hh                   |  4 ----
 dune/fufem/functionspacebases/p0basis.hh      |  4 ----
 dune/fufem/functionspacebases/p2nodalbasis.hh |  8 --------
 dune/fufem/globalintersectioniterator.hh      | 20 -------------------
 9 files changed, 4 insertions(+), 67 deletions(-)

diff --git a/dune/fufem/assemblers/boundaryfunctionalassembler.hh b/dune/fufem/assemblers/boundaryfunctionalassembler.hh
index 761ab13b..fe77a307 100644
--- a/dune/fufem/assemblers/boundaryfunctionalassembler.hh
+++ b/dune/fufem/assemblers/boundaryfunctionalassembler.hh
@@ -82,12 +82,8 @@ class BoundaryFunctionalAssembler
 
             for (; it != end; ++it)
             {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
                 const auto inside = it->inside();
-#else
-                const auto insidePtr = it->inside();
-                const auto& inside = *insidePtr;
-#endif
+
                 // get shape functions
                 const typename TrialBasis::LocalFiniteElement& tFE = tBasis_.getLocalFiniteElement(inside);
 
diff --git a/dune/fufem/assemblers/boundaryoperatorassembler.hh b/dune/fufem/assemblers/boundaryoperatorassembler.hh
index 289ea683..3a2d3125 100644
--- a/dune/fufem/assemblers/boundaryoperatorassembler.hh
+++ b/dune/fufem/assemblers/boundaryoperatorassembler.hh
@@ -77,12 +77,8 @@ class BoundaryOperatorAssembler
             BoundaryIterator end = boundaryPatch_.end();
             for (; it != end; ++it)
             {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
                 const auto inside = it->inside();
-#else
-                const auto insidePtr = it->inside();
-                const auto& inside = *insidePtr;
-#endif
+
                 // get shape functions
                 const typename TrialBasis::LocalFiniteElement& tFE = tBasis_.getLocalFiniteElement(inside);
                 const typename AnsatzBasis::LocalFiniteElement& aFE = aBasis_.getLocalFiniteElement(inside);
@@ -153,12 +149,8 @@ class BoundaryOperatorAssembler
             BoundaryIterator end = boundaryPatch_.end();
             for (; it != end; ++it)
             {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
                 const auto inside = it->inside();
-#else
-                const auto insidePtr = it->inside();
-                const auto& inside = *insidePtr;
-#endif
+
                 // get shape functions
                 const typename TrialBasis::LocalFiniteElement& tFE = tBasis_.getLocalFiniteElement(inside);
                 const typename AnsatzBasis::LocalFiniteElement& aFE = aBasis_.getLocalFiniteElement(inside);
diff --git a/dune/fufem/assemblers/localassemblers/generalizedboundarymassassembler.hh b/dune/fufem/assemblers/localassemblers/generalizedboundarymassassembler.hh
index 40b25c3a..32fea55f 100644
--- a/dune/fufem/assemblers/localassemblers/generalizedboundarymassassembler.hh
+++ b/dune/fufem/assemblers/localassemblers/generalizedboundarymassassembler.hh
@@ -78,12 +78,7 @@ class GeneralizedBoundaryMassAssembler
             // loop over quadrature points
             for (size_t pt=0; pt < quad.size(); ++pt)
             {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
                 const auto inside = it->inside();
-#else
-                const auto insidePtr = it->inside();
-                const auto& inside = *insidePtr;
-#endif
 
                 // get quadrature point
                 const Dune::FieldVector<ctype,dim-1>& quadPos = quad[pt].position();
diff --git a/dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh b/dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh
index 17811b10..b8fe0e44 100644
--- a/dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh
+++ b/dune/fufem/assemblers/localassemblers/neumannboundaryassembler.hh
@@ -80,12 +80,7 @@ class NeumannBoundaryAssembler :
             // loop over quadrature points
             for (size_t pt=0; pt < quad.size(); ++pt)
             {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
                 const auto inside = it->inside();
-#else
-                const auto insidePtr = it->inside();
-                const auto& inside = *insidePtr;
-#endif
 
                 // get quadrature point
                 const Dune::FieldVector<ctype,dim-1>& quadPos = quad[pt].position();
diff --git a/dune/fufem/assemblers/localassemblers/normalstressboundaryassembler.hh b/dune/fufem/assemblers/localassemblers/normalstressboundaryassembler.hh
index be513e00..a2f52791 100644
--- a/dune/fufem/assemblers/localassemblers/normalstressboundaryassembler.hh
+++ b/dune/fufem/assemblers/localassemblers/normalstressboundaryassembler.hh
@@ -39,12 +39,7 @@ public:
     /** \brief Assemble the normal stress at a boundary face.*/
     template <class TrialLocalFE, class BoundaryIterator>
     void assemble(const BoundaryIterator& it, LocalVector& localVector, const TrialLocalFE& tFE) {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
-      const auto inside = it->inside();
-#else
-      const auto insidePtr = it->inside();
-      const auto& inside = *insidePtr;
-#endif
+        const auto inside = it->inside();
 
         localVector = 0.0;
 
diff --git a/dune/fufem/facehierarchy.hh b/dune/fufem/facehierarchy.hh
index b6b9ef93..4dc38cf7 100644
--- a/dune/fufem/facehierarchy.hh
+++ b/dune/fufem/facehierarchy.hh
@@ -215,11 +215,7 @@ class Face
         StorableFace father() const
         {
             StorableFace fatherFace(*grid_, *element().father());
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
             for(int i=0; i < fatherFace.element().subEntities(1); ++i)
-#else
-            for(int i=0; i < fatherFace.element().template count<1>(); ++i)
-#endif
             {
                 if (isSubFace(fatherFace.element(), i, element(), index_))
                 {
diff --git a/dune/fufem/functionspacebases/p0basis.hh b/dune/fufem/functionspacebases/p0basis.hh
index 64b4aa82..6ed427fb 100644
--- a/dune/fufem/functionspacebases/p0basis.hh
+++ b/dune/fufem/functionspacebases/p0basis.hh
@@ -75,11 +75,7 @@ class P0Basis :
 
         int index(const Element& e, const int i) const
         {
-#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 4)
             return mapper_.index(e);
-#else
-            return mapper_.map(e);
-#endif
         }
 
     protected:
diff --git a/dune/fufem/functionspacebases/p2nodalbasis.hh b/dune/fufem/functionspacebases/p2nodalbasis.hh
index 883ba9b6..e0153759 100644
--- a/dune/fufem/functionspacebases/p2nodalbasis.hh
+++ b/dune/fufem/functionspacebases/p2nodalbasis.hh
@@ -51,17 +51,9 @@ class P2BasisMapper :
             Base(gridView)
         {}
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
         typename Base::Index index(const Element& e, const Dune::LocalKey& localKey) const
-#else
-        int index(const Element& e, const Dune::LocalKey& localKey) const
-#endif
         {
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
             return this->subIndex(e, localKey.subEntity(), localKey.codim());
-#else
-            return this->map(e, localKey.subEntity(), localKey.codim());
-#endif
         }
 };
 
diff --git a/dune/fufem/globalintersectioniterator.hh b/dune/fufem/globalintersectioniterator.hh
index bf8a5807..242f946a 100644
--- a/dune/fufem/globalintersectioniterator.hh
+++ b/dune/fufem/globalintersectioniterator.hh
@@ -8,7 +8,6 @@
 #include <dune/fufem/referenceelementhelper.hh>
 
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
 /** \brief Helper struct that statically either derefences the iterator, if it returns a reference,
  *         or otherwise return the 'member' intersection.
  */
@@ -45,7 +44,6 @@ static const typename IntersectionIterator::Intersection& returnReference(Inters
 {
     return ReturnReferenceHelper<IntersectionIterator,returnsReference>::returnReference(nIt,intersection);
 }
-#endif
 
 
 /** \brief Base class for iterators on intersections of a grid view
@@ -77,11 +75,9 @@ public:
     typedef typename IntersectionIterator::Intersection Intersection;
 
 private:
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
     // If this value is true, then the implementation still returns the Intersection by const reference
     // thus in this case we don't need to store the intersections at all
     static const bool isReference = std::is_lvalue_reference<decltype(std::declval<IntersectionIterator>().operator*())>::value;
-#endif
 
 public:
 
@@ -149,9 +145,7 @@ public:
         if (other.nIt_)
             nIt_ = new IntersectionIterator(*other.nIt_);
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
         updateIntersection(other.intersection_);
-#endif
     }
 
     ~GlobalIntersectionIterator() {
@@ -183,9 +177,7 @@ public:
             // check if we skip the intersection
             const Intersection& intersection = **nIt_;
             if (not asImpl().skipIntersection(intersection)) {
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
                 updateIntersection(intersection);
-#endif
                 break;
             }
 
@@ -199,11 +191,7 @@ public:
 
     const Intersection& dereference() const
     {
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
         return returnReference<IntersectionIterator,isReference>(nIt_,intersection_);
-#else
-        return **nIt_;
-#endif
     }
 
     const GlobalIntersectionIterator& operator=(const GlobalIntersectionIterator& other)
@@ -219,9 +207,7 @@ public:
         else
             nIt_ = 0;
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
         updateIntersection(other.intersection_);
-#endif
 
         return *this;
     }
@@ -233,14 +219,12 @@ public:
 
 protected:
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
     //! Update the stored intersection if we have to
     void updateIntersection(const Intersection& intersection)
     {
         if (not isReference)
             intersection_ = std::move(intersection);
     }
-#endif
 
     /** \brief Find first valid intersection
      *
@@ -257,10 +241,8 @@ protected:
         const Intersection& intersection = **nIt_;
         if (asImpl().skipIntersection(intersection))
             increment();
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
         else
             updateIntersection(intersection);
-#endif
     }
 
     const Impl& asImpl() const
@@ -280,12 +262,10 @@ protected:
 
     IntersectionIterator* nIt_;
 
-#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
     /** \brief The intersection corresponding to the actual global intersection iterator.
      *          It is only set if dereferencing the intersection iterator is returning a temporary.
      */
     Intersection intersection_;
-#endif
 };
 
 
-- 
GitLab