dune-fem  2.4.1-rc
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 
83  {}
84 
85  // Disallow copying of function, but allow copying of derived classes
86  Function ( const ThisType &other ) {}
87 
88  private:
89  // Disallow assignment
90  ThisType &operator= ( const ThisType & );
91 
92  public:
94  virtual ~Function ()
95  {}
96 
101  virtual void operator()(const DomainType & arg, RangeType & dest) const
102  {
103  evaluate(arg,dest);
104  }
105 
111  void evaluate ( const DomainType &x, RangeType &value ) const
112  {
113  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().evaluate( x, value ) );
114  }
115 
121  void jacobian ( const DomainType &x, JacobianRangeType &jacobian ) const
122  {
123  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().jacobian( x, jacobian ) );
124  }
125 
131  void hessian ( const DomainType &x, HessianRangeType &hessian ) const
132  {
133  CHECK_AND_CALL_INTERFACE_IMPLEMENTATION( asImp().hessian( x, hessian ) );
134  }
135 
136  private:
141  virtual void apply (const DomainType& arg, RangeType& dest) const
142  {
143  operator()(arg, dest);
144  }
145  };
146 
148 
149  } // namespace Fem
150 
151 } // namespace Dune
152 
153 #endif // #ifndef DUNE_FEM_FUNCTION_HH
FunctionSpaceImp FunctionSpaceType
type of function space this function belongs to
Definition: function.hh:56
A mapping from one vector space into another This class describes a general mapping from the domain v...
Definition: mapping.hh:46
FunctionSpaceType::DomainType DomainType
domain type
Definition: function.hh:66
void jacobian(const DomainType &x, JacobianRangeType &jacobian) const
evaluate the Jacobian of the function
Definition: function.hh:121
void hessian(const DomainType &x, HessianRangeType &hessian) const
evaluate the hessian of the function
Definition: function.hh:131
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37
FunctionImp FunctionType
type of the implementation (Barton-Nackman)
Definition: function.hh:59
virtual ~Function()
destructor
Definition: function.hh:94
FunctionSpaceType::RangeType RangeType
range type
Definition: function.hh:68
FunctionSpaceType::JacobianRangeType JacobianRangeType
jacobian type
Definition: function.hh:70
Definition: coordinate.hh:4
Mapping< DomainFieldType, RangeFieldType, DomainType, RangeType > MappingType
type of mapping base class
Definition: function.hh:76
virtual void operator()(const DomainType &arg, RangeType &dest) const
application operator call evaluate
Definition: function.hh:101
Function(const ThisType &other)
Definition: function.hh:86
Function()
default constructor
Definition: function.hh:82
FunctionSpaceType::RangeFieldType RangeFieldType
field type of range
Definition: function.hh:64
Abstract class representing a function.
Definition: function.hh:43
FunctionSpaceType::DomainFieldType DomainFieldType
field type of domain
Definition: function.hh:62
FunctionSpaceType::HessianRangeType HessianRangeType
hessian type
Definition: function.hh:72
Definition: bartonnackmaninterface.hh:15
void evaluate(const DomainType &x, RangeType &value) const
evaluate the function
Definition: function.hh:111