3#ifndef DUNE_FUNCTIONS_COMMON_LOCAL_FUNCTION_HH
4#define DUNE_FUNCTIONS_COMMON_LOCAL_FUNCTION_HH
8#include <dune/common/typeutilities.hh>
28template<
class Signature,
class LocalContext,
template<
class>
class DerivativeTraits=DefaultDerivativeTraits,
size_t bufferSize=56>
38 template<
class S,
class L,
template<
class>
class DerivativeTraits,
size_t bufferSize>
39 struct LocalFunctionTraits :
40 DifferentiableFunctionTraits<S, DerivativeTraits, bufferSize>
43 using Base=DifferentiableFunctionTraits<S, DerivativeTraits, bufferSize>;
47 using LocalContext = L;
50 using DerivativeSignature =
typename Base::DerivativeSignature;
56 using Concept = LocalFunctionWrapperInterface<S, DerivativeInterface, L>;
60 using Model = LocalFunctionWrapperImplementation<S, DerivativeInterface, L, B>;
86template<
class Range,
class Domain,
class LocalContext,
template<
class>
class DerivativeTraits,
size_t bufferSize>
87class LocalFunction< Range(Domain), LocalContext, DerivativeTraits, bufferSize> :
89 typename Imp::LocalFunctionTraits<Range(Domain), LocalContext, DerivativeTraits, bufferSize>::Concept,
90 Imp::LocalFunctionTraits<Range(Domain), LocalContext, DerivativeTraits, bufferSize>::template Model>
92 using Traits = Imp::LocalFunctionTraits<Range(Domain), LocalContext, DerivativeTraits, bufferSize>;
111 template<
class F, disableCopyMove<LocalFunction, F> = 0 >
113 Base(std::forward<F>(f))
115 static_assert(Dune::Functions::Concept::isLocalFunction<F, Range(Domain), LocalContext>(),
"Trying to construct a LocalFunction from type that does not model the LocalFunction concept");
123 Range operator() (
const Domain& x)
const
125 return this->asInterface().operator()(x);
137 return t.asInterface().derivative();
146 void bind(
const LocalContext& context)
148 this->asInterface().bind(context);
156 this->asInterface().unbind();
163 return this->asInterface().bound();
171 return this->asInterface().localContext();
friend DerivativeInterface derivative(const LocalFunction &t)
Get derivative of wrapped function.
Definition: localfunction.hh:135
Definition: polynomial.hh:10
Definition: localfunction.hh:30
const LocalContext & localContext() const
Obtain local context this LocalFunction is bound to.
Definition: localfunction.hh:169
LocalFunction(F &&f)
Construct from function.
Definition: localfunction.hh:112
void unbind()
Unbind from local context.
Definition: localfunction.hh:154
bool bound() const
Return if the local function is bound to a grid element.
Definition: localfunction.hh:161
void bind(const LocalContext &context)
Bind function to a local context.
Definition: localfunction.hh:146
Base class for type-erased interface wrapper.
Definition: typeerasure.hh:165