7#ifndef DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
8#define DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
10#include <dune/common/exceptions.hh>
11#include <dune/common/concept.hh>
13#include <dune/functions/common/type_traits.hh>
23struct HasFreeDerivative
26 auto require(F&& f) ->
decltype(
33template<
class Dummy,
class F,
35 models< HasFreeDerivative, F>() ,
int> = 0>
36auto derivativeIfImplemented(
const F& f) ->
decltype(
derivative(f))
43template<
class Dummy,
class F,
45 not(models< HasFreeDerivative, F>()) ,
int> = 0>
46Dummy derivativeIfImplemented(
const F& f)
48 DUNE_THROW(Dune::NotImplemented,
"Derivative not implemented");
53template<
class Signature,
class DerivativeInterface>
54class DifferentiableFunctionWrapperInterface
61template<
class Range,
class Domain,
class DerivativeInterface>
62class DifferentiableFunctionWrapperInterface<Range(Domain), DerivativeInterface>
65 virtual Range operator() (
const Domain& x)
const = 0;
67 virtual DerivativeInterface
derivative()
const = 0;
72template<
class Signature,
class DerivativeInterface,
class B>
73class DifferentiableFunctionWrapperImplementation
77template<
class Range,
class Domain,
class DerivativeInterface,
class B>
78class DifferentiableFunctionWrapperImplementation< Range(Domain), DerivativeInterface, B> :
84 using Wrapped =
typename B::Wrapped;
86 virtual Range operator() (
const Domain& x)
const
88 return this->get()(x);
93 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:43
Definition: monomialset.hh:19