dune-functions 2.9.0
functionfromcallable.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_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH
4#define DUNE_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH
5
6#include <dune/common/function.hh>
7
9
10
11namespace Dune {
12namespace Functions {
13
14
15
16template<class Signature, class F,
17 class FunctionInterface = typename Dune::VirtualFunction<
18 typename SignatureTraits<Signature>::RawDomain,
19 typename SignatureTraits<Signature>::RawRange> >
21
37template<class Range, class Domain, class F, class FunctionInterface>
38class FunctionFromCallable<Range(Domain), F, FunctionInterface> :
39 public FunctionInterface
40{
41public:
42
53 f_(f)
54 {}
55
65 f_(f)
66 {}
67
73 void evaluate(const Domain& x, Range&y) const
74 {
75 y = f_(x);
76 }
77
78private:
79 F f_;
80};
81
82
83
84} // namespace Functions
85} // namespace Dune
86
87#endif //DUNE_FUNCTIONS_COMMON_FUNCTION_FROM_CALLABLE_HH
Definition: polynomial.hh:10
Definition: functionfromcallable.hh:20
FunctionFromCallable(F &&f)
Create VirtualFunction from callable object.
Definition: functionfromcallable.hh:52
void evaluate(const Domain &x, Range &y) const
Evaluate function.
Definition: functionfromcallable.hh:73
FunctionFromCallable(const F &f)
Create VirtualFunction from callable object.
Definition: functionfromcallable.hh:64