Skip to content
Snippets Groups Projects
Commit 48670531 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

Use the ValueFactory class to generate test unit vectors

[[Imported from SVN: r8054]]
parent e777665c
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment