diff --git a/dune/gfe/assemblers/localfirstordermodel.hh b/dune/gfe/assemblers/localfirstordermodel.hh index 44f0eaab9e1f9273053beb32268298549b1240f4..e9bcb5319af256331a84da47b006dfe8e6d05351 100644 --- a/dune/gfe/assemblers/localfirstordermodel.hh +++ b/dune/gfe/assemblers/localfirstordermodel.hh @@ -1,26 +1,49 @@ -#ifndef DUNE_GFE_LOCALFIRSTORDERMODEL_HH -#define DUNE_GFE_LOCALFIRSTORDERMODEL_HH +#ifndef DUNE_GFE_ASSEMBLERS_LOCALFIRSTORDERMODEL_HH +#define DUNE_GFE_ASSEMBLERS_LOCALFIRSTORDERMODEL_HH #include <dune/gfe/assemblers/localenergy.hh> -namespace Dune { - - namespace GFE { +namespace Dune::GFE +{ + namespace Impl + { + /** \brief A class exporting container types for sets of tangent vectors + * + * This generic template handles TargetSpaces that are not product manifolds. + */ + template <class TargetSpace> + struct LocalFirstOrderModelTypes + : public LocalEnergyTypes<TargetSpace> + { + using Gradient = std::vector<typename TargetSpace::TangentVector>; + }; - template<class Basis, class TargetSpace> - class LocalFirstOrderModel - : public Dune::GFE::LocalEnergy<Basis,TargetSpace> + /** \brief A class exporting container types for sets of tangent vectors -- specialization for product manifolds + */ + template <class ... Factors> + struct LocalFirstOrderModelTypes<ProductManifold<Factors...> > + : public LocalEnergyTypes<ProductManifold<Factors...> > { - public: + using Gradient = std::vector<typename ProductManifold<Factors...>::TangentVector>; + }; - /** \brief Assemble the element gradient of the energy functional */ - virtual void assembleGradient(const typename Basis::LocalView& localView, - const std::vector<TargetSpace>& solution, - std::vector<typename TargetSpace::TangentVector>& gradient) const = 0; + } // namespace Impl - }; - } // namespace GFE + /** \brief Base class for problems that have an energy and a first derivative + */ + template<class Basis, class TargetSpace> + class LocalFirstOrderModel + : public Dune::GFE::LocalEnergy<Basis,TargetSpace> + { + public: + + /** \brief Assemble the element gradient of the energy functional */ + virtual void assembleGradient(const typename Basis::LocalView& localView, + const typename Impl::LocalFirstOrderModelTypes<TargetSpace>::Coefficients& coefficients, + typename Impl::LocalFirstOrderModelTypes<TargetSpace>::Gradient& gradient) const = 0; + + }; } // namespace Dune diff --git a/dune/gfe/assemblers/localgeodesicfestiffness.hh b/dune/gfe/assemblers/localgeodesicfestiffness.hh index b4f4223b492836c1995607ef1fc557a506fc6f69..d43f18ecafc61c9dcae6a09b595c02137a1f5074 100644 --- a/dune/gfe/assemblers/localgeodesicfestiffness.hh +++ b/dune/gfe/assemblers/localgeodesicfestiffness.hh @@ -12,6 +12,7 @@ namespace Dune::GFE { template<class TargetSpace> class LocalStiffnessTypes + : public LocalFirstOrderModelTypes<TargetSpace> { // Number type typedef typename TargetSpace::ctype RT; @@ -31,23 +32,14 @@ template<class Basis, class TargetSpace> class LocalGeodesicFEStiffness : public Dune::GFE::LocalFirstOrderModel<Basis,TargetSpace> { - // Number type - typedef typename TargetSpace::ctype RT; - public: - //! Dimension of a tangent space - constexpr static int blocksize = TargetSpace::TangentVector::dimension; - - //! Dimension of the embedding space - constexpr static int embeddedBlocksize = TargetSpace::EmbeddedTangentVector::dimension; - /** \brief Assemble the local gradient and stiffness matrix at the current position */ virtual void assembleGradientAndHessian(const typename Basis::LocalView& localView, - const std::vector<TargetSpace>& localSolution, - std::vector<typename TargetSpace::TangentVector>& localGradient, + const typename Dune::GFE::Impl::LocalStiffnessTypes<TargetSpace>::Coefficients& coefficients, + typename Dune::GFE::Impl::LocalStiffnessTypes<TargetSpace>::Gradient& localGradient, typename Dune::GFE::Impl::LocalStiffnessTypes<TargetSpace>::Hessian& localHessian) const = 0; };