#ifndef DUNE_TECTONIC_GLOBAL_NONLINEARITY_HH #define DUNE_TECTONIC_GLOBAL_NONLINEARITY_HH #include <dune/common/fvector.hh> #include <dune/common/shared_ptr.hh> #include <dune/istl/bvector.hh> #include <dune/istl/bcrsmatrix.hh> #include "nicefunction.hh" #include "localnonlinearity.hh" namespace Dune { template <int dim, class VectorType = BlockVector<FieldVector<double, dim>>, class MatrixType = BCRSMatrix<FieldMatrix<double, dim, dim>>> class GlobalNonlinearity { public: /* Return a restriction of the outer function to the i'th node. */ virtual shared_ptr<LocalNonlinearity<dim> const> restriction(int i) const = 0; virtual void addHessian(const VectorType& v, MatrixType& hessian) const { // TODO: is this correct? for (size_t i = 0; i < v.size(); ++i) { auto res = restriction(i); res->addHessian(v[i], hessian[i][i]); } } }; } #endif