From 59f8d43e4d3b94c86bb6cb6add0af7fb70bd5c9b Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Sun, 5 Jan 2014 22:03:48 +0100 Subject: [PATCH] [Algorit] (minor) Kill dotFirstNormalised() --- dune/tectonic/localfriction.hh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/dune/tectonic/localfriction.hh b/dune/tectonic/localfriction.hh index 5c67dc38..a202e7f2 100644 --- a/dune/tectonic/localfriction.hh +++ b/dune/tectonic/localfriction.hh @@ -12,23 +12,6 @@ #include "frictionpotential.hh" -// In order to compute (x * y) / |x|, compute x/|x| first -template <class Vector> -double dotFirstNormalised(Vector const &x, Vector const &y) { - double const xnorm = x.two_norm(); - if (xnorm <= 0.0) - return 0.0; - - size_t const xsize = x.size(); - assert(xsize == y.size()); - - double sum = 0; - for (size_t i = 0; i < xsize; ++i) - sum += x[i] / xnorm * y[i]; - - return sum; -} - template <size_t dimension> class LocalFriction { public: using VectorType = Dune::FieldVector<double, dimension>; @@ -63,7 +46,7 @@ template <size_t dimension> class LocalFriction { if (xnorm <= 0.0) D[0] = D[1] = func->differential(0.0) * v.two_norm(); else - D[0] = D[1] = func->differential(xnorm) * dotFirstNormalised(x, v); + D[0] = D[1] = func->differential(xnorm) * (x * v) / xnorm; } /** Formula for the derivative: -- GitLab