From 48670531e78c25697dd4b6f7c256241c76b22522 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Wed, 26 Oct 2011 14:39:22 +0000 Subject: [PATCH] Use the ValueFactory class to generate test unit vectors [[Imported from SVN: r8054]] --- test/harmonicenergytest.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/harmonicenergytest.cc b/test/harmonicenergytest.cc index 70d292b6..77190fa4 100644 --- a/test/harmonicenergytest.cc +++ b/test/harmonicenergytest.cc @@ -8,6 +8,7 @@ #include <dune/gfe/harmonicenergystiffness.hh> #include "multiindex.hh" +#include "valuefactory.hh" const int dim = 2; @@ -131,24 +132,19 @@ void testUnitVector3d() // Test whether the energy is invariant under isometries // ////////////////////////////////////////////////////////// - int nTestPoints = 10; - double testPoints[10][3] = {{1,0,0}, {0,1,0}, {-0.838114,0.356751,-0.412667}, - {-0.490946,-0.306456,0.81551},{-0.944506,0.123687,-0.304319}, - {-0.6,0.1,-0.2},{0.45,0.12,0.517}, - {-0.1,0.3,-0.1},{-0.444506,0.123687,0.104319},{-0.7,-0.123687,-0.304319}}; - + std::vector<TargetSpace> testPoints; + ValueFactory<TargetSpace>::get(testPoints); + // Set up elements of S^2 std::vector<TargetSpace> coefficients(dim+1); - MultiIndex index(dim+1, nTestPoints); + MultiIndex index(dim+1, testPoints.size()); int numIndices = index.cycle(); for (int i=0; i<numIndices; i++, ++index) { - for (int j=0; j<dim+1; j++) { - Dune::array<double,3> w = {testPoints[index[j]][0], testPoints[index[j]][1], testPoints[index[j]][2]}; - coefficients[j] = UnitVector<3>(w); - } + for (int j=0; j<dim+1; j++) + coefficients[j] = testPoints[index[j]]; testEnergy<GridType>(grid, coefficients); testGradientOfEnergy(grid, coefficients); -- GitLab