3#ifndef DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
4#define DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
9#include <dune/functions/common/type_traits.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)
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());
Default exception for dummy implementations.
Definition: exceptions.hh:263
Infrastructure for concepts.
A few common exception classes.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
TrigonometricFunction< K, -cosFactor, sinFactor > derivative(const TrigonometricFunction< K, sinFactor, cosFactor > &f)
Obtain derivative of TrigonometricFunction function.
Definition: trigonometricfunction.hh:39
Dune namespace.
Definition: alignedallocator.hh:13