3 #ifndef DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
4 #define DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
6 #include <dune/common/exceptions.hh>
7 #include <dune/common/concept.hh>
19 struct HasFreeDerivative
22 auto require(F&& f) -> decltype(
29 template<
class Dummy,
class F,
30 typename std::enable_if<
31 models< HasFreeDerivative, F>() ,
int>::type = 0>
32 auto derivativeIfImplemented(
const F& f) -> decltype(
derivative(f))
39 template<
class Dummy,
class F,
40 typename std::enable_if<
41 not(models< HasFreeDerivative, F>()) ,
int>::type = 0>
42 Dummy derivativeIfImplemented(
const F& f)
44 DUNE_THROW(Dune::NotImplemented,
"Derivative not implemented");
49 template<
class Signature,
class DerivativeInterface>
50 class DifferentiableFunctionWrapperInterface
57 template<
class Range,
class Domain,
class DerivativeInterface>
58 class DifferentiableFunctionWrapperInterface<Range(Domain), DerivativeInterface>
61 virtual Range operator() (
const Domain& x)
const = 0;
63 virtual DerivativeInterface
derivative()
const = 0;
68 template<
class Signature,
class DerivativeInterface,
class B>
69 class DifferentiableFunctionWrapperImplementation
73 template<
class Range,
class Domain,
class DerivativeInterface,
class B>
74 class DifferentiableFunctionWrapperImplementation< Range(Domain), DerivativeInterface, B> :
80 using Wrapped =
typename B::Wrapped;
82 virtual Range operator() (
const Domain& x)
const
84 return this->get()(x);
89 return derivativeIfImplemented<DerivativeInterface, Wrapped>(this->get());
TrigonometricFunction< K, -cosFactor, sinFactor > derivative(const TrigonometricFunction< K, sinFactor, cosFactor > &f)
Obtain derivative of TrigonometricFunction function.
Definition: trigonometricfunction.hh:39
Definition: polynomial.hh:10