Dune Core Modules (2.8.0)

functionfromcallable.hh
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
7
8#include <dune/functions/common/signature.hh>
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> >
20class FunctionFromCallable;
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
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
Virtual base class template for function classes.
Definition: function.hh:85
Simple base class templates for functions.
Dune namespace.
Definition: alignedallocator.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)