From f8e90ede601d6c182a8ed0e419672f5917592038 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 21 Jul 2014 14:34:52 +0200
Subject: [PATCH] [Cleanup] Rename: DIM -> MY_DIM for UG

---
 src/Makefile.am                      |  4 ++--
 src/assemblers_tmpl.cc               |  6 +++---
 src/boundary_writer_tmpl.cc          |  4 ++--
 src/coupledtimestepper_tmpl.cc       |  8 ++++----
 src/explicitgrid.hh                  |  2 +-
 src/explicitvectors.hh               |  4 ++--
 src/fixedpointiterator_tmpl.cc       |  8 ++++----
 src/friction_writer_tmpl.cc          |  4 ++--
 src/sand-wedge-data/mygeometry.hh    |  2 +-
 src/sand-wedge-data/mygrid.cc        | 26 +++++++++++++-------------
 src/sand-wedge-data/mygrid.hh        |  6 +++---
 src/sand-wedge-data/mygrid_tmpl.cc   |  4 ++--
 src/sand-wedge-data/patchfunction.hh | 10 +++++-----
 src/sand-wedge-data/twopiece.hh      | 16 ++++++++--------
 src/sand-wedge.cc                    |  8 ++++----
 src/solverfactory_tmpl.cc            |  8 ++++----
 src/timestepping_tmpl.cc             |  8 ++++----
 src/vtk_tmpl.cc                      |  4 ++--
 18 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 3101380e..fa6b6598 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,11 +17,11 @@ common_sources = \
 sand_wedge_2D_SOURCES = $(common_sources) sand-wedge.cc
 sand_wedge_2D_CPPFLAGS = \
 	$(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \
-	-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DDIM=2
+	-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DMY_DIM=2
 sand_wedge_3D_SOURCES = $(common_sources) sand-wedge.cc
 sand_wedge_3D_CPPFLAGS = \
 	$(AM_CPPFLAGS) $(BOOST_CPPFLAGS) \
-	-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DDIM=3
+	-Ddatadir=\"$(abs_srcdir)/sand-wedge-data/\" -DMY_DIM=3
 
 # Some are for clang, others are for gcc
 AM_CXXFLAGS = \
diff --git a/src/assemblers_tmpl.cc b/src/assemblers_tmpl.cc
index 36628ed9..c2384ddc 100644
--- a/src/assemblers_tmpl.cc
+++ b/src/assemblers_tmpl.cc
@@ -1,7 +1,7 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitgrid.hh"
 
-template class MyAssembler<GridView, DIM>;
+template class MyAssembler<GridView, MY_DIM>;
diff --git a/src/boundary_writer_tmpl.cc b/src/boundary_writer_tmpl.cc
index 8d7f43c4..378584de 100644
--- a/src/boundary_writer_tmpl.cc
+++ b/src/boundary_writer_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitvectors.hh"
diff --git a/src/coupledtimestepper_tmpl.cc b/src/coupledtimestepper_tmpl.cc
index d72f5844..a7831212 100644
--- a/src/coupledtimestepper_tmpl.cc
+++ b/src/coupledtimestepper_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include <dune/common/function.hh>
@@ -18,9 +18,9 @@
 
 using Function = Dune::VirtualFunction<double, double>;
 using Factory = SolverFactory<
-    DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
+    MY_DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
     Grid>;
 using MyStateUpdater = StateUpdater<ScalarVector, Vector>;
-using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, DIM>;
+using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, MY_DIM>;
 
 template class CoupledTimeStepper<Factory, MyStateUpdater, MyVelocityUpdater>;
diff --git a/src/explicitgrid.hh b/src/explicitgrid.hh
index bf509994..c1e8500e 100644
--- a/src/explicitgrid.hh
+++ b/src/explicitgrid.hh
@@ -6,6 +6,6 @@
 #include <dune/grid/alugrid.hh>
 #pragma clang diagnostic pop
 
-using Grid = Dune::ALUGrid<DIM, DIM, Dune::simplex, Dune::nonconforming>;
+using Grid = Dune::ALUGrid<MY_DIM, MY_DIM, Dune::simplex, Dune::nonconforming>;
 using GridView = Grid::LeafGridView;
 #endif
diff --git a/src/explicitvectors.hh b/src/explicitvectors.hh
index 832888e1..923a8c35 100644
--- a/src/explicitvectors.hh
+++ b/src/explicitvectors.hh
@@ -6,8 +6,8 @@
 #include <dune/istl/bcrsmatrix.hh>
 #include <dune/istl/bvector.hh>
 
-using LocalVector = Dune::FieldVector<double, DIM>;
-using LocalMatrix = Dune::FieldMatrix<double, DIM, DIM>;
+using LocalVector = Dune::FieldVector<double, MY_DIM>;
+using LocalMatrix = Dune::FieldMatrix<double, MY_DIM, MY_DIM>;
 using Vector = Dune::BlockVector<LocalVector>;
 using Matrix = Dune::BCRSMatrix<LocalMatrix>;
 using ScalarVector = Dune::BlockVector<Dune::FieldVector<double, 1>>;
diff --git a/src/fixedpointiterator_tmpl.cc b/src/fixedpointiterator_tmpl.cc
index 22631e8e..41d4f910 100644
--- a/src/fixedpointiterator_tmpl.cc
+++ b/src/fixedpointiterator_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include <dune/common/function.hh>
@@ -18,9 +18,9 @@
 
 using Function = Dune::VirtualFunction<double, double>;
 using Factory = SolverFactory<
-    DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
+    MY_DIM, MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
     Grid>;
 using MyStateUpdater = StateUpdater<ScalarVector, Vector>;
-using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, DIM>;
+using MyVelocityUpdater = TimeSteppingScheme<Vector, Matrix, Function, MY_DIM>;
 
 template class FixedPointIterator<Factory, MyStateUpdater, MyVelocityUpdater>;
diff --git a/src/friction_writer_tmpl.cc b/src/friction_writer_tmpl.cc
index 6b50b0f6..5ac5e7d5 100644
--- a/src/friction_writer_tmpl.cc
+++ b/src/friction_writer_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitvectors.hh"
diff --git a/src/sand-wedge-data/mygeometry.hh b/src/sand-wedge-data/mygeometry.hh
index 25ef5027..10693e07 100644
--- a/src/sand-wedge-data/mygeometry.hh
+++ b/src/sand-wedge-data/mygeometry.hh
@@ -10,7 +10,7 @@ namespace {
   using LocalVector2D = Dune::FieldVector<double, 2>;
   using LocalMatrix2D = Dune::FieldMatrix<double, 2, 2>;
 
-  using LocalVector = Dune::FieldVector<double, DIM>;
+  using LocalVector = Dune::FieldVector<double, MY_DIM>;
 
   // kludge because fieldvectors have no initialiser_list constructor, see
   // https://dune-project.org/flyspray/index.php?do=details&task_id=1166
diff --git a/src/sand-wedge-data/mygrid.cc b/src/sand-wedge-data/mygrid.cc
index 8755a29c..5929d422 100644
--- a/src/sand-wedge-data/mygrid.cc
+++ b/src/sand-wedge-data/mygrid.cc
@@ -5,13 +5,13 @@
 #include "mygrid.hh"
 #include "midpoint.hh"
 
-#if DIM == 3
+#if MY_DIM == 3
 SimplexManager::SimplexManager(unsigned int shift) : shift_(shift) {}
 #endif
 
 void SimplexManager::addFromVertices(unsigned int U, unsigned int V,
                                      unsigned int W) {
-#if DIM == 3
+#if MY_DIM == 3
   unsigned int const U2 = U + shift_;
   unsigned int const V2 = V + shift_;
   unsigned int const W2 = W + shift_;
@@ -51,10 +51,10 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
 
   unsigned int const vc = 11;
 
-#if DIM == 3
-  Dune::FieldMatrix<double, 2 * vc, DIM> vertices;
+#if MY_DIM == 3
+  Dune::FieldMatrix<double, 2 * vc, MY_DIM> vertices;
 #else
-  Dune::FieldMatrix<double, vc, DIM> vertices;
+  Dune::FieldMatrix<double, vc, MY_DIM> vertices;
 #endif
   for (size_t i = 0; i < 2; ++i) {
     size_t k = 0;
@@ -70,7 +70,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
     vertices[k++][i] = ACC[i];
     vertices[k++][i] = C[i];
     assert(k == vc);
-#if DIM == 3
+#if MY_DIM == 3
     vertices[k++][i] = A[i];
     vertices[k++][i] = AAB[i];
     vertices[k++][i] = AB[i];
@@ -86,7 +86,7 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
 #endif
   }
 
-#if DIM == 3
+#if MY_DIM == 3
   for (size_t k = 0; k < vc; ++k) {
     vertices[k][2] = -MyGeometry::depth / 2.0;
     vertices[k + vc][2] = MyGeometry::depth / 2.0;
@@ -97,13 +97,13 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
     gridFactory.insertVertex(vertices[i]);
 
   Dune::GeometryType cell;
-#if DIM == 3
+#if MY_DIM == 3
   cell.makeTetrahedron();
 #else
   cell.makeTriangle();
 #endif
 
-#if DIM == 3
+#if MY_DIM == 3
   SimplexManager sm(vc);
 #else
   SimplexManager sm;
@@ -122,8 +122,8 @@ template <class Grid> GridConstructor<Grid>::GridConstructor() {
 
   // sanity-check choices of simplices
   for (size_t i = 0; i < simplices.size(); ++i) {
-    Dune::FieldMatrix<double, DIM, DIM> check;
-    for (size_t j = 0; j < DIM; ++j)
+    Dune::FieldMatrix<double, MY_DIM, MY_DIM> check;
+    for (size_t j = 0; j < MY_DIM; ++j)
       check[j] = vertices[simplices[i][j + 1]] - vertices[simplices[i][j]];
     assert(check.determinant() > 0);
     gridFactory.insertElement(cell, simplices[i]);
@@ -173,7 +173,7 @@ bool MyFaces<GridView>::xyBetween(Vector const &v1, Vector const &v2,
 template <class GridView>
 MyFaces<GridView>::MyFaces(GridView const &gridView)
     :
-#if DIM == 3
+#if MY_DIM == 3
       lower(gridView),
       right(gridView),
       upper(gridView),
@@ -191,7 +191,7 @@ MyFaces<GridView>::MyFaces(GridView const &gridView)
   lower.insertFacesByProperty([&](typename GridView::Intersection const &in) {
     return isClose(0, in.geometry().center()[1]);
   });
-#if DIM == 3
+#if MY_DIM == 3
   front.insertFacesByProperty([&](typename GridView::Intersection const &in) {
     return isClose(MyGeometry::depth / 2.0, in.geometry().center()[2]);
   });
diff --git a/src/sand-wedge-data/mygrid.hh b/src/sand-wedge-data/mygrid.hh
index 9759252b..cb4593e6 100644
--- a/src/sand-wedge-data/mygrid.hh
+++ b/src/sand-wedge-data/mygrid.hh
@@ -19,7 +19,7 @@ template <class GridView> struct MyFaces {
   BoundaryPatch<GridView> right;
   BoundaryPatch<GridView> upper;
 
-#if DIM == 3
+#if MY_DIM == 3
   BoundaryPatch<GridView> front;
   BoundaryPatch<GridView> back;
 #endif
@@ -45,7 +45,7 @@ class SimplexManager {
 public:
   using SimplexList = std::vector<std::vector<unsigned int>>;
 
-#if DIM == 3
+#if MY_DIM == 3
   SimplexManager(unsigned int shift);
 #endif
 
@@ -56,7 +56,7 @@ class SimplexManager {
 private:
   SimplexList simplices_;
 
-#if DIM == 3
+#if MY_DIM == 3
   unsigned int const shift_;
 #endif
 };
diff --git a/src/sand-wedge-data/mygrid_tmpl.cc b/src/sand-wedge-data/mygrid_tmpl.cc
index ea5190a1..0ffd11dc 100644
--- a/src/sand-wedge-data/mygrid_tmpl.cc
+++ b/src/sand-wedge-data/mygrid_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitgrid.hh"
diff --git a/src/sand-wedge-data/patchfunction.hh b/src/sand-wedge-data/patchfunction.hh
index 78e90ccd..197ae5cf 100644
--- a/src/sand-wedge-data/patchfunction.hh
+++ b/src/sand-wedge-data/patchfunction.hh
@@ -6,7 +6,7 @@
 #include <dune/common/parametertree.hh>
 
 class PatchFunction
-    : public Dune::VirtualFunction<Dune::FieldVector<double, DIM>,
+    : public Dune::VirtualFunction<Dune::FieldVector<double, MY_DIM>,
                                    Dune::FieldVector<double, 1>> {
 private:
   bool static isBetween(double x, double lower, double upper) {
@@ -17,13 +17,13 @@ class PatchFunction
     return std::abs(a - b) < 1e-14;
   };
 
-  bool insideRegion2(Dune::FieldVector<double, DIM> const &z) const {
+  bool insideRegion2(Dune::FieldVector<double, MY_DIM> const &z) const {
     assert(isClose(0, z[1]));
     return isBetween(z[0], _X[0], _Y[0]);
   }
 
-  Dune::FieldVector<double, DIM> const &_X;
-  Dune::FieldVector<double, DIM> const &_Y;
+  Dune::FieldVector<double, MY_DIM> const &_X;
+  Dune::FieldVector<double, MY_DIM> const &_Y;
 
   double const _v1;
   double const _v2;
@@ -32,7 +32,7 @@ class PatchFunction
   PatchFunction(double v1, double v2)
       : _X(MyGeometry::X), _Y(MyGeometry::Y), _v1(v1), _v2(v2) {}
 
-  void evaluate(Dune::FieldVector<double, DIM> const &x,
+  void evaluate(Dune::FieldVector<double, MY_DIM> const &x,
                 Dune::FieldVector<double, 1> &y) const {
     y = insideRegion2(x) ? _v2 : _v1;
   }
diff --git a/src/sand-wedge-data/twopiece.hh b/src/sand-wedge-data/twopiece.hh
index d969c845..02872d66 100644
--- a/src/sand-wedge-data/twopiece.hh
+++ b/src/sand-wedge-data/twopiece.hh
@@ -8,20 +8,20 @@
 #include "mygeometry.hh"
 
 class TwoPieceFunction
-    : public Dune::VirtualFunction<Dune::FieldVector<double, DIM>,
+    : public Dune::VirtualFunction<Dune::FieldVector<double, MY_DIM>,
                                    Dune::FieldVector<double, 1>> {
 private:
-  bool liesBelow(Dune::FieldVector<double, DIM> const &x,
-                 Dune::FieldVector<double, DIM> const &y,
-                 Dune::FieldVector<double, DIM> const &z) const {
+  bool liesBelow(Dune::FieldVector<double, MY_DIM> const &x,
+                 Dune::FieldVector<double, MY_DIM> const &y,
+                 Dune::FieldVector<double, MY_DIM> const &z) const {
     return (z[0] - x[0]) * (y[1] - x[1]) / (y[0] - x[0]) >= z[1] - x[1];
   };
-  bool insideRegion2(Dune::FieldVector<double, DIM> const &z) const {
+  bool insideRegion2(Dune::FieldVector<double, MY_DIM> const &z) const {
     return liesBelow(_K, _M, z);
   };
 
-  Dune::FieldVector<double, DIM> const &_K;
-  Dune::FieldVector<double, DIM> const &_M;
+  Dune::FieldVector<double, MY_DIM> const &_K;
+  Dune::FieldVector<double, MY_DIM> const &_M;
 
   double const _v1;
   double const _v2;
@@ -30,7 +30,7 @@ class TwoPieceFunction
   TwoPieceFunction(double v1, double v2)
       : _K(MyGeometry::K), _M(MyGeometry::M), _v1(v1), _v2(v2) {}
 
-  void evaluate(Dune::FieldVector<double, DIM> const &x,
+  void evaluate(Dune::FieldVector<double, MY_DIM> const &x,
                 Dune::FieldVector<double, 1> &y) const {
     y = insideRegion2(x) ? _v2 : _v1;
   }
diff --git a/src/sand-wedge.cc b/src/sand-wedge.cc
index 7b9ecf0f..74d93ab0 100644
--- a/src/sand-wedge.cc
+++ b/src/sand-wedge.cc
@@ -16,8 +16,8 @@
 #error datadir unset
 #endif
 
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #if !HAVE_ALUGRID
@@ -84,7 +84,7 @@
 #include "timestepping.hh"
 #include "vtk.hh"
 
-size_t const dims = DIM;
+size_t const dims = MY_DIM;
 
 void initPython() {
   Python::start();
@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) {
       if (myFaces.lower.containsVertex(i))
         dirichletNodes[i][1] = true;
 
-#if DIM == 3
+#if MY_DIM == 3
       if (myFaces.front.containsVertex(i) || myFaces.back.containsVertex(i))
         dirichletNodes[i][2] = true;
 #endif
diff --git a/src/solverfactory_tmpl.cc b/src/solverfactory_tmpl.cc
index db6ecb89..f9edf6e2 100644
--- a/src/solverfactory_tmpl.cc
+++ b/src/solverfactory_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitgrid.hh"
@@ -13,10 +13,10 @@
 #include <dune/tectonic/myblockproblem.hh>
 
 template class SolverFactory<
-    DIM,
+    MY_DIM,
     MyBlockProblem<ConvexProblem<GlobalFriction<Matrix, Vector>, Matrix>>,
     Grid>;
 template class SolverFactory<
-    DIM, BlockNonlinearTNNMGProblem<
+    MY_DIM, BlockNonlinearTNNMGProblem<
              ConvexProblem<ZeroNonlinearity<LocalVector, LocalMatrix>, Matrix>>,
     Grid>;
diff --git a/src/timestepping_tmpl.cc b/src/timestepping_tmpl.cc
index 7c63e759..a61958b8 100644
--- a/src/timestepping_tmpl.cc
+++ b/src/timestepping_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include <dune/common/function.hh>
@@ -8,5 +8,5 @@
 
 using Function = Dune::VirtualFunction<double, double>;
 
-template class Newmark<Vector, Matrix, Function, DIM>;
-template class BackwardEuler<Vector, Matrix, Function, DIM>;
+template class Newmark<Vector, Matrix, Function, MY_DIM>;
+template class BackwardEuler<Vector, Matrix, Function, MY_DIM>;
diff --git a/src/vtk_tmpl.cc b/src/vtk_tmpl.cc
index 2b193004..f6790e5c 100644
--- a/src/vtk_tmpl.cc
+++ b/src/vtk_tmpl.cc
@@ -1,5 +1,5 @@
-#ifndef DIM
-#error DIM unset
+#ifndef MY_DIM
+#error MY_DIM unset
 #endif
 
 #include "explicitgrid.hh"
-- 
GitLab