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

get rid of global 'dim' parameter

[[Imported from SVN: r8460]]
parent dcf081f4
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "multiindex.hh" #include "multiindex.hh"
#include "valuefactory.hh" #include "valuefactory.hh"
const int dim = 2;
const double eps = 1e-4; const double eps = 1e-4;
typedef RigidBodyMotion<double,3> TargetSpace; typedef RigidBodyMotion<double,3> TargetSpace;
...@@ -34,7 +32,7 @@ std::auto_ptr<GridType> makeSingleSimplexGrid() ...@@ -34,7 +32,7 @@ std::auto_ptr<GridType> makeSingleSimplexGrid()
static const int domainDim = GridType::dimension; static const int domainDim = GridType::dimension;
GridFactory<GridType> factory; GridFactory<GridType> factory;
FieldVector<double,dim> pos(0); FieldVector<double,domainDim> pos(0);
factory.insertVertex(pos); factory.insertVertex(pos);
for (int i=0; i<domainDim+1; i++) { for (int i=0; i<domainDim+1; i++) {
...@@ -46,7 +44,7 @@ std::auto_ptr<GridType> makeSingleSimplexGrid() ...@@ -46,7 +44,7 @@ std::auto_ptr<GridType> makeSingleSimplexGrid()
std::vector<unsigned int> v(domainDim+1); std::vector<unsigned int> v(domainDim+1);
for (int i=0; i<domainDim+1; i++) for (int i=0; i<domainDim+1; i++)
v[i] = i; v[i] = i;
factory.insertElement(GeometryType(GeometryType::simplex,dim), v); factory.insertElement(GeometryType(GeometryType::simplex,domainDim), v);
return std::auto_ptr<GridType>(factory.createGrid()); return std::auto_ptr<GridType>(factory.createGrid());
} }
...@@ -222,14 +220,14 @@ void testFrameInvariance() ...@@ -222,14 +220,14 @@ void testFrameInvariance()
ValueFactory<TargetSpace>::get(testPoints); ValueFactory<TargetSpace>::get(testPoints);
// Set up elements of SE(3) // Set up elements of SE(3)
std::vector<TargetSpace> coefficients(dim+1); std::vector<TargetSpace> coefficients(domainDim+1);
MultiIndex index(dim+1, testPoints.size()); MultiIndex index(domainDim+1, testPoints.size());
int numIndices = index.cycle(); int numIndices = index.cycle();
for (int i=0; i<numIndices; i++, ++index) { for (int i=0; i<numIndices; i++, ++index) {
for (int j=0; j<dim+1; j++) for (int j=0; j<domainDim+1; j++)
coefficients[j] = testPoints[index[j]]; coefficients[j] = testPoints[index[j]];
testEnergy<GridType>(grid.get(), coefficients); testEnergy<GridType>(grid.get(), coefficients);
...@@ -283,9 +281,9 @@ void testEnergyGradient() ...@@ -283,9 +281,9 @@ void testEnergyGradient()
ValueFactory<TargetSpace>::get(testPoints); ValueFactory<TargetSpace>::get(testPoints);
// Set up elements of SE(3) // Set up elements of SE(3)
std::vector<TargetSpace> coefficients(dim+1); std::vector<TargetSpace> coefficients(domainDim+1);
MultiIndex index(dim+1, testPoints.size()); MultiIndex index(domainDim+1, testPoints.size());
int numIndices = index.cycle(); int numIndices = index.cycle();
std::vector<typename RigidBodyMotion<double,3>::TangentVector> gradient(coefficients.size()); std::vector<typename RigidBodyMotion<double,3>::TangentVector> gradient(coefficients.size());
...@@ -293,7 +291,7 @@ void testEnergyGradient() ...@@ -293,7 +291,7 @@ void testEnergyGradient()
for (int i=0; i<numIndices; i++, ++index) { for (int i=0; i<numIndices; i++, ++index) {
for (int j=0; j<dim+1; j++) for (int j=0; j<domainDim+1; j++)
coefficients[j] = testPoints[index[j]]; coefficients[j] = testPoints[index[j]];
// Compute the analytical gradient // Compute the analytical gradient
......
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