diff --git a/dune/gfe/rigidbodymotion.hh b/dune/gfe/rigidbodymotion.hh index 34da7efb044943009e10000891b4cf97fe356981..4fc2d6fcc7129d4ed47349e9a216085ba74abe43 100644 --- a/dune/gfe/rigidbodymotion.hh +++ b/dune/gfe/rigidbodymotion.hh @@ -20,8 +20,14 @@ struct RigidBodyMotion /** \brief The type used for coordinates */ typedef T ctype; - /** \brief The exponential map from a given point $p \in SE(d)$. */ - static RigidBodyMotion<dim,ctype> exp(const RigidBodyMotion<dim,ctype>& p, const TangentVector& v) { + /** \brief The exponential map from a given point $p \in SE(d)$. + + Why the template parameter? Well, it should work with both TangentVector and EmbeddedTangentVector. + In general these differ and we could just have two exp methods. However in 2d they do _not_ differ, + and then the compiler complains about having two methods with the same signature. + */ + template <class TVector> + static RigidBodyMotion<dim,ctype> exp(const RigidBodyMotion<dim,ctype>& p, const TVector& v) { RigidBodyMotion<dim,ctype> result; @@ -30,8 +36,11 @@ struct RigidBodyMotion result.r[i] = p.r[i] + v[i]; // Add rotational correction - typename Rotation<dim,ctype>::TangentVector qCorr; - for (int i=0; i<Rotation<dim,ctype>::TangentVector::size; i++) + typedef typename Dune::SelectType<Dune::is_same<TVector,TangentVector>::value, + typename Rotation<dim,ctype>::TangentVector, + typename Rotation<dim,ctype>::EmbeddedTangentVector>::Type RotationTangentVector; + RotationTangentVector qCorr; + for (int i=0; i<RotationTangentVector::size; i++) qCorr[i] = v[dim+i]; result.q = Rotation<dim,ctype>::exp(p.q, qCorr); diff --git a/dune/gfe/rotation.hh b/dune/gfe/rotation.hh index fef9e118531c88a79b3024305bb815dd230a5416..b141a84d45822a0adda8d2d869f5d7e3b22dd794 100644 --- a/dune/gfe/rotation.hh +++ b/dune/gfe/rotation.hh @@ -225,6 +225,11 @@ public: return p.mult(corr); } + /** \brief The exponential map from a given point $p \in SO(3)$. */ + static Rotation<3,T> exp(const Rotation<3,T>& p, const EmbeddedTangentVector& v) { + DUNE_THROW(Dune::NotImplemented, "exp... EmbeddedTangentVector"); + } + static Dune::FieldMatrix<T,4,3> Dexp(const Dune::FieldVector<T,3>& v) { Dune::FieldMatrix<T,4,3> result(0);