dune-fem  2.8-git
localfunctionsetadapter.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_LOCALFUNCTIONSETADAPTER_HH
2 #define DUNE_FEM_FUNCTION_LOCALFUNCTION_LOCALFUNCTIONSETADAPTER_HH
3 
4 #include <cassert>
5 #include <cstddef>
6 
8 
9 namespace Dune
10 {
11 
12  namespace Fem
13  {
14 
15  // LocalFunctionSetAdapter
16  // -----------------------
17 
25  template< class Entity, class FunctionSet >
27  {
29  typedef Entity EntityType;
32 
35 
44 
46  : functionSet_( functionSet )
47  {}
48 
49  explicit LocalFunctionSetAdapter ( const Entity &entity, const FunctionSet &functionSet = FunctionSet() )
50  : entity_( &entity ), functionSet_( functionSet )
51  {}
52 
54  int order () const { return functionSet_.order(); }
55 
57  const EntityType &entity () const
58  {
59  assert( entity_ );
60  return *entity_;
61  }
62 
64  std::size_t size () const { return functionSet().size(); }
65 
67  template< class Point, class Functor >
68  void evaluateEach ( const Point &x, Functor functor ) const
69  {
70  DomainType y = geometry().global( coordinate( x ) );
71  functionSet().evaluateEach( y, functor );
72  }
73 
75  template< class Point, class Functor >
76  void jacobianEach ( const Point &x, Functor functor ) const
77  {
78  DomainType y = geometry().global( coordinate( x ) );
79  functionSet().jacobianEach( y, functor );
80  }
81 
83  template< class Point, class Functor >
84  void hessianEach ( const Point &x, Functor functor ) const
85  {
86  DomainType y = geometry().global( coordinate( x ) );
87  functionSet().hessianEach( y, functor );
88  }
89 
90 
91  // Non-interface methods
92  // ---------------------
93 
95  const FunctionSetType functionSet () const { return functionSet_; }
96 
97  private:
98  typename EntityType::Geometry geometry () const { return entity().geometry(); }
99 
100  const EntityType *entity_ = nullptr;
101  FunctionSetType functionSet_;
102  };
103 
104  } // namespace Fem
105 
106 } // namespace Dune
107 
108 #endif // #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_LOCALFUNCTIONSETADAPTER_HH
Definition: bindguard.hh:11
static const Point & coordinate(const Point &x)
Definition: coordinate.hh:14
Definition: explicitfieldvector.hh:75
Global basis functions.
Definition: function/common/functionset.hh:26
int order() const
return order of basis functions
std::size_t size() const
return number of basis functions
void evaluateEach(const DomainType &x, Functor functor) const
void hessianEach(const DomainType &x, Functor functor) const
void jacobianEach(const DomainType &x, Functor functor) const
convert (global) function set to local function set
Definition: localfunctionsetadapter.hh:27
LocalFunctionSetAdapter(const Entity &entity, const FunctionSet &functionSet=FunctionSet())
Definition: localfunctionsetadapter.hh:49
LocalFunctionSetAdapter(const FunctionSet &functionSet=FunctionSet())
Definition: localfunctionsetadapter.hh:45
FunctionSet FunctionSetType
function set type
Definition: localfunctionsetadapter.hh:31
Entity EntityType
entity type
Definition: localfunctionsetadapter.hh:29
FunctionSpaceType::HessianRangeType HessianRangeType
hessian range type
Definition: localfunctionsetadapter.hh:43
void evaluateEach(const Point &x, Functor functor) const
Definition: localfunctionsetadapter.hh:68
const EntityType & entity() const
return entity
Definition: localfunctionsetadapter.hh:57
const FunctionSetType functionSet() const
return function set
Definition: localfunctionsetadapter.hh:95
void jacobianEach(const Point &x, Functor functor) const
Definition: localfunctionsetadapter.hh:76
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian range type
Definition: localfunctionsetadapter.hh:41
FunctionSpaceType::DomainType DomainType
domain type
Definition: localfunctionsetadapter.hh:37
int order() const
return order of basis functions
Definition: localfunctionsetadapter.hh:54
void hessianEach(const Point &x, Functor functor) const
Definition: localfunctionsetadapter.hh:84
std::size_t size() const
return number of basis functions
Definition: localfunctionsetadapter.hh:64
FunctionSet::FunctionSpaceType FunctionSpaceType
function space type
Definition: localfunctionsetadapter.hh:34
FunctionSpaceType::RangeType RangeType
range type
Definition: localfunctionsetadapter.hh:39
A vector valued function space.
Definition: functionspace.hh:60
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