dune-common  2.3.0
function.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_FUNCTION_HH
4 #define DUNE_FUNCTION_HH
5 
6 
7 #include "typetraits.hh"
8 
9 namespace Dune {
10 
26  template <class Domain, class Range>
27  class Function
28  {
29  typedef typename ConstantVolatileTraits<typename TypeTraits< Domain >::ReferredType >::UnqualifiedType RawDomainType;
30  typedef typename ConstantVolatileTraits<typename TypeTraits< Range >::ReferredType >::UnqualifiedType RawRangeType;
31 
32  public:
33 
35  typedef RawRangeType RangeType;
36 
38  typedef RawDomainType DomainType;
39 
41  struct Traits
42  {
43  typedef RawDomainType DomainType;
44  typedef RawRangeType RangeType;
45  };
46 
53  void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const;
54  }; // end of Function class
55 
56 
57 
65  template <class DomainType, class RangeType>
67  public Function<const DomainType&, RangeType&>
68  {
69  public:
71 
72  virtual ~VirtualFunction() {}
79  virtual void evaluate(const typename Traits::DomainType& x, typename Traits::RangeType& y) const = 0;
80  }; // end of VirtualFunction class
81 
84 } // end namespace
85 
86 #endif