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

merge the tests for the different TargetSpaces into a single method

[[Imported from SVN: r7904]]
parent 6317cf4b
No related branches found
No related tags found
No related merge requests found
......@@ -20,95 +20,14 @@ const double eps = 1e-6;
using namespace Dune;
template <int domainDim>
void testRealTuples()
template <class TargetSpace, int domainDim>
void test()
{
std::cout << " --- Testing RealTuple<1>, domain dimension: " << domainDim << " ---" << std::endl;
typedef RealTuple<1> TargetSpace;
std::vector<TargetSpace> corners = {TargetSpace(1),
TargetSpace(2),
TargetSpace(3)};
}
template <int domainDim>
void testUnitVector2d()
{
std::cout << " --- Testing UnitVector<2>, domain dimension: " << domainDim << " ---" << std::endl;
typedef UnitVector<2> TargetSpace;
std::cout << " --- Testing " << className<TargetSpace>() << ", domain dimension: " << domainDim << " ---" << std::endl;
std::vector<TargetSpace> testPoints;
ValueFactory<TargetSpace>::get(testPoints);
int nTestPoints = testPoints.size();
// Set up elements of S^1
std::vector<TargetSpace> corners(domainDim+1);
MultiIndex<domainDim+1> index(nTestPoints);
int numIndices = index.cycle();
for (int i=0; i<numIndices; i++, ++index) {
for (int j=0; j<domainDim+1; j++)
corners[j] = testPoints[index[j]];
bool spreadOut = false;
for (int j=0; j<domainDim+1; j++)
for (int k=0; k<domainDim+1; k++)
if (UnitVector<2>::distance(corners[j],corners[k]) > M_PI*0.98)
spreadOut = true;
if (spreadOut)
continue;
}
}
template <int domainDim>
void testUnitVector3d()
{
std::cout << " --- Testing UnitVector<3>, domain dimension: " << domainDim << " ---" << std::endl;
typedef UnitVector<3> TargetSpace;
std::vector<TargetSpace> testPoints;
ValueFactory<TargetSpace>::get(testPoints);
int nTestPoints = testPoints.size();
// Set up elements of S^2
std::vector<TargetSpace> corners(domainDim+1);
MultiIndex<domainDim+1> index(nTestPoints);
int numIndices = index.cycle();
for (int i=0; i<numIndices; i++, ++index) {
for (int j=0; j<domainDim+1; j++)
corners[j] = testPoints[index[j]];
}
}
template <int domainDim>
void testRotation()
{
std::cout << " --- Testing Rotation<3>, domain dimension: " << domainDim << " ---" << std::endl;
typedef Rotation<3,double> TargetSpace;
std::vector<Rotation<3,double> > testPoints;
ValueFactory<Rotation<3,double> >::get(testPoints);
int nTestPoints = testPoints.size();
// Set up elements of SO(3)
......@@ -119,6 +38,7 @@ void testRotation()
PQkLocalFiniteElementCache<double,double,domainDim,1> feCache;
typedef typename PQkLocalFiniteElementCache<double,double,domainDim,1>::FiniteElementType LocalFiniteElement;
GeometryType simplex;
simplex.makeSimplex(domainDim);
......@@ -142,12 +62,13 @@ int main()
std::cout << std::setw(15) << std::setprecision(12);
testRealTuples<1>();
testUnitVector2d<1>();
testUnitVector3d<1>();
testUnitVector2d<2>();
testUnitVector3d<2>();
test<RealTuple<1>, 1>();
testRotation<1>();
testRotation<2>();
test<UnitVector<2>, 1>();
test<UnitVector<3>, 1>();
test<UnitVector<2>, 2>();
test<UnitVector<3>, 2>();
test<Rotation<3,double>, 1>();
test<Rotation<3,double>, 2>();
}
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