dune-functions  2.5-dev
Public Member Functions | Protected Attributes | Friends | List of all members
Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize > Class Template Reference

Class storing local functions using type erasure. More...

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

Inheritance diagram for Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >:
Inheritance graph

Public Member Functions

template<class F , disableCopyMove< LocalFunction, F > = 0>
 LocalFunction (F &&f)
 Construct from function. More...
 
 LocalFunction ()=default
 
Range operator() (const Domain &x) const
 Evaluation of wrapped function. More...
 
void bind (const LocalContext &context)
 Bind function to a local context. More...
 
void unbind ()
 Unbind from local context. More...
 
const LocalContext & localContext () const
 Obtain local contex this LocalFunction is bound to. More...
 
Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept & asInterface ()
 Get mutable reference to wrapped object. More...
 
const Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept & asInterface () const
 Get reference to wrapped object. More...
 
virtual const std::type_info & target_type () const
 Get type of stored object. More...
 

Protected Attributes

PolymorphicSmallObject< Imp::TypeErasureWrapperInterface< Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept >, 56 > wrapped_
 

Friends

DerivativeInterface derivative (const LocalFunction &t)
 Get derivative of wrapped function. More...
 

Detailed Description

template<class Range, class Domain, class LocalContext, template< class > class DerivativeTraits, size_t bufferSize>
class Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >

Class storing local functions using type erasure.

Template Parameters
RangeRange type
DomainDomain type
LocalContextType of local context where this function is defined on
DerivativeTraitsTraits class to determine range of derivative.
bufferSizeSize of stack buffer for small object optimization (defaults to 56)

This models the Concept::LocalFunction<Range(Domain), LocalContext, DerivativeTraits> concept. Objects of this type are returned as local functions by the GridFunction wrapper. Notice that the DerivativeTraits type used here should normally be LocalDerivativeTraits<E,GDE> where GDE is the DerivativeTraits type of the corresponding global function. Small object optimization is used to store the given function. If its size exceed bufferSize, memory will be allocated dynamically.

Constructor & Destructor Documentation

§ LocalFunction() [1/2]

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
template<class F , disableCopyMove< LocalFunction, F > = 0>
Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::LocalFunction ( F &&  f)
inline

Construct from function.

Template Parameters
FFunction type
Parameters
fFunction of type F

Calling derivative(DifferentiableFunction) will result in an exception if the passed function does provide a free derivative() function found via ADL.

§ LocalFunction() [2/2]

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::LocalFunction ( )
default

Member Function Documentation

§ asInterface() [1/2]

Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept & Dune::Functions::TypeErasureBase< Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept , Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::template Model , 56 >::asInterface ( )
inlineinherited

Get mutable reference to wrapped object.

§ asInterface() [2/2]

const Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept & Dune::Functions::TypeErasureBase< Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept , Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::template Model , 56 >::asInterface ( ) const
inlineinherited

Get reference to wrapped object.

§ bind()

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
void Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::bind ( const LocalContext &  context)
inline

Bind function to a local context.

You must bind a LocalFunction to a local context before you can evaluate it.

§ localContext()

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
const LocalContext& Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::localContext ( ) const
inline

Obtain local contex this LocalFunction is bound to.

§ operator()()

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
Range Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::operator() ( const Domain &  x) const
inline

Evaluation of wrapped function.

§ target_type()

virtual const std::type_info& Dune::Functions::TypeErasureBase< Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept , Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::template Model , 56 >::target_type ( ) const
inlinevirtualinherited

Get type of stored object.

§ unbind()

template<class Range , class Domain , class LocalContext , template< class > class DerivativeTraits, size_t bufferSize>
void Dune::Functions::LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::unbind ( )
inline

Unbind from local context.

Member Data Documentation

§ wrapped_

PolymorphicSmallObject<Imp::TypeErasureWrapperInterface<Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept >, 56 > Dune::Functions::TypeErasureBase< Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::Concept , Imp::LocalFunctionTraits< Range(Domain), LocalContext, DerivativeTraits, bufferSize >::template Model , 56 >::wrapped_
protectedinherited

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