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>
19struct HasFreeDerivative
22 auto require(F&& f) ->
decltype(
29template<
class Dummy,
class F,
30 typename std::enable_if<
31 models< HasFreeDerivative, F>() ,
int>::type = 0>
32auto derivativeIfImplemented(
const F& f) ->
decltype(
derivative(f))
39template<
class Dummy,
class F,
40 typename std::enable_if<
41 not(models< HasFreeDerivative, F>()) ,
int>::type = 0>
42Dummy derivativeIfImplemented(
const F& f)
44 DUNE_THROW(Dune::NotImplemented,
"Derivative not implemented");
49template<
class Signature,
class DerivativeInterface>
50class DifferentiableFunctionWrapperInterface
57template<
class Range,
class Domain,
class DerivativeInterface>
58class DifferentiableFunctionWrapperInterface<Range(Domain), DerivativeInterface>
61 virtual Range operator() (
const Domain& x)
const = 0;
63 virtual DerivativeInterface
derivative()
const = 0;
68template<
class Signature,
class DerivativeInterface,
class B>
69class DifferentiableFunctionWrapperImplementation
73template<
class Range,
class Domain,
class DerivativeInterface,
class B>
74class 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