1 #ifndef DUNE_FEM_SPACE_LAGRANGE_SHAPEFUNCTIONSET_HH 2 #define DUNE_FEM_SPACE_LAGRANGE_SHAPEFUNCTIONSET_HH 7 #include <dune/common/fvector.hh> 8 #include <dune/common/nullptr.hh> 9 #include <dune/common/forloop.hh> 11 #include <dune/geometry/genericgeometry/topologytypes.hh> 12 #include <dune/geometry/type.hh> 40 template<
class FunctionSpace >
57 virtual void evaluate (
const DomainType &x, RangeType &value )
const = 0;
58 virtual void jacobian (
const DomainType &x, JacobianRangeType &
jacobian )
const = 0;
59 virtual void hessian (
const DomainType &x, HessianRangeType &
hessian )
const = 0;
61 virtual int order ()
const = 0;
63 virtual const ThisType *
clone ()
const = 0;
79 template<
class FunctionSpace,
class GeometryType,
unsigned int polOrder >
98 : genericShapeFunction_( genericShapeFunction )
101 virtual void evaluate (
const DomainType &x, RangeType &value )
const;
102 virtual void jacobian (
const DomainType &x, JacobianRangeType &
jacobian )
const;
103 virtual void hessian (
const DomainType &x, HessianRangeType &
hessian )
const;
105 virtual int order ()
const {
return polOrder; }
107 virtual const BaseType *
clone ()
const {
return new ThisType( *
this ); }
125 template<
class FunctionSpace,
int maxPolOrder >
134 template<
class Topology >
139 : topologyId_( type.id() ),
145 std::size_t numShapeFunctions ()
const;
147 ShapeFunctionType *createShapeFunction( std::size_t i )
const;
150 const unsigned int topologyId_;
165 template<
class FunctionSpace,
int polOrder >
168 typename LagrangeShapeFunctionFactory< FunctionSpace, polOrder >::ShapeFunctionType
178 : BaseType( ShapeFunctionFactoryType( type ) )
187 template<
class FunctionSpace,
class GeometryType,
unsigned int polOrder >
191 FieldVector< int, 0 > diffVariable;
192 return genericShapeFunction_.evaluate( diffVariable, x, value );
196 template<
class FunctionSpace,
class GeometryType,
unsigned int polOrder >
200 FieldVector< int, 1 > diffVariable;
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 >
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<
class Topology >
247 static const unsigned int topologyId = Topology::id;
249 ::GenericGeometryType GenericGeometryType;
251 template <
int polOrd>
260 if( order == polOrd )
268 if( order == polOrd )
270 shapeFunction =
new ShapeFunctionImpl( GenericBaseFunctionType( i ) );
275 static void apply (
const int order, std::size_t &size )
278 Dune::ForLoop< CheckOrder, 0, maxPolOrder >::apply( order, size );
281 static void apply (
const std::size_t &i,
const int order,
ShapeFunctionType *&shapeFunction )
284 Dune::ForLoop< CheckOrder, 0, maxPolOrder >::apply( i, order, shapeFunction );
293 template<
class FunctionSpace,
int polOrder >
297 template<
class FunctionSpace,
int polOrder >
305 template<
class FunctionSpace,
int polOrder >
309 std::size_t numShapeFunctions;
310 GenericGeometry::IfTopology< Switch, dimension >::apply( topologyId_, order_, numShapeFunctions );
311 return numShapeFunctions;
315 template<
class FunctionSpace,
int polOrder >
321 GenericGeometry::IfTopology< Switch, dimension >::apply( topologyId_, i, order_, shapeFunction );
322 assert( shapeFunction );
323 return shapeFunction;
356 #endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_SHAPEFUNCTIONSET_HH virtual void jacobian(const DomainType &x, JacobianRangeType &jacobian) const =0
abstract base class for Lagrange shape functions
Definition: lagrange/shapefunctionset.hh:41
virtual void evaluate(const DomainType &x, RangeType &value) const =0
Definition: genericlagrangepoints.hh:21
LagrangeShapeFunctionFactory(const Dune::GeometryType &type, const int order=maxPolOrder)
Definition: lagrange/shapefunctionset.hh:138
A vector valued function space.
Definition: functionspace.hh:16
virtual int order() const
Definition: lagrange/shapefunctionset.hh:105
virtual void hessian(const DomainType &x, HessianRangeType &hessian) const
Definition: lagrange/shapefunctionset.hh:214
virtual void evaluate(const DomainType &x, RangeType &value) const
Definition: lagrange/shapefunctionset.hh:189
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:74
virtual const ThisType * clone() const =0
FieldVector< FieldMatrix< RangeFieldType, dimDomain, dimDomain >, dimRange > HessianRangeType
Intrinsic type used for the hessian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:78
virtual void hessian(const DomainType &x, HessianRangeType &hessian) const =0
dimension of domain vector space
Definition: functionspaceinterface.hh:45
ShapeFunctionType * createShapeFunction(std::size_t i) const
Definition: lagrange/shapefunctionset.hh:318
static void apply(const int order, std::size_t &size)
Definition: lagrange/shapefunctionset.hh:258
Definition: lagrange/shapefunctionset.hh:252
dimension of range vector space
Definition: functionspaceinterface.hh:47
virtual void jacobian(const DomainType &x, JacobianRangeType &jacobian) const
Definition: lagrange/shapefunctionset.hh:198
ShapeFunctionImpl::GenericBaseFunctionType GenericBaseFunctionType
Definition: lagrange/shapefunctionset.hh:256
Definition: shapefunctionset/simple.hh:49
virtual int order() const =0
int order() const
Definition: lagrange/shapefunctionset.hh:299
LagrangeShapeFunction< FunctionSpace, GenericGeometryType, polOrd > ShapeFunctionImpl
Definition: lagrange/shapefunctionset.hh:255
factory class
Definition: lagrange/shapefunctionset.hh:126
FunctionSpaceType::HessianRangeType HessianRangeType
Definition: lagrange/shapefunctionset.hh:53
BaseType::DomainType DomainType
Definition: lagrange/shapefunctionset.hh:92
Definition: coordinate.hh:4
Definition: genericgeometry.hh:172
BaseType::RangeType RangeType
Definition: lagrange/shapefunctionset.hh:93
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:66
BaseType::JacobianRangeType JacobianRangeType
Definition: lagrange/shapefunctionset.hh:94
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition: lagrange/shapefunctionset.hh:52
LagrangeShapeFunctionInterface< FunctionSpace > ShapeFunctionType
Definition: lagrange/shapefunctionset.hh:131
static void apply(const std::size_t &i, const int order, ShapeFunctionType *&shapeFunction)
Definition: lagrange/shapefunctionset.hh:266
GenericBaseFunctionType genericShapeFunction_
Definition: lagrange/shapefunctionset.hh:110
LagrangeShapeFunction(const GenericBaseFunctionType &genericShapeFunction)
Definition: lagrange/shapefunctionset.hh:97
Lagrange shape function set.
Definition: lagrange/shapefunctionset.hh:166
virtual const BaseType * clone() const
Definition: lagrange/shapefunctionset.hh:107
GenericLagrangeBaseFunction< FunctionSpace, GeometryType, polOrder > GenericBaseFunctionType
Definition: lagrange/shapefunctionset.hh:90
implementation of Lagrange shape function using generic Lagrange shape functions
Definition: lagrange/shapefunctionset.hh:80
LagrangeShapeFunctionSet(const Dune::GeometryType &type)
Definition: lagrange/shapefunctionset.hh:177
VectorSpaceTraits< DomainField, RangeField, dimD, dimR >::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:70
BaseType::HessianRangeType HessianRangeType
Definition: lagrange/shapefunctionset.hh:95
std::size_t numShapeFunctions() const
Definition: lagrange/shapefunctionset.hh:307
FunctionSpaceType::RangeType RangeType
Definition: lagrange/shapefunctionset.hh:51
virtual ~LagrangeShapeFunctionInterface()
Definition: lagrange/shapefunctionset.hh:55
FunctionSpace FunctionSpaceType
Definition: lagrange/shapefunctionset.hh:45
FunctionSpaceType::DomainType DomainType
Definition: lagrange/shapefunctionset.hh:50