dune-common
2.2.0
|
00001 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 // vi: set ts=8 sw=2 et sts=2: 00003 #ifndef DUNE_FUNCTION_HH 00004 #define DUNE_FUNCTION_HH 00005 00006 00007 #include "typetraits.hh" 00008 00009 namespace Dune { 00010 00026 template <class Domain, class Range> 00027 class Function 00028 { 00029 typedef typename ConstantVolatileTraits<typename TypeTraits< Domain >::ReferredType >::UnqualifiedType RawDomainType; 00030 typedef typename ConstantVolatileTraits<typename TypeTraits< Range >::ReferredType >::UnqualifiedType RawRangeType; 00031 00032 public: 00033 00035 typedef RawRangeType RangeType; 00036 00038 typedef RawDomainType DomainType; 00039 00041 struct Traits 00042 { 00043 typedef RawDomainType DomainType; 00044 typedef RawRangeType RangeType; 00045 }; 00046 00053 void evaluate(Domain x, Range y) const; 00054 }; // end of Function class 00055 00056 00057 00065 template <class DomainType, class RangeType> 00066 class VirtualFunction : 00067 public Function<const DomainType&, RangeType&> 00068 { 00069 public: 00070 virtual ~VirtualFunction() {} 00077 virtual void evaluate(const DomainType& x, RangeType& y) const = 0; 00078 }; // end of VirtualFunction class 00079 00082 } // end namespace 00083 00084 #endif