diff --git a/src/sand-wedge-data/midpoint.hh b/src/sand-wedge-data/midpoint.hh new file mode 100644 index 0000000000000000000000000000000000000000..27a2fd4f3da6d6d7d501b117cfc1936835c3dc77 --- /dev/null +++ b/src/sand-wedge-data/midpoint.hh @@ -0,0 +1,12 @@ +#ifndef SRC_MIDPOINT_HH +#define SRC_MIDPOINT_HH + +#include <dune/solvers/common/arithmetic.hh> + +template <class Vector> Vector midPoint(Vector const &x, Vector const &y) { + Vector ret{ 0 }; + Arithmetic::addProduct(ret, 0.5, x); + Arithmetic::addProduct(ret, 0.5, y); + return ret; +} +#endif diff --git a/src/sand-wedge-data/mygeometry.hh b/src/sand-wedge-data/mygeometry.hh index 468175d7ac5965a638b33a063e7a1d2f166fcdb3..d3b122bb7ac321de0d69752caac267e87bfb0264 100644 --- a/src/sand-wedge-data/mygeometry.hh +++ b/src/sand-wedge-data/mygeometry.hh @@ -3,14 +3,14 @@ #include <dune/common/fvector.hh> -#include <dune/fufem/arithmetic.hh> - #ifdef HAVE_CAIROMM #include <cairomm/context.h> #include <cairomm/fontface.h> #include <cairomm/surface.h> #endif +#include "midpoint.hh" + namespace MyGeometry { namespace { using LocalVector2D = Dune::FieldVector<double, 2>; @@ -35,14 +35,6 @@ namespace { ret[1][1] = a22; return ret; } - - LocalVector2D convexCombination(LocalVector2D const &x, - LocalVector2D const &y) { - LocalVector2D ret{ 0 }; - Arithmetic::addProduct(ret, 0.5, x); - Arithmetic::addProduct(ret, 0.5, y); - return ret; - } } namespace reference { @@ -67,9 +59,9 @@ namespace reference { createVector(B[0] - leftLeg * viscoHeight / rightLeg, B[1] + viscoHeight); LocalVector2D const M = createVector(B[0], B[1] + viscoHeight); - LocalVector2D const G = convexCombination(A, X); - LocalVector2D const H = convexCombination(X, Y); - LocalVector2D const J = convexCombination(Y, B); + LocalVector2D const G = midPoint(A, X); + LocalVector2D const H = midPoint(X, Y); + LocalVector2D const J = midPoint(Y, B); LocalVector2D const I = createVector(Y[0] + G[0], Y[1] + G[1]);