diff --git a/dune/gfe/functions/localgeodesicfefunction.hh b/dune/gfe/functions/localgeodesicfefunction.hh index e8b29687e7c1df8d43b5c270d32811d335a7df6b..9619f88c54a18da7cf44b95d0ebba17ffeb78f53 100644 --- a/dune/gfe/functions/localgeodesicfefunction.hh +++ b/dune/gfe/functions/localgeodesicfefunction.hh @@ -36,6 +36,8 @@ namespace Dune::GFE using TargetSpace = TS; private: + using LocalCoordinate = FieldVector<ctype,dim>; + typedef typename TargetSpace::ctype RT; typedef typename TargetSpace::EmbeddedTangentVector EmbeddedTangentVector; @@ -97,39 +99,39 @@ namespace Dune::GFE } /** \brief Evaluate the function */ - TargetSpace evaluate(const Dune::FieldVector<ctype, dim>& local) const; + TargetSpace evaluate(const LocalCoordinate& local) const; /** \brief Evaluate the derivative of the function */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const; + DerivativeType evaluateDerivative(const LocalCoordinate& local) const; /** \brief Evaluate the derivative of the function, if you happen to know the function value (much faster!) \param local Local coordinates in the reference element where to evaluate the derivative \param q Value of the local gfe function at 'local'. If you provide something wrong here the result will be wrong, too! */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, + DerivativeType evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const; /** \brief Evaluate the value and the derivative of the interpolation function */ - std::pair<TargetSpace,DerivativeType> evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const; + std::pair<TargetSpace,DerivativeType> evaluateValueAndDerivative(const LocalCoordinate& local) const; /** \brief Evaluate the derivative of the function value with respect to a coefficient */ - void evaluateDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<RT,embeddedDim,embeddedDim>& derivative) const; /** \brief Evaluate the derivative of the function value with respect to a coefficient */ - void evaluateFDDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateFDDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<RT,embeddedDim,embeddedDim>& derivative) const; /** \brief Evaluate the derivative of the gradient of the function with respect to a coefficient */ - void evaluateDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& result) const; /** \brief Evaluate the derivative of the gradient of the function with respect to a coefficient */ - void evaluateFDDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateFDDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& result) const; @@ -205,7 +207,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> TargetSpace LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluate(const Dune::FieldVector<ctype, dim>& local) const + evaluate(const LocalCoordinate& local) const { // Evaluate the weighting factors---these are the Lagrangian shape function values at 'local' std::vector<Dune::FieldVector<ctype,1> > w; @@ -235,7 +237,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> typename LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>::DerivativeType LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const + evaluateDerivative(const LocalCoordinate& local) const { // the function value at the point where we are evaluating the derivative TargetSpace q = evaluate(local); @@ -247,7 +249,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> typename LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>::DerivativeType LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, const TargetSpace& q) const + evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const { Dune::FieldMatrix<RT, embeddedDim, dim> result; @@ -316,7 +318,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> std::pair<TargetSpace,typename LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>::DerivativeType> LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const + evaluateValueAndDerivative(const LocalCoordinate& local) const { std::pair<TargetSpace,DerivativeType> result; result.first = evaluate(local); @@ -326,7 +328,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> void LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + evaluateDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<RT,embeddedDim,embeddedDim>& result) const { @@ -377,7 +379,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> void LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateFDDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + evaluateFDDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<RT,embeddedDim,embeddedDim>& result) const { @@ -425,7 +427,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> void LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + evaluateDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& result) const { @@ -522,7 +524,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace> void LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement,TargetSpace>:: - evaluateFDDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + evaluateFDDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& result) const { @@ -583,6 +585,8 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class field_type> class LocalGeodesicFEFunction<dim,ctype,LocalFiniteElement, Dune::GFE::ProductManifold<RealTuple<field_type,3>, Rotation<field_type,3> > > { + using LocalCoordinate = FieldVector<ctype,dim>; + using TargetSpace = Dune::GFE::ProductManifold<RealTuple<field_type,3>, Rotation<field_type,3> >; typedef typename TargetSpace::EmbeddedTangentVector EmbeddedTangentVector; @@ -639,7 +643,7 @@ namespace Dune::GFE } /** \brief Evaluate the function */ - TargetSpace evaluate(const Dune::FieldVector<ctype, dim>& local) const + TargetSpace evaluate(const LocalCoordinate& local) const { using namespace Dune::Indices; @@ -658,7 +662,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the function */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const + DerivativeType evaluateDerivative(const LocalCoordinate& local) const { DerivativeType result(0); @@ -683,7 +687,7 @@ namespace Dune::GFE \param local Local coordinates in the reference element where to evaluate the derivative \param q Value of the local gfe function at 'local'. If you provide something wrong here the result will be wrong, too! */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, + DerivativeType evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const { using namespace Dune::Indices; @@ -709,7 +713,7 @@ namespace Dune::GFE /** \brief Evaluate the value and the derivative of the interpolation function */ - std::pair<TargetSpace,DerivativeType> evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const + std::pair<TargetSpace,DerivativeType> evaluateValueAndDerivative(const LocalCoordinate& local) const { std::pair<TargetSpace,DerivativeType> result; result.first = evaluate(local); @@ -718,7 +722,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the function value with respect to a coefficient */ - void evaluateDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<field_type,embeddedDim,embeddedDim>& derivative) const { @@ -739,7 +743,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the function value with respect to a coefficient */ - void evaluateFDDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateFDDerivativeOfValueWRTCoefficient(const LocalCoordinate& local, int coefficient, Dune::FieldMatrix<field_type,embeddedDim,embeddedDim>& derivative) const { @@ -760,7 +764,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the gradient of the function with respect to a coefficient */ - void evaluateDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& derivative) const { @@ -782,7 +786,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the gradient of the function with respect to a coefficient */ - void evaluateFDDerivativeOfGradientWRTCoefficient(const Dune::FieldVector<ctype, dim>& local, + void evaluateFDDerivativeOfGradientWRTCoefficient(const LocalCoordinate& local, int coefficient, DerivativeOfGradientWRTCoefficientType& derivative) const { diff --git a/dune/gfe/functions/localprojectedfefunction.hh b/dune/gfe/functions/localprojectedfefunction.hh index 518a5cf70e1d69f73d865ee57bfa8b2ceaae3298..0dbe01fe5f0600ac39ea4add0e8ddd93d9a73788 100644 --- a/dune/gfe/functions/localprojectedfefunction.hh +++ b/dune/gfe/functions/localprojectedfefunction.hh @@ -30,6 +30,8 @@ namespace Dune::GFE public: using TargetSpace=TS; private: + using LocalCoordinate = FieldVector<ctype,dim>; + typedef typename TargetSpace::ctype RT; typedef typename TargetSpace::EmbeddedTangentVector EmbeddedTangentVector; @@ -87,10 +89,10 @@ namespace Dune::GFE } /** \brief Evaluate the function */ - auto evaluate(const Dune::FieldVector<ctype, dim>& local) const; + auto evaluate(const LocalCoordinate& local) const; /** \brief Evaluate the derivative of the function */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const; + DerivativeType evaluateDerivative(const LocalCoordinate& local) const; /** \brief Evaluate the derivative of the function, if you happen to know the function value (much faster!) * \param local Local coordinates in the reference element where to evaluate the derivative @@ -99,7 +101,7 @@ namespace Dune::GFE * \note This method is only usable in the conforming setting, because it requires the caller * to hand over the interpolation value as a TargetSpace object. */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, + DerivativeType evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const; /** \brief Evaluate the value and the derivative of the interpolation function @@ -108,7 +110,7 @@ namespace Dune::GFE * If the interpolation is conforming then the first member of the pair will be a TargetSpace. * Otherwise it will be a RealTuple. */ - auto evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const; + auto evaluateValueAndDerivative(const LocalCoordinate& local) const; /** \brief Get the i'th base coefficient. */ const TargetSpace& coefficient(int i) const @@ -129,7 +131,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace, bool conforming> auto LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>:: - evaluate(const Dune::FieldVector<ctype, dim>& local) const + evaluate(const LocalCoordinate& local) const { // Evaluate the weighting factors---these are the Lagrangian shape function values at 'local' std::vector<Dune::FieldVector<ctype,1> > w; @@ -149,7 +151,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace,bool conforming> typename LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>::DerivativeType LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>:: - evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const + evaluateDerivative(const LocalCoordinate& local) const { if constexpr(conforming) { @@ -176,7 +178,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace,bool conforming> typename LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>::DerivativeType LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>:: - evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, const TargetSpace& q) const + evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const { // Evaluate the weighting factors---these are the Lagrangian shape function values at 'local' std::vector<Dune::FieldVector<ctype,1> > w; @@ -203,7 +205,7 @@ namespace Dune::GFE template <int dim, class ctype, class LocalFiniteElement, class TargetSpace,bool conforming> auto LocalProjectedFEFunction<dim,ctype,LocalFiniteElement,TargetSpace,conforming>:: - evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const + evaluateValueAndDerivative(const LocalCoordinate& local) const { // Construct the type of the result -- it depends on whether the interpolation // is conforming or not. @@ -261,6 +263,8 @@ namespace Dune::GFE public: typedef Rotation<field_type,3> TargetSpace; private: + using LocalCoordinate = FieldVector<ctype,dim>; + typedef typename TargetSpace::ctype RT; typedef typename TargetSpace::EmbeddedTangentVector EmbeddedTangentVector; @@ -382,7 +386,7 @@ namespace Dune::GFE } /** \brief Evaluate the function */ - TargetSpace evaluate(const Dune::FieldVector<ctype, dim>& local) const + TargetSpace evaluate(const LocalCoordinate& local) const { Rotation<field_type,3> result; @@ -406,7 +410,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the function */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const + DerivativeType evaluateDerivative(const LocalCoordinate& local) const { // the function value at the point where we are evaluating the derivative TargetSpace q = evaluate(local); @@ -419,7 +423,7 @@ namespace Dune::GFE * \param local Local coordinates in the reference element where to evaluate the derivative * \param q Value of the local function at 'local'. If you provide something wrong here the result will be wrong, too! */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, + DerivativeType evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const { // Evaluate the weighting factors---these are the Lagrangian shape function values at 'local' @@ -479,7 +483,7 @@ namespace Dune::GFE * If the interpolation is conforming then the first member of the pair will be a TargetSpace. * Otherwise it will be a RealTuple. */ - auto evaluateValueAndDerivative(const Dune::FieldVector<ctype, dim>& local) const + auto evaluateValueAndDerivative(const LocalCoordinate& local) const { // Construct the type of the result -- it depends on whether the interpolation // is conforming or not. @@ -539,6 +543,8 @@ namespace Dune::GFE public: using TargetSpace = ProductManifold<RealTuple<field_type,3>,Rotation<field_type,3> >; private: + using LocalCoordinate = FieldVector<ctype,dim>; + typedef typename TargetSpace::ctype RT; typedef typename TargetSpace::EmbeddedTangentVector EmbeddedTangentVector; @@ -592,7 +598,7 @@ namespace Dune::GFE } /** \brief Evaluate the function */ - TargetSpace evaluate(const Dune::FieldVector<ctype, dim>& local) const + TargetSpace evaluate(const LocalCoordinate& local) const { using namespace Dune::Indices; @@ -612,7 +618,7 @@ namespace Dune::GFE } /** \brief Evaluate the derivative of the function */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local) const + DerivativeType evaluateDerivative(const LocalCoordinate& local) const { // the function value at the point where we are evaluating the derivative TargetSpace q = evaluate(local); @@ -625,7 +631,7 @@ namespace Dune::GFE * \param local Local coordinates in the reference element where to evaluate the derivative * \param q Value of the local function at 'local'. If you provide something wrong here the result will be wrong, too! */ - DerivativeType evaluateDerivative(const Dune::FieldVector<ctype, dim>& local, + DerivativeType evaluateDerivative(const LocalCoordinate& local, const TargetSpace& q) const { using namespace Dune::Indices;