From 84d6e3f1656cfaa0c3cce27aad63a8c18862500a Mon Sep 17 00:00:00 2001
From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de>
Date: Mon, 27 Apr 2015 08:37:31 +0000
Subject: [PATCH] [cleanup] Fix warnings in gridadapt.

- Wrong order of initializing member variables.
- Remove unused variable.
No warning:
- Remove semicolon after methods.
- Drop continue, use negated if statement.
(reviewed by martins)


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14646 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/implicit/adaptive/gridadapt.hh | 47 +++++++++++++++-------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/dumux/implicit/adaptive/gridadapt.hh b/dumux/implicit/adaptive/gridadapt.hh
index 652f95c7a4..ef78695a83 100644
--- a/dumux/implicit/adaptive/gridadapt.hh
+++ b/dumux/implicit/adaptive/gridadapt.hh
@@ -65,7 +65,11 @@ public:
      * @param problem The problem
      */
     ImplicitGridAdapt (Problem& problem)
-        : problem_(problem), adaptationHelper_(problem.gridView()), adaptationIndicator_(problem), marked_(0), coarsened_(0)
+        : adaptationHelper_(problem.gridView()),
+          problem_(problem),
+          adaptationIndicator_(problem),
+          marked_(0),
+          coarsened_(0)
     {
         levelMin_ = GET_PARAM_FROM_GROUP(TypeTag, int, GridAdapt, MinLevel);
         levelMax_ = GET_PARAM_FROM_GROUP(TypeTag, int, GridAdapt, MaxLevel);
@@ -214,28 +218,27 @@ public:
     {
         typedef std::unordered_map<int, int> CoarsenMarkerType;
         CoarsenMarkerType coarsenMarker;
-        const typename Grid::Traits::LocalIdSet& idSet(problem_.grid().localIdSet());
 
         for (LeafIterator eIt = problem_.gridView().template begin<0>();
              eIt!=problem_.gridView().template end<0>(); ++eIt)
         {
             // only mark non-ghost elements
-            if (eIt->partitionType() == Dune::GhostEntity)
-                continue;
-
-            // refine?
-            if (indicator.refine(*eIt) && eIt->level() < levelMax_)
+            if (eIt->partitionType() != Dune::GhostEntity)
             {
-                problem_.grid().mark( 1,  *eIt);
-                ++marked_;
+                // refine?
+                if (indicator.refine(*eIt) && eIt->level() < levelMax_)
+                {
+                    problem_.grid().mark( 1,  *eIt);
+                    ++marked_;
 
-                // this also refines the neighbor elements
-                checkNeighborsRefine_(*eIt);
-            }
-            if (indicator.coarsen(*eIt) && eIt->hasFather())
-            {
-                problem_.grid().mark( -1, *eIt );
-                ++coarsened_;
+                    // this also refines the neighbor elements
+                    checkNeighborsRefine_(*eIt);
+                }
+                if (indicator.coarsen(*eIt) && eIt->hasFather())
+                {
+                    problem_.grid().mark( -1, *eIt );
+                    ++coarsened_;
+                }
             }
         }
     }
@@ -348,7 +351,7 @@ private:
             }
         }
         return true;
-    };
+    }
 
 
     /*!
@@ -434,20 +437,20 @@ class ImplicitGridAdapt<TypeTag, false>
 
 public:
     void init()
-    {};
+    {}
     void adaptGrid()
-    {};
+    {}
     bool wasAdapted()
     {
         return false;
     }
     void setLevels(int, int)
-    {};
+    {}
     void setTolerance(int, int)
-    {};
+    {}
     const void setIndicator(const SolutionVector&,
                             const Scalar&, const Scalar&)
-    {};
+    {}
     ImplicitGridAdapt (Problem& problem)
     {}
 };
-- 
GitLab