From d9b5d78249918045dba2cd01cf4d04c582f94b1b Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Thu, 3 Nov 2011 00:33:04 +0100 Subject: [PATCH] Add MyGlobalNonlinearity class --- dune/tectonic/myglobalnonlinearity.hh | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dune/tectonic/myglobalnonlinearity.hh diff --git a/dune/tectonic/myglobalnonlinearity.hh b/dune/tectonic/myglobalnonlinearity.hh new file mode 100644 index 00000000..dfa47e5f --- /dev/null +++ b/dune/tectonic/myglobalnonlinearity.hh @@ -0,0 +1,37 @@ +/* -*- mode:c++; mode:semantic -*- */ + +#ifndef MY_GLOBAL_NONLINEARITY_HH +#define MY_GLOBAL_NONLINEARITY_HH + +//#include <dune/common/bitsetvector.hh> +#include <dune/common/fvector.hh> +#include <dune/tectonic/mynonlinearity.hh> + +namespace Dune { +template <int dim, class OuterFunctionType> class MyGlobalNonlinearity { +public: + MyGlobalNonlinearity( + std::vector<double> const &coefficientOfFriction, + std::vector<double> const &normalStress, + std::vector<Dune::FieldVector<double, 1>> const &nodalIntegrals) + : coefficientOfFriction(coefficientOfFriction), + normalStress(normalStress), + nodalIntegrals(nodalIntegrals) {} + + void restriction(int i, OuterFunctionType &f) { + double coefficient = normalStress[i] * nodalIntegrals[i]; + // FIXME: Assume Gamma = id and h_{n+1} = 1 for now; + // We then only have to evaluate (1 + F_xi)(|x|) + coefficient *= 1 + coefficientOfFriction[i]; + f = OuterFunctionType(coefficient); + } + +private: + // TODO: If we're clever, we only store one vector with the precomputed + // results + std::vector<double> coefficientOfFriction; + std::vector<double> normalStress; + std::vector<Dune::FieldVector<double, 1>> nodalIntegrals; +}; +} +#endif -- GitLab