1#ifndef DUNE_FEM_SHAPEFUNCTIONSET_SIMPLE_HH
2#define DUNE_FEM_SHAPEFUNCTIONSET_SIMPLE_HH
8#include <dune/fem/common/coordinate.hh>
19 template<
class FunctionSpace >
20 class AbstractShapeFunction
22 typedef AbstractShapeFunction< FunctionSpace > ThisType;
32 virtual ~AbstractShapeFunction () {}
34 virtual void evaluate (
const DomainType &x, RangeType &value )
const = 0;
36 virtual void jacobian (
const DomainType &x, JacobianRangeType &jacobian )
const = 0;
38 virtual void hessian (
const DomainType &x, HessianRangeType &hessian )
const = 0;
40 const ThisType *clone ()
const = 0;
48 template<
class ShapeFunction >
49 class SimpleShapeFunctionSet
51 typedef SimpleShapeFunctionSet< ShapeFunction > ThisType;
54 typedef ShapeFunction ShapeFunctionType;
56 typedef ThisType ScalarFunctionSpaceType;
66 static const int lagrangePointId = -1;
68 template<
class Factory >
69 explicit SimpleShapeFunctionSet (
const Factory &factory );
71 SimpleShapeFunctionSet (
const ThisType &other );
73 const ThisType &operator= (
const ThisType &other );
75 ~SimpleShapeFunctionSet ();
77 int order ()
const {
return order_; }
80 std::size_t
size ()
const {
return shapeFunctions_.size(); }
82 template<
class Po
int,
class Functor >
83 void evaluateEach (
const Point &x, Functor functor )
const;
85 template<
class Po
int,
class Functor >
86 void jacobianEach (
const Point &x, Functor functor )
const;
88 template<
class Po
int,
class Functor >
89 void hessianEach (
const Point &x, Functor functor )
const;
92 std::vector< const ShapeFunctionType * > shapeFunctions_;
101 template<
class ShapeFunction >
102 template<
class Factory >
103 inline SimpleShapeFunctionSet< ShapeFunction >
104 ::SimpleShapeFunctionSet (
const Factory &factory )
106 const std::size_t numShapeFunctions = factory.numShapeFunctions();
107 shapeFunctions_.resize( numShapeFunctions );
108 for( std::size_t i = 0; i < numShapeFunctions; ++i )
109 shapeFunctions_[ i ] = factory.createShapeFunction( i );
110 order_ = factory.order();
113 template<
class ShapeFunction >
114 inline SimpleShapeFunctionSet< ShapeFunction >
115 ::SimpleShapeFunctionSet (
const ThisType &other )
120 template<
class ShapeFunction >
121 inline const typename SimpleShapeFunctionSet< ShapeFunction >::ThisType &
122 SimpleShapeFunctionSet< ShapeFunction >::operator= (
const ThisType &other )
127 for( std::size_t i = 0; i <
size(); ++i )
128 delete shapeFunctions_[ i ];
130 const std::size_t numShapeFunctions = other.size();
131 shapeFunctions_.resize( numShapeFunctions );
132 for( std::size_t i = 0; i < numShapeFunctions; ++i )
133 shapeFunctions_[ i ] = other.shapeFunctions_[ i ]->clone();
135 order_ = other.order_;
140 template<
class ShapeFunction >
141 inline SimpleShapeFunctionSet< ShapeFunction >::~SimpleShapeFunctionSet ()
143 for( std::size_t i = 0; i <
size(); ++i )
144 delete shapeFunctions_[ i ];
148 template<
class ShapeFunction >
149 template<
class Po
int,
class Functor >
150 inline void SimpleShapeFunctionSet< ShapeFunction >
151 ::evaluateEach (
const Point &x, Functor functor )
const
153 for( std::size_t i = 0; i <
size(); ++i )
156 shapeFunctions_[ i ]->evaluate( coordinate( x ), value );
162 template<
class ShapeFunction >
163 template<
class Po
int,
class Functor >
164 inline void SimpleShapeFunctionSet< ShapeFunction >
165 ::jacobianEach (
const Point &x, Functor functor )
const
167 for( std::size_t i = 0; i <
size(); ++i )
169 JacobianRangeType jacobian;
170 shapeFunctions_[ i ]->jacobian( coordinate( x ), jacobian );
171 functor( i, jacobian );
176 template<
class ShapeFunction >
177 template<
class Po
int,
class Functor >
178 inline void SimpleShapeFunctionSet< ShapeFunction >
179 ::hessianEach (
const Point &x, Functor functor )
const
181 for( std::size_t i = 0; i <
size(); ++i )
183 HessianRangeType hessian;
184 shapeFunctions_[ i ]->hessian( coordinate( x ), hessian );
185 functor( i, hessian );
Definition: explicitfieldvector.hh:75
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
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
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