From 8e8841fd00e35f5c81a54d6b106d365ccb025043 Mon Sep 17 00:00:00 2001
From: Thomas Fetzer <thomas.fetzer@iws.uni-stuttgart.de>
Date: Fri, 24 Mar 2017 14:41:43 +0100
Subject: [PATCH] [gridcreator] Some further comment adaptions

---
 dumux/io/cakegridcreator.hh                  | 4 +++-
 dumux/io/gridcreator.hh                      | 5 ++++-
 test/io/gridcreator/test_gridcreator_cake.cc | 6 +++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dumux/io/cakegridcreator.hh b/dumux/io/cakegridcreator.hh
index d22c8eba89..67b8c269a9 100644
--- a/dumux/io/cakegridcreator.hh
+++ b/dumux/io/cakegridcreator.hh
@@ -269,7 +269,7 @@ public:
                             std::cout << " -> h "  << height * length << std::endl;
                     }
 
-                    // if not do power spacing
+                    // if grading factor is not 1.0, do power law spacing
                     else
                     {
                         height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells));
@@ -366,8 +366,10 @@ public:
                         v[indices[0]] = cos(dA[j])*wellRadius + cos(dA[j])*dR[i];
                         v[indices[1]] = sin(dA[j])*wellRadius + sin(dA[j])*dR[i];
                         if (verbose)
+                        {
                             std::cout << "Coordinates of : "
                                       << v[0] << " " << v[1] << " " << v[2] << std::endl;
+                        }
                         gridFactory.insertVertex(v);
                     }
                 }
diff --git a/dumux/io/gridcreator.hh b/dumux/io/gridcreator.hh
index 30c51a1d86..94f18994a7 100644
--- a/dumux/io/gridcreator.hh
+++ b/dumux/io/gridcreator.hh
@@ -796,13 +796,15 @@ public:
                     // reverse behavior for negative values
                     if (gradingFactor < 0.0)
                     {
-                        gradingFactor = -gradingFactor;
+                        using std::abs;
+                        gradingFactor = abs(gradingFactor);
                         if (gradingFactor < 1.0)
                         {
                             increasingCellSize = true;
                         }
                     }
 
+                    // if the grading factor is exactly 1.0 do equal spacing
                     if (gradingFactor > 1.0 - 1e-7 && gradingFactor < 1.0 + 1e-7)
                     {
                         height = 1.0 / numCells;
@@ -811,6 +813,7 @@ public:
                             std::cout << " -> h "  << height * length << std::endl;
                         }
                     }
+                    // if grading factor is not 1.0, do power law spacing
                     else
                     {
                         height = (1.0 - gradingFactor) / (1.0 - pow(gradingFactor, numCells));
diff --git a/test/io/gridcreator/test_gridcreator_cake.cc b/test/io/gridcreator/test_gridcreator_cake.cc
index 0cdf73bf0a..7f9d0b7fd1 100644
--- a/test/io/gridcreator/test_gridcreator_cake.cc
+++ b/test/io/gridcreator/test_gridcreator_cake.cc
@@ -37,7 +37,7 @@ namespace Dumux
 namespace Properties
 {
 NEW_TYPE_TAG(GridCreatorCakeTest, INHERITS_FROM(NumericModel));
-//     Set the grid type
+// Set the grid type
 #if HAVE_DUNE_ALUGRID
 SET_TYPE_PROP(GridCreatorCakeTest, Grid, Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>);
 #elif HAVE_UG
@@ -61,10 +61,10 @@ int main(int argc, char** argv)
         // Read the parameters from the input file
         using ParameterTree = typename GET_PROP(TypeTag, ParameterTree);
 
-        //First read parameters from input file
+        // first read parameters from input file
         Dune::ParameterTreeParser::readINITree("test_gridcreator_cake.input", ParameterTree::tree());
 
-        //Make the grid
+        // make the grid
         Dune::Timer timer;
         GridCreator::makeGrid();
         std::cout << "Constructing cake grid with " << GridCreator::grid().leafGridView().size(0) << " elements took "
-- 
GitLab