diff --git a/dune/tectonic/globalnonlinearity.hh b/dune/tectonic/globalnonlinearity.hh index c09e1f0e8fdac92304360cfb2ac2aa6744d610c7..d2d9c5020cf6b02fd0ee94a978cfc4a907a23923 100644 --- a/dune/tectonic/globalnonlinearity.hh +++ b/dune/tectonic/globalnonlinearity.hh @@ -20,7 +20,9 @@ class GlobalNonlinearity { public: using MatrixType = MatrixTypeTEMPLATE; using VectorType = VectorTypeTEMPLATE; - int static const dim = VectorTypeTEMPLATE::block_type::dimension; + using LocalVectorType = typename VectorType::block_type; + static const int block_size = LocalVectorType::dimension; + using FrictionType = LocalFriction<block_size>; double operator()(VectorType const &x) const { double tmp = 0; @@ -34,7 +36,7 @@ class GlobalNonlinearity { /* Return a restriction of the outer function to the i'th node. */ - virtual shared_ptr<LocalFriction<dim>> restriction(int i) const = 0; + virtual shared_ptr<LocalFriction<block_size>> restriction(int i) const = 0; void addHessian(VectorType const &v, MatrixType &hessian) const { for (size_t i = 0; i < v.size(); ++i) { diff --git a/dune/tectonic/globalruinanonlinearity.hh b/dune/tectonic/globalruinanonlinearity.hh index 23c541e21332743b81910ee783e8875ee5e3ead1..310b688208fea22db87d4c07558cd84c0eb2de21 100644 --- a/dune/tectonic/globalruinanonlinearity.hh +++ b/dune/tectonic/globalruinanonlinearity.hh @@ -17,23 +17,25 @@ namespace Dune { template <class MatrixType, class VectorType> class GlobalRuinaNonlinearity : public GlobalNonlinearity<MatrixType, VectorType> { +public: + using GlobalNonlinearity<MatrixType, VectorType>::block_size; + using typename GlobalNonlinearity<MatrixType, VectorType>::FrictionType; + private: using typename GlobalNonlinearity<MatrixType, VectorType>::SingletonVectorType; public: - using GlobalNonlinearity<MatrixType, VectorType>::dim; - GlobalRuinaNonlinearity(Dune::BitSetVector<1> const &frictionalNodes, SingletonVectorType const &nodalIntegrals, FrictionData const &fd) : restrictions(nodalIntegrals.size()) { auto trivialNonlinearity = - make_shared<LocalFriction<dim>>(make_shared<TrivialFunction>()); + make_shared<FrictionType>(make_shared<TrivialFunction>()); for (size_t i = 0; i < restrictions.size(); ++i) { restrictions[i] = frictionalNodes[i][0] - ? make_shared<LocalFriction<dim>>( + ? make_shared<FrictionType>( make_shared<FrictionPotential>(nodalIntegrals[i], fd)) : trivialNonlinearity; } @@ -47,12 +49,12 @@ class GlobalRuinaNonlinearity /* Return a restriction of the outer function to the i'th node. */ - shared_ptr<LocalFriction<dim>> restriction(int i) const override { + shared_ptr<FrictionType> restriction(int i) const override { return restrictions[i]; } private: - std::vector<shared_ptr<LocalFriction<dim>>> restrictions; + std::vector<shared_ptr<FrictionType>> restrictions; }; } #endif