7#ifndef DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_HH
8#define DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_HH
12#include <dune/common/typeutilities.hh>
14#include <dune/functions/common/type_traits.hh>
15#include <dune/functions/common/defaultderivativetraits.hh>
16#include <dune/functions/common/differentiablefunction_imp.hh>
17#include <dune/functions/common/signature.hh>
18#include <dune/functions/common/typeerasure.hh>
19#include <dune/functions/common/functionconcepts.hh>
31template<
class Signature,
template<
class>
class DerivativeTraits=DefaultDerivativeTraits,
size_t bufferSize=56>
32class DifferentiableFunction
41 template<
class S,
template<
class>
class DerivativeTraits,
size_t bufferSize>
42 struct DifferentiableFunctionTraits
48 using Range =
typename SignatureTraits<Signature>::Range;
51 using Domain =
typename SignatureTraits<Signature>::Domain;
54 using DerivativeSignature =
typename SignatureTraits<Signature>::template DerivativeSignature<DerivativeTraits>;
57 using DerivativeInterface = DifferentiableFunction<DerivativeSignature, DerivativeTraits, bufferSize>;
60 using Concept = DifferentiableFunctionWrapperInterface<Signature, DerivativeInterface>;
64 using Model = DifferentiableFunctionWrapperImplementation<Signature, DerivativeInterface, B>;
84template<
class Range,
class Domain,
template<
class>
class DerivativeTraits,
size_t bufferSize>
85class DifferentiableFunction< Range(Domain), DerivativeTraits, bufferSize> :
87 typename Imp::DifferentiableFunctionTraits<Range(Domain), DerivativeTraits, bufferSize>::Concept,
88 Imp::DifferentiableFunctionTraits<Range(Domain), DerivativeTraits, bufferSize>::template Model>
90 using Traits = Imp::DifferentiableFunctionTraits<Range(Domain), DerivativeTraits, bufferSize>;
94 using DerivativeInterface =
typename Traits::DerivativeInterface;
109 template<
class F, disableCopyMove<DifferentiableFunction, F> = 0 >
111 Base(std::forward<F>(f))
113 static_assert(Dune::Functions::Concept::isFunction<F, Range(Domain)>(),
"Trying to construct a DifferentiableFunction from type that does not model the Function concept");
122 Range operator() (
const Domain& x)
const
124 return this->asInterface().operator()(x);
134 friend DerivativeInterface
derivative(
const DifferentiableFunction& t)
136 return t.asInterface().derivative();
DifferentiableFunction(F &&f)
Construct from function.
Definition: differentiablefunction.hh:110
DifferentiableFunction()=default
Default constructor.
Base class for type-erased interface wrapper.
Definition: typeerasure.hh:169
friend DerivativeInterface derivative(const DifferentiableFunction &t)
Get derivative of wrapped function.
Definition: differentiablefunction.hh:134
Definition: polynomial.hh:17