dune-functions 2.8.0
Loading...
Searching...
No Matches
callable.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_CALLABLE_HH
4#define DUNE_FUNCTIONS_COMMON_CALLABLE_HH
5
6#include <memory>
7#include <functional>
8
11
12
13namespace Dune {
14namespace Functions {
15
16
17
18
36template<class F>
38{
39 using Range = typename F::RangeType;
40 using Domain = typename F::DomainType;
41
42 public:
43
54
64
70 Range operator()(const Domain& x) const
71 {
72 Range y;
73 f_->evaluate(x, y);
74 return y;
75 }
76
77 private:
79};
80
81
82
104template<class F>
109
110
136template<class F>
141
142
143
144} // namespace Functions
145} // namespace Dune
146
147#endif //DUNE_FUNCTIONS_COMMON_CALLABLE_HH
CallableFunctionWrapper< F > callable(const F &f)
Create a callable object from some Dune::VirtualFunction.
Definition callable.hh:105
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Wrap a Dune::VirtualFunction into a callable object.
Definition callable.hh:38
Range operator()(const Domain &x) const
Forward operator() to F::evaluate()
Definition callable.hh:70
CallableFunctionWrapper(const F &f)
Instanciate from reference to f.
Definition callable.hh:50
CallableFunctionWrapper(const std::shared_ptr< const F > &f)
Instanciate from std::shared_ptr to f.
Definition callable.hh:61