7#ifndef DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_HH
8#define DUNE_FUNCTIONS_COMMON_DIFFERENTIABLE_FUNCTION_IMP_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)
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());
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:43
Dune namespace.
Definition: alignedallocator.hh:13
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22