14#include <dune/common/hybridutilities.hh>
15#include <dune/functions/common/differentiablefunctionfromcallables.hh>
29 template <
typename... Args>
32 std::tuple<Args...> args;
43template <
typename... Args>
45 return Impl::Functions<std::remove_cvref_t<Args>...>{std::forward_as_tuple(std::forward<Args>(args)...)};
49template <
class Signature,
template <
class>
class DerivativeTraits,
class... F>
50class DifferentiableFunction;
60template <
class Range,
class D,
template <
class>
class DerivativeTraits,
class F,
class... FF>
61class DifferentiableFunction<Range(D), DerivativeTraits, F, FF...>
62 :
private Dune::Functions::DifferentiableFunctionFromCallables<Range(D), DerivativeTraits, F, FF...>
64 using Base = Dune::Functions::DifferentiableFunctionFromCallables<Range(D), DerivativeTraits, F, FF...>;
67 using Domain = std::remove_cvref_t<D>;
68 static constexpr auto nDerivatives =
sizeof...(FF);
70 template <
class... FFF>
72 : Base(std::forward<FFF>(f)...) {}
75 using Derivative = DifferentiableFunction<typename Traits::template Range<1>(D), DerivativeTraits, FF...>;
77 Range
operator()(
const D& x)
const {
return Base::operator()(x); }
84 auto df = derivative(
static_cast<const Base&
>(t));
98template <
typename... F,
typename Arg>
101 using DerivTraits =
decltype(t);
102 auto la = []<
typename... FF>(FF&&... f) {
103 return Ikarus::DifferentiableFunction<typename DerivTraits::template Range<0>(
typename DerivTraits::Domain),
104 DerivTraits::template DerivativeTraits, std::remove_cvref_t<FF>...>(
105 std::forward<FF>(f)...);
107 return std::apply(la, derivativesFunctions.args);
Contains stl-like type traits.
Contains derivative traits for common vbalue and derivative relations used for makeDifferentiableFunc...
Definition: assemblermanipulatorbuildingblocks.hh:22
auto makeDifferentiableFunction(const Impl::Functions< F... > &derivativesFunctions, const Arg ¶meter)
Factory method for DifferentiableFunction It is a function taking several callables and the argument ...
Definition: differentiablefunction.hh:99
auto functions(Args &&... args)
Creates a Functions object.
Definition: differentiablefunction.hh:44
DerivativeTraitsFromCallables(const Impl::Functions< DerivativeArgs... > &derivativesFunctions, Arg &¶meterI) -> DerivativeTraitsFromCallables< Impl::Functions< DerivativeArgs... >, Arg >
std::remove_cvref_t< D > Domain
Definition: differentiablefunction.hh:67
DifferentiableFunction(FFF &&... f)
Definition: differentiablefunction.hh:71
DifferentiableFunction< typename Traits::template Range< 1 >(D), DerivativeTraits, FF... > Derivative
Definition: differentiablefunction.hh:75
DerivativeTraitsFromCallables< Impl::Functions< F, FF... >, D > Traits
Definition: differentiablefunction.hh:73
Range operator()(const D &x) const
Definition: differentiablefunction.hh:77
friend Derivative derivative(const DifferentiableFunction &t)
Get derivative of DifferentiableFunction.
Definition: differentiablefunction.hh:83