1#ifndef DUNE_FEM_SPACE_LAGRANGE_SHAPEFUNCTIONSET_HH 
    2#define DUNE_FEM_SPACE_LAGRANGE_SHAPEFUNCTIONSET_HH 
    8#include <dune/fem/common/forloop.hh> 
   13#include <dune/fem/space/common/functionspace.hh> 
   14#include <dune/fem/space/shapefunctionset/simple.hh> 
   16#include "genericbasefunctions.hh" 
   17#include "genericlagrangepoints.hh" 
   39    template< 
class FunctionSpace >
 
   56      virtual void evaluate ( 
const DomainType &x, RangeType &value ) 
const = 0;
 
   57      virtual void jacobian ( 
const DomainType &x, JacobianRangeType &jacobian ) 
const = 0;
 
   58      virtual void hessian ( 
const DomainType &x, HessianRangeType &hessian ) 
const = 0;
 
   60      virtual int order () 
const = 0;
 
   62      virtual const ThisType *clone () 
const = 0;
 
   78    template< 
class FunctionSpace, 
class GeometryType, 
unsigned int polOrder >
 
   88      typedef GenericLagrangeBaseFunction< FunctionSpace, GeometryType, polOrder >
 
   89        GenericBaseFunctionType;
 
   91      typedef typename BaseType::DomainType DomainType;
 
   92      typedef typename BaseType::RangeType RangeType;
 
   93      typedef typename BaseType::JacobianRangeType JacobianRangeType;
 
   94      typedef typename BaseType::HessianRangeType HessianRangeType;
 
   97      : genericShapeFunction_( genericShapeFunction )
 
  100      virtual void evaluate ( 
const DomainType &x, RangeType &value ) 
const;
 
  101      virtual void jacobian ( 
const DomainType &x, JacobianRangeType &jacobian ) 
const;
 
  102      virtual void hessian ( 
const DomainType &x, HessianRangeType &hessian ) 
const;
 
  104      virtual int order ()
 const { 
return polOrder; }
 
  109      GenericBaseFunctionType genericShapeFunction_;
 
  124    template< 
class FunctionSpace, 
int maxPolOrder >
 
  133      template< GeometryType::Id geometryId>
 
  144      std::size_t numShapeFunctions () 
const;
 
  164    template< 
class FunctionSpace, 
int maxPolOrder >
 
  166    : 
public SimpleShapeFunctionSet<
 
  167        typename LagrangeShapeFunctionFactory< FunctionSpace, maxPolOrder >::ShapeFunctionType
 
  173      typedef SimpleShapeFunctionSet< typename ShapeFunctionFactoryType::ShapeFunctionType > BaseType;
 
  187    template< 
class FunctionSpace, 
class GeometryType, 
unsigned int polOrder >
 
  189      ::evaluate ( 
const DomainType &x, RangeType &value )
 const 
  192      genericShapeFunction_.evaluate( diffVariable, x, value );
 
  196    template< 
class FunctionSpace, 
class GeometryType, 
unsigned int polOrder >
 
  197    inline void LagrangeShapeFunction< FunctionSpace, GeometryType, polOrder >
 
  198      ::jacobian ( 
const DomainType &x, JacobianRangeType &jacobian )
 const 
  203      int &i = diffVariable[ 0 ];
 
  204      for( i = 0; i < dimension; ++i )
 
  206        genericShapeFunction_.evaluate( diffVariable, x, tmp );
 
  207        jacobian[ 0 ][ i ] = tmp[ 0 ];
 
  212    template< 
class FunctionSpace, 
class GeometryType, 
unsigned int polOrder >
 
  213    inline void LagrangeShapeFunction< FunctionSpace, GeometryType, polOrder >
 
  214      ::hessian ( 
const DomainType &x, HessianRangeType &hessian )
 const 
  216      FieldVector< int, 2 > diffVariable;
 
  219      int &i = diffVariable[ 0 ];
 
  220      for( i = 0; i < dimension; ++i )
 
  224        int &j = diffVariable[ 1 ];
 
  225        for( j = 0; j < i; ++j )
 
  227          genericShapeFunction_.evaluate( diffVariable, x, tmp );
 
  228          hessian[ 0 ][ i ][ j ] = hessian[ 0 ][ j ][ i ] = tmp[ 0 ];
 
  232        genericShapeFunction_.evaluate( diffVariable, x, tmp );
 
  233        hessian[ 0 ][ i ][ i ] = tmp[ 0 ];
 
  242    template< 
class FunctionSpace, 
int maxPolOrder >
 
  243    template< GeometryType::Id geometryId>
 
  244    struct LagrangeShapeFunctionFactory< FunctionSpace, maxPolOrder >::Switch
 
  248      static const unsigned int topologyId = 
gt.id();
 
  249      typedef typename GeometryWrapper< topologyId, dimension >
 
  252      template <
int polOrd>
 
  256        typedef LagrangeShapeFunction< FunctionSpace, ImplType, polOrd >   ShapeFunctionImpl;
 
  257        typedef typename ShapeFunctionImpl::GenericBaseFunctionType GenericBaseFunctionType;
 
  259        static void apply ( 
const int order, std::size_t &
size )
 
  261          if( order == polOrd )
 
  263            size = GenericLagrangePoint< ImplType, polOrd >::numLagrangePoints;
 
  267        static void apply ( 
const std::size_t &i, 
const int order, ShapeFunctionType *&shapeFunction )
 
  269          if( order == polOrd )
 
  271            shapeFunction = 
new ShapeFunctionImpl( GenericBaseFunctionType( i ) );
 
  276      static void apply ( 
const int order, std::size_t &
size )
 
  279        Dune::Fem::ForLoop< CheckOrder, 0, maxPolOrder >::apply( order, 
size );
 
  282      static void apply ( 
const std::size_t &i, 
const int order, ShapeFunctionType *&shapeFunction )
 
  285        Dune::Fem::ForLoop< CheckOrder, 0, maxPolOrder >::apply( i, order, shapeFunction );
 
  294    template< 
class FunctionSpace, 
int maxPolOrder >
 
  295    const int LagrangeShapeFunctionFactory< FunctionSpace, maxPolOrder >::dimension;
 
  298    template< 
class FunctionSpace, 
int maxPolOrder >
 
  299    inline int LagrangeShapeFunctionFactory< FunctionSpace, maxPolOrder >
 
  306    template< 
class FunctionSpace, 
int polOrder >
 
  307    inline std::size_t LagrangeShapeFunctionFactory< FunctionSpace, polOrder >
 
  308      ::numShapeFunctions ()
 const 
  310      std::size_t numShapeFunctions( 0 );
 
  311      Dune::Impl::toGeometryTypeIdConstant<dimension>(gt_, [&](
auto geometryTypeId) {
 
  312        Switch<
decltype(geometryTypeId)::value>::apply(order_, numShapeFunctions);
 
  314      return numShapeFunctions;
 
  318    template< 
class FunctionSpace, 
int polOrder >
 
  319    inline typename LagrangeShapeFunctionFactory< FunctionSpace, polOrder >::ShapeFunctionType *
 
  320    LagrangeShapeFunctionFactory< FunctionSpace, polOrder >
 
  321      ::createShapeFunction( 
const std::size_t i )
 const 
  323      ShapeFunctionType *shapeFunction( 
nullptr );
 
  324      Dune::Impl::toGeometryTypeIdConstant<dimension>(gt_, [&](
auto geometryTypeId) {
 
  325        Switch<
decltype(geometryTypeId)::value>::apply(i, order_,shapeFunction);
 
  327      assert( shapeFunction );
 
  328      return shapeFunction;
 
  336    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 1, 1 >, 1 >;
 
  337    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 2, 1 >, 1 >;
 
  338    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 3, 1 >, 1 >;
 
  339    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 1, 1 >, 1 >;
 
  340    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 2, 1 >, 1 >;
 
  341    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 3, 1 >, 1 >;
 
  343    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 1, 1 >, 2 >;
 
  344    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 2, 1 >, 2 >;
 
  345    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 3, 1 >, 2 >;
 
  346    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 1, 1 >, 2 >;
 
  347    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 2, 1 >, 2 >;
 
  348    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 3, 1 >, 2 >;
 
  350    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 1, 1 >, 3 >;
 
  351    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 2, 1 >, 3 >;
 
  352    extern template class LagrangeShapeFunctionFactory< FunctionSpace< double, double, 3, 1 >, 3 >;
 
  353    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 1, 1 >, 3 >;
 
  354    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 2, 1 >, 3 >;
 
  355    extern template class LagrangeShapeFunctionFactory< FunctionSpace< float, float, 3, 1 >, 3 >;
 
ExplicitFieldVector< FieldMatrix< RangeFieldType, dimDomain, dimDomain >, dimRange > HessianRangeType
Intrinsic type used for the hessian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:79
 
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
 
@ dimDomain
dimension of domain vector space
Definition: functionspaceinterface.hh:46
 
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
 
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
 
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
 
A vector valued function space.
Definition: functionspace.hh:60
 
factory class
Definition: shapefunctionset.hh:126
 
abstract base class for Lagrange shape functions
Definition: shapefunctionset.hh:41
 
Lagrange shape function set.
Definition: shapefunctionset.hh:169
 
implementation of Lagrange shape function using generic Lagrange shape functions
Definition: shapefunctionset.hh:81
 
vector space out of a tensor product of fields.
Definition: fvector.hh:97
 
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
 
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
 
Implements a vector constructed from a given type representing a field and a compile-time given size.
 
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
 
Dune namespace.
Definition: alignedallocator.hh:13
 
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
 
A unique label for each type of element that can occur in a grid.