diff --git a/dune/gfe/unitvector.hh b/dune/gfe/unitvector.hh index 63ce6f720ae08bbdab7d12cb54b3b15f2276610b..87875bf661d9b51b644f2314d3b07a3da29d7dc1 100644 --- a/dune/gfe/unitvector.hh +++ b/dune/gfe/unitvector.hh @@ -374,6 +374,15 @@ public: return result; } + static Dune::FieldMatrix<T, N, N> derivativeOfProjection(const Dune::FieldVector<T,N>& p) + { + Dune::FieldMatrix<T,N,N> result; + for (int i=0; i<N; i++) + for (int j=0; j<N; j++) + result[i][j] = ( (i==j) - p[i]*p[j] / p.two_norm2() ) / p.two_norm(); + return result; + } + /** \brief The global coordinates, if you really want them */ const CoordinateType& globalCoordinates() const { return data_;