Dune Core Modules (2.8.0)

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)
 Instanciate from reference to f. More...
 
 CallableFunctionWrapper (const std::shared_ptr< const F > &f)
 Instanciate 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

Instanciate from reference to f.

The CallableFunctionWrapper will not take ownership of the provided function.

References Dune::stackobject_to_shared_ptr().

◆ CallableFunctionWrapper() [2/2]

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

Instanciate 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:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)