diff --git a/test/cosseratenergytest.cc b/test/cosseratenergytest.cc index 2622b6c9a7d26a5627e4772f8e043aca1fd1456f..751ece3d091fa2a933e9d3491881c824404532a9 100644 --- a/test/cosseratenergytest.cc +++ b/test/cosseratenergytest.cc @@ -156,7 +156,7 @@ int main(int argc, char** argv) // Set up elements of SO(3) std::vector<TargetSpace> corners(domainDim+1); - MultiIndex<domainDim+1> index(nTestPoints); + MultiIndex index(domainDim+1, nTestPoints); int numIndices = index.cycle(); for (int i=0; i<numIndices; i++, ++index) { diff --git a/test/harmonicenergytest.cc b/test/harmonicenergytest.cc index fcc88fdedb2b4e2501e9ef0f09c10570102cf857..54f8b48ea9a9ca40b16f6fd43a70cb400a52defb 100644 --- a/test/harmonicenergytest.cc +++ b/test/harmonicenergytest.cc @@ -127,7 +127,7 @@ void testUnitVector3d() // Set up elements of S^2 std::vector<TargetSpace> coefficients(dim+1); - MultiIndex<dim+1> index(nTestPoints); + MultiIndex index(dim+1, nTestPoints); int numIndices = index.cycle(); for (int i=0; i<numIndices; i++, ++index) { diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc index c5b27935724f45a11b83b39c10762c92220240eb..6d3a2b1c67144339e27eb76335f27ceab8e8ac91 100644 --- a/test/localgeodesicfefunctiontest.cc +++ b/test/localgeodesicfefunctiontest.cc @@ -275,7 +275,7 @@ void test() // Set up elements of the target space std::vector<TargetSpace> corners(domainDim+1); - MultiIndex<domainDim+1> index(nTestPoints); + MultiIndex index(domainDim+1, nTestPoints); int numIndices = index.cycle(); for (int i=0; i<numIndices; i++, ++index) { diff --git a/test/localgeodesicfestiffnesstest.cc b/test/localgeodesicfestiffnesstest.cc index 426a4eb480606cf31c3ffed2b9c1481c910f74a9..7391cc056a0a9e2f683ca80863d6f134314b0378 100644 --- a/test/localgeodesicfestiffnesstest.cc +++ b/test/localgeodesicfestiffnesstest.cc @@ -116,7 +116,7 @@ void testHessian() // Set up elements of S^2 std::vector<TargetSpace> coefficients(domainDim+1); - MultiIndex<domainDim+1> index(nTestPoints); + MultiIndex index(domainDim+1, nTestPoints); int numIndices = index.cycle(); size_t nDofs = domainDim+1; diff --git a/test/localgfetestfunctiontest.cc b/test/localgfetestfunctiontest.cc index 90495d063c5b7d8bb908d10514719ba0a8fa97f9..3a1b1d23e90a2b49b75491d2da006951c954a65a 100644 --- a/test/localgfetestfunctiontest.cc +++ b/test/localgfetestfunctiontest.cc @@ -34,7 +34,7 @@ void test() // Set up elements of SO(3) std::vector<TargetSpace> coefficients(domainDim+1); - MultiIndex<domainDim+1> index(nTestPoints); + MultiIndex index(domainDim+1, nTestPoints); int numIndices = index.cycle(); PQkLocalFiniteElementCache<double,double,domainDim,1> feCache; diff --git a/test/multiindex.hh b/test/multiindex.hh index c088c8f3bb14da8164448ba1a0f8ee2d586ae45a..f9b9fad353d8b49f35d93b1b0497ef6818e8faf0 100644 --- a/test/multiindex.hh +++ b/test/multiindex.hh @@ -1,22 +1,24 @@ #ifndef MULTI_INDEX_HH #define MULTI_INDEX_HH -#include <dune/common/array.hh> +#include <vector> -/** \brief N-dimensional multi-index +/** \brief A multi-index */ -template <int N> class MultiIndex - : public Dune::array<unsigned int,N> + : public std::vector<unsigned int> { // The range of each component unsigned int limit_; public: - /** \brief Constructor with a given range for each digit */ - MultiIndex(unsigned int limit) - : limit_(limit) + /** \brief Constructor with a given range for each digit + * \param n Number of digits + */ + MultiIndex(unsigned int n, unsigned int limit) + : std::vector<unsigned int>(n), + limit_(limit) { std::fill(this->begin(), this->end(), 0); } @@ -24,7 +26,7 @@ public: /** \brief Increment the MultiIndex */ MultiIndex& operator++() { - for (int i=0; i<N; i++) { + for (size_t i=0; i<size(); i++) { // Augment digit (*this)[i]++; @@ -42,7 +44,7 @@ public: /** \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++) + for (size_t i=0; i<size(); i++) result *= limit_; return result; } diff --git a/test/svdtest.cc b/test/svdtest.cc index 1d49302a4078d064b536fb399b46190b521ffc25..7f53915c43c33d6ab5d66360066ec6ecf0a8fa23 100644 --- a/test/svdtest.cc +++ b/test/svdtest.cc @@ -16,7 +16,7 @@ int main() int nTestValues = 5; double maxDiff = 0; - MultiIndex<N*M> index(nTestValues); + MultiIndex index(N*M, nTestValues); int numIndices = index.cycle(); for (int i=0; i<numIndices; i++, ++index) {