Skip to content
Snippets Groups Projects
Commit 59f8d43e authored by Elias Pipping's avatar Elias Pipping
Browse files

[Algorit] (minor) Kill dotFirstNormalised()

parent e38cf84a
No related branches found
No related tags found
No related merge requests found
...@@ -12,23 +12,6 @@ ...@@ -12,23 +12,6 @@
#include "frictionpotential.hh" #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 { template <size_t dimension> class LocalFriction {
public: public:
using VectorType = Dune::FieldVector<double, dimension>; using VectorType = Dune::FieldVector<double, dimension>;
...@@ -63,7 +46,7 @@ template <size_t dimension> class LocalFriction { ...@@ -63,7 +46,7 @@ template <size_t dimension> class LocalFriction {
if (xnorm <= 0.0) if (xnorm <= 0.0)
D[0] = D[1] = func->differential(0.0) * v.two_norm(); D[0] = D[1] = func->differential(0.0) * v.two_norm();
else 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: /** Formula for the derivative:
......
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