From 80fc84939b8a44302f2115d5af0c6f5e88931367 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Wed, 18 Dec 2019 15:12:15 +0100
Subject: [PATCH] Remove confusing redundant dimension definition

In the test, the grid dimension was defined twice:  Once globally
at the top of the file, and once through a chain of template parameters.
This patch removes the global variable.
---
 test/harmonicenergytest.cc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/harmonicenergytest.cc b/test/harmonicenergytest.cc
index 4c05e98a..632fe3df 100644
--- a/test/harmonicenergytest.cc
+++ b/test/harmonicenergytest.cc
@@ -11,7 +11,6 @@
 #include "multiindex.hh"
 #include "valuefactory.hh"
 
-const int dim = 2;
 
 
 using namespace Dune;
@@ -33,7 +32,7 @@ void testEnergy(const Basis& basis, const std::vector<TargetSpace>& coefficients
     using GridView = typename Basis::GridView;
     GridView gridView = basis.gridView();
 
-    using GeodesicInterpolationRule  = LocalGeodesicFEFunction<dim, double, typename Basis::LocalView::Tree::FiniteElement, TargetSpace>;
+    using GeodesicInterpolationRule  = LocalGeodesicFEFunction<Basis::GridView::dimension, double, typename Basis::LocalView::Tree::FiniteElement, TargetSpace>;
 
     HarmonicEnergy<Basis,GeodesicInterpolationRule,TargetSpace> assembler;
     std::vector<TargetSpace> rotatedCoefficients(coefficients.size());
@@ -72,7 +71,7 @@ void test()
 
     GridFactory<GridType> factory;
 
-    FieldVector<double,dim> pos(0);
+    FieldVector<double,domainDim> pos(0);
     factory.insertVertex(pos);
 
     for (int i=0; i<domainDim; i++) {
@@ -84,7 +83,7 @@ void test()
     std::vector<unsigned int> v(domainDim+1);
     for (int i=0; i<domainDim+1; i++)
         v[i] = i;
-    factory.insertElement(GeometryTypes::simplex(dim), v);
+    factory.insertElement(GeometryTypes::simplex(domainDim), v);
 
     auto grid = std::unique_ptr<const GridType>(factory.createGrid());
     using GridView = typename GridType::LeafGridView;
@@ -102,14 +101,14 @@ void test()
     ValueFactory<TargetSpace>::get(testPoints);
 
     // Set up elements of S^2
-    std::vector<TargetSpace> coefficients(dim+1);
+    std::vector<TargetSpace> coefficients(domainDim+1);
 
-    ::MultiIndex index(dim+1, testPoints.size());
+    ::MultiIndex index(domainDim+1, testPoints.size());
     int numIndices = index.cycle();
 
     for (int i=0; i<numIndices; i++, ++index) {
         
-        for (int j=0; j<dim+1; j++)
+        for (int j=0; j<domainDim+1; j++)
             coefficients[j] = testPoints[index[j]];
 
         // This may be overly restrictive, but see the TODO in targetspacetrsolver.cc
-- 
GitLab