From 8dc0d3ab8a91510e99699c1852a056eecf37ca36 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Fri, 8 Apr 2011 17:34:17 +0000
Subject: [PATCH] Move the MultiIndex class into a separate file

[[Imported from SVN: r7120]]
---
 test/localgeodesicfefunctiontest.cc | 48 +-------------------------
 test/multiindex.hh                  | 52 +++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 47 deletions(-)
 create mode 100644 test/multiindex.hh

diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc
index 1439e86b..4b3e3533 100644
--- a/test/localgeodesicfefunctiontest.cc
+++ b/test/localgeodesicfefunctiontest.cc
@@ -11,58 +11,12 @@
 #include <dune/gfe/unitvector.hh>
 
 #include <dune/gfe/localgeodesicfefunction.hh>
+#include "multiindex.hh"
 
 const double eps = 1e-6;
 
 using namespace Dune;
 
-/** \brief N-dimensional multi-index
-*/
-template <int N>
-class MultiIndex
-    : public array<unsigned int,N>
-{
-
-    // The range of each component
-    unsigned int limit_;
-
-public:
-    /** \brief Constructor with a given range for each digit */
-    MultiIndex(unsigned int limit)
-        : limit_(limit)
-    {
-        std::fill(this->begin(), this->end(), 0);
-    }
-
-    /** \brief Increment the MultiIndex */
-    MultiIndex& operator++() {
-
-        for (int i=0; i<N; i++) {
-
-            // Augment digit
-            (*this)[i]++;
-
-            // If there is no carry-over we can stop here
-            if ((*this)[i]<limit_)
-                break;
-
-            (*this)[i] = 0;
-                    
-        }
-        return *this;
-    }
-
-    /** \brief Compute how many times you can call operator++ before getting to (0,...,0) again */
-    size_t cycle() const {
-        size_t result = 1;
-        for (int i=0; i<N; i++)
-            result *= limit_;
-        return result;
-    }
-
-};
-
-
 template <int domainDim>
 void testDerivativeTangentiality(const RealTuple<1>& x,
                                  const FieldMatrix<double,1,domainDim>& derivative)
diff --git a/test/multiindex.hh b/test/multiindex.hh
new file mode 100644
index 00000000..c088c8f3
--- /dev/null
+++ b/test/multiindex.hh
@@ -0,0 +1,52 @@
+#ifndef MULTI_INDEX_HH
+#define MULTI_INDEX_HH
+
+#include <dune/common/array.hh>
+
+/** \brief N-dimensional multi-index
+*/
+template <int N>
+class MultiIndex
+    : public Dune::array<unsigned int,N>
+{
+
+    // The range of each component
+    unsigned int limit_;
+
+public:
+    /** \brief Constructor with a given range for each digit */
+    MultiIndex(unsigned int limit)
+        : limit_(limit)
+    {
+        std::fill(this->begin(), this->end(), 0);
+    }
+
+    /** \brief Increment the MultiIndex */
+    MultiIndex& operator++() {
+
+        for (int i=0; i<N; i++) {
+
+            // Augment digit
+            (*this)[i]++;
+
+            // If there is no carry-over we can stop here
+            if ((*this)[i]<limit_)
+                break;
+
+            (*this)[i] = 0;
+                    
+        }
+        return *this;
+    }
+
+    /** \brief Compute how many times you can call operator++ before getting to (0,...,0) again */
+    size_t cycle() const {
+        size_t result = 1;
+        for (int i=0; i<N; i++)
+            result *= limit_;
+        return result;
+    }
+
+};
+
+#endif
\ No newline at end of file
-- 
GitLab