dune-fem  2.8-git
common/function.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_FUNCTION_HH
2 #define DUNE_FEM_FUNCTION_HH
3 
4 // dune-common includes
5 #include <dune/common/fvector.hh>
6 
7 // dune-fem includes
10 #include <dune/fem/version.hh>
11 
12 
13 namespace Dune
14 {
15 
16  namespace Fem
17  {
18 
42  template< class FunctionSpaceImp, class FunctionImp >
43  class Function
44  : public BartonNackmanInterface< Function< FunctionSpaceImp, FunctionImp >,
45  FunctionImp >,
46  public Mapping < typename FunctionSpaceImp :: DomainFieldType,
47  typename FunctionSpaceImp :: RangeFieldType,
48  typename FunctionSpaceImp :: DomainType,
49  typename FunctionSpaceImp :: RangeType >
50  {
53 
54  public:
56  typedef FunctionSpaceImp FunctionSpaceType;
57 
59  typedef FunctionImp FunctionType;
60 
62  typedef typename FunctionSpaceType :: DomainFieldType DomainFieldType;
64  typedef typename FunctionSpaceType :: RangeFieldType RangeFieldType;
66  typedef typename FunctionSpaceType :: DomainType DomainType;
68  typedef typename FunctionSpaceType :: RangeType RangeType;
70  typedef typename FunctionSpaceType :: JacobianRangeType JacobianRangeType;
72  typedef typename FunctionSpaceType :: HessianRangeType HessianRangeType;
73 
77 
78  protected:
79  using BaseType::asImp;
80 
82  Function () = default;
83 
84  Function ( const ThisType& ) = default;
85 
86  public:
87  ThisType& operator= ( const ThisType& ) = delete;
88 
90  virtual ~Function ()
91  {}
92 
97  virtual void operator()(const DomainType & arg, RangeType & dest) const
98  {
99  evaluate(arg,dest);
100  }
101 
107  void evaluate ( const DomainType &x, RangeType &value ) const
108  {
109  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().evaluate( x, value ) );
110  }
111 
117  void jacobian ( const DomainType &x, JacobianRangeType &jacobian ) const
118  {
119  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().jacobian( x, jacobian ) );
120  }
121 
127  void hessian ( const DomainType &x, HessianRangeType &hessian ) const
128  {
129  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().hessian( x, hessian ) );
130  }
131 
132  private:
137  virtual void apply (const DomainType& arg, RangeType& dest) const
138  {
139  operator()(arg, dest);
140  }
141  };
142 
144 
145  } // namespace Fem
146 
147 } // namespace Dune
148 
149 #endif // #ifndef DUNE_FEM_FUNCTION_HH
Definition: bindguard.hh:11
Abstract class representing a function.
Definition: common/function.hh:50
FunctionSpaceType ::DomainFieldType DomainFieldType
field type of domain
Definition: common/function.hh:62
FunctionSpaceImp FunctionSpaceType
type of function space this function belongs to
Definition: common/function.hh:56
FunctionSpaceType ::RangeType RangeType
range type
Definition: common/function.hh:68
Mapping< DomainFieldType, RangeFieldType, DomainType, RangeType > MappingType
type of mapping base class
Definition: common/function.hh:76
virtual ~Function()
destructor
Definition: common/function.hh:90
FunctionSpaceType ::RangeFieldType RangeFieldType
field type of range
Definition: common/function.hh:64
virtual void operator()(const DomainType &arg, RangeType &dest) const
application operator call evaluate
Definition: common/function.hh:97
static const Implementation & asImp(const ThisType &other)
Definition: bartonnackmaninterface.hh:27
void evaluate(const DomainType &x, RangeType &value) const
evaluate the function
Definition: common/function.hh:107
FunctionImp FunctionType
type of the implementation (Barton-Nackman)
Definition: common/function.hh:59
Function(const ThisType &)=default
void jacobian(const DomainType &x, JacobianRangeType &jacobian) const
evaluate the Jacobian of the function
Definition: common/function.hh:117
FunctionSpaceType ::HessianRangeType HessianRangeType
hessian type
Definition: common/function.hh:72
FunctionSpaceType ::JacobianRangeType JacobianRangeType
jacobian type
Definition: common/function.hh:70
void hessian(const DomainType &x, HessianRangeType &hessian) const
evaluate the hessian of the function
Definition: common/function.hh:127
Function()=default
default constructor
ThisType & operator=(const ThisType &)=delete
FunctionSpaceType ::DomainType DomainType
domain type
Definition: common/function.hh:66
Definition: bartonnackmaninterface.hh:17
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
A mapping from one vector space into another This class describes a general mapping from the domain v...
Definition: mapping.hh:47