Skip to content
Snippets Groups Projects
Commit 06a9cb0d authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Enable unit testing for the RigidBodyMotion<3> class

This involves fixing the secondDerivativeOfDistanceSquaredWRTSecondArgument
method: Previously it returned a FieldMatrix, but the test requires
a SymmetricMatrix.
parent f4d12b8d
No related branches found
No related tags found
1 merge request!93Enable more tests for the various TargetSpace classes
......@@ -145,22 +145,26 @@ public:
}
/** \brief Compute the Hessian of the squared distance function keeping the first argument fixed */
static Dune::FieldMatrix<T,embeddedDim,embeddedDim> secondDerivativeOfDistanceSquaredWRTSecondArgument(const RigidBodyMotion<ctype,N> & p, const RigidBodyMotion<ctype,N> & q)
static Dune::SymmetricMatrix<T,embeddedDim> secondDerivativeOfDistanceSquaredWRTSecondArgument(const RigidBodyMotion<ctype,N> & p, const RigidBodyMotion<ctype,N> & q)
{
Dune::FieldMatrix<T,embeddedDim,embeddedDim> result(0);
Dune::SymmetricMatrix<T,embeddedDim> result;
// The linear part
Dune::FieldMatrix<T,N,N> linearPart = RealTuple<T,N>::secondDerivativeOfDistanceSquaredWRTSecondArgument(p.r,q.r);
Dune::SymmetricMatrix<T,N> linearPart = RealTuple<T,N>::secondDerivativeOfDistanceSquaredWRTSecondArgument(p.r,q.r);
for (int i=0; i<N; i++)
for (int j=0; j<N; j++)
result[i][j] = linearPart[i][j];
for (int j=0; j<=i; j++)
result(i,j) = linearPart(i,j);
// The rotation part
Dune::FieldMatrix<T,Rotation<T,N>::embeddedDim,Rotation<T,N>::embeddedDim> rotationPart
Dune::SymmetricMatrix<T,Rotation<T,N>::embeddedDim> rotationPart
= Rotation<ctype,N>::secondDerivativeOfDistanceSquaredWRTSecondArgument(p.q,q.q);
for (int i=0; i<Rotation<T,N>::embeddedDim; i++)
for (int j=0; j<Rotation<T,N>::embeddedDim; j++)
result[N+i][N+j] = rotationPart[i][j];
{
for (int j=0; j<N; j++)
result(N+i,j) = 0;
for (int j=0; j<=i; j++)
result(N+i,N+j) = rotationPart(i,j);
}
return result;
}
......
......@@ -380,7 +380,8 @@ int main() try
// test<Rotation<double,3> >();
//
// test<RigidBodyMotion<double,3> >();
// Test the RigidBodyMotion class
test<RigidBodyMotion<double,3> >();
//
// test<HyperbolicHalfspacePoint<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