dune-functions 2.9.0
Public Member Functions | List of all members
Dune::Functions::CallableFunctionWrapper< F > Class Template Reference

Wrap a Dune::VirtualFunction into a callable object. More...

#include <dune/functions/common/callable.hh>

Public Member Functions

 CallableFunctionWrapper (const F &f)
 Instantiate from reference to f. More...
 
 CallableFunctionWrapper (const std::shared_ptr< const F > &f)
 Instantiate from std::shared_ptr to f. More...
 
Range operator() (const Domain &x) const
 Forward operator() to F::evaluate() More...
 

Detailed Description

template<class F>
class Dune::Functions::CallableFunctionWrapper< F >

Wrap a Dune::VirtualFunction into a callable object.

Template Parameters
FSome function deriving from Dune::VirtualFunction

This class provides an operator() that forwards to the evaluate method. In order to allow this F::RangeType must be default constructible. This class is copyable and ownership policy of the wrapped function (see constructors) will be the same for all copies.

This models the Concept::DifferentiableFunction<Range(Domain), DerivativeTraits> concept.

Using this wrapper you can e.g. pass a Dune::VirtualFunction<D,R> to the standard wrapper std::function<R(D)>.

Constructor & Destructor Documentation

◆ CallableFunctionWrapper() [1/2]

template<class F >
Dune::Functions::CallableFunctionWrapper< F >::CallableFunctionWrapper ( const F &  f)
inline

Instantiate from reference to f.

The CallableFunctionWrapper will not take ownership of the provided function.

◆ CallableFunctionWrapper() [2/2]

template<class F >
Dune::Functions::CallableFunctionWrapper< F >::CallableFunctionWrapper ( const std::shared_ptr< const F > &  f)
inline

Instantiate from std::shared_ptr to f.

The CallableFunctionWrapper will share ownership with the provided function.

Member Function Documentation

◆ operator()()

template<class F >
Range Dune::Functions::CallableFunctionWrapper< F >::operator() ( const Domain &  x) const
inline

Forward operator() to F::evaluate()

This uses the default constructor of F::RangeType


The documentation for this class was generated from the following file: