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

add a few missing methods. I can compute harmonic maps for RealTuples now

[[Imported from SVN: r5783]]
parent b50ac0c7
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ class RealTuple ...@@ -15,6 +15,8 @@ class RealTuple
{ {
public: public:
typedef double ctype;
typedef Dune::FieldVector<double,N> EmbeddedTangentVector; typedef Dune::FieldVector<double,N> EmbeddedTangentVector;
typedef Dune::FieldVector<double,N> TangentVector; typedef Dune::FieldVector<double,N> TangentVector;
...@@ -29,6 +31,21 @@ public: ...@@ -29,6 +31,21 @@ public:
data_ = v; data_ = v;
} }
/** \brief Copy constructor */
RealTuple(const RealTuple<N>& other)
: data_(other.data_)
{}
/** \brief Constructor from FieldVector*/
RealTuple(const Dune::FieldVector<double,N>& other)
: data_(other)
{}
RealTuple& operator=(const Dune::FieldVector<double,N>& other) {
data_ = other;
return *this;
}
/** \brief The exponention map */ /** \brief The exponention map */
static RealTuple exp(const RealTuple& p, const TangentVector& v) { static RealTuple exp(const RealTuple& p, const TangentVector& v) {
return RealTuple(p.data_+v); return RealTuple(p.data_+v);
...@@ -53,7 +70,10 @@ public: ...@@ -53,7 +70,10 @@ public:
Unlike the distance itself the squared distance is differentiable at zero Unlike the distance itself the squared distance is differentiable at zero
*/ */
static EmbeddedTangentVector derivativeOfDistanceSquaredWRTSecondArgument(const RealTuple& a, const RealTuple& b) { static EmbeddedTangentVector derivativeOfDistanceSquaredWRTSecondArgument(const RealTuple& a, const RealTuple& b) {
return -2*(a.data_ - b.data_); EmbeddedTangentVector result = a.data_;
result -= b.data_;
result *= -2;
return result;
} }
/** \brief Compute the Hessian of the squared distance function keeping the first argument fixed /** \brief Compute the Hessian of the squared distance function keeping the first argument fixed
......
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