3#ifndef DUNE_FUNCTIONS_COMMON_FUNCTIONCONCEPT_HH
4#define DUNE_FUNCTIONS_COMMON_FUNCTIONCONCEPT_HH
6#include <dune/common/typelist.hh>
7#include <dune/common/concept.hh>
17using namespace Dune::Concept;
31template<
class... Args>
36 f(std::declval<Args>()...)
46template<
class F,
class... Args>
56template<
class F,
class... Args>
65template<
class Signature>
76template<
class Range,
class Domain>
77struct Function<Range(Domain)> : Refines<Callable<Domain> >
82 requireConvertible<Range>(f(std::declval<Domain>()))
87template<
class F,
class Signature>
89{
return models<Concept::Function<Signature>, F>(); }
92template<
class F,
class Signature,
template<
class>
class DerivativeTraits>
94{
return models<Concept::Function<Signature>, F>(); }
113template<
class Range,
class Domain,
template<
class>
class DerivativeTraits>
114struct DifferentiableFunction<Range(Domain), DerivativeTraits> : Refines<Dune::Functions::Concept::Function<Range(Domain)> >
121 requireConcept<Function<DerivativeSignature>>(
derivative(f))
128{
return models<Concept::DifferentiableFunction<Signature, DerivativeTraits>, F>(); }
131template<
class F,
class Signature,
template<
class>
class DerivativeTraits>
133{
return models<Concept::DifferentiableFunction<Signature, DerivativeTraits>, F>(); }
138template<
class Signature,
class LocalContext>
150template<
class Range,
class Domain,
class LocalContext>
152 Refines<Dune::Functions::Concept::Function<Range(Domain)> >
156 f.bind(std::declval<LocalContext>()),
158 requireConvertible<bool>(f.bound()),
160 requireConvertible<LocalContext>(f.localContext())
165template<
class F,
class Signature,
class LocalContext>
167{
return models<Concept::LocalFunction<Signature, LocalContext>, F>(); }
186template<
class Range,
class Domain,
class LocalContext,
template<
class>
class DerivativeTraits>
189 Dune::Functions::Concept::DifferentiableFunction<Range(Domain), DerivativeTraits>,
190 Dune::Functions::Concept::LocalFunction<Range(Domain),LocalContext>
195 f.bind(std::declval<LocalContext>()),
198 requireConvertible<LocalContext>(f.localContext())
203template<
class F,
class Signature,
class LocalContext,
template<
class>
class DerivativeTraits =
DefaultDerivativeTraits>
205{
return models<Concept::DifferentiableLocalFunction<Signature, LocalContext, DerivativeTraits>, F>(); }
223 requireType<typename E::Element>(),
224 requireType<typename E::LocalCoordinate>(),
225 requireType<typename E::GlobalCoordinate>()
232{
return models<Concept::EntitySet, E>(); }
237template<
class Signature,
class EntitySet>
249template<
class Range,
class Domain,
class EntitySet>
251 Refines<Dune::Functions::Concept::Function<Range(Domain)> >
260 requireConcept<LocalFunction<LocalSignature, LocalContext>>(localFunction(f)),
261 requireConcept<Concept::EntitySet, EntitySet>(),
262 requireConvertible<EntitySet>(f.entitySet()),
263 requireConvertible<typename EntitySet::GlobalCoordinate, Domain>()
268template<
class F,
class Signature,
class EntitySet>
270{
return models<Concept::GridFunction<Signature, EntitySet>, F>(); }
289template<
class Range,
class Domain,
class EntitySet,
template<
class>
class DerivativeTraits>
292 Dune::Functions::Concept::DifferentiableFunction<Range(Domain), DerivativeTraits>,
293 Dune::Functions::Concept::GridFunction<Range(Domain),EntitySet>
304 requireConcept<DifferentiableLocalFunction<LocalSignature, LocalContext, LocalDerivativeTraits>>(localFunction(f))
309template<
class F,
class Signature,
class EntitySet,
template<
class>
class DerivativeTraits =
DefaultDerivativeTraits>
311{
return models<Concept::DifferentiableGridFunction<Signature, EntitySet, DerivativeTraits>, F>(); }
316template<
class Signature,
class Gr
idView>
331template<
class Range,
class Domain,
class Gr
idView>
333 Refines<Dune::Functions::Concept::GridFunction<Range(Domain), GridViewEntitySet<GridView,0>>>
342template<
class F,
class Signature,
class Gr
idView>
344{
return models<Concept::GridViewFunction<Signature, GridView>, F>(); }
364template<
class Range,
class Domain,
class Gr
idView,
template<
class>
class DerivativeTraits>
366 Refines<Dune::Functions::Concept::DifferentiableGridFunction<Range(Domain), GridViewEntitySet<GridView,0>, DerivativeTraits>>
375template<
class F,
class Signature,
class Gr
idView,
template<
class>
class DerivativeTraits =
DefaultDerivativeTraits>
377{
return models<Concept::DifferentiableGridViewFunction<Signature, GridView, DerivativeTraits>, F>(); }
static constexpr bool isGridFunction()
Check if F models the GridFunction concept with given signature and entity set.
Definition: functionconcepts.hh:269
static constexpr bool isDifferentiableLocalFunction()
Check if F models the DifferentiableLocalFunction concept with given signature and local context.
Definition: functionconcepts.hh:204
static constexpr bool isFunction()
Check if F models the Function concept with given signature.
Definition: functionconcepts.hh:88
static constexpr bool isDifferentiableGridViewFunction()
Check if F models the DifferentiableGridViewFunction concept with given signature.
Definition: functionconcepts.hh:376
static constexpr bool isDifferentiableFunction()
Check if F models the DifferentiableFunction concept with given signature.
Definition: functionconcepts.hh:127
static constexpr bool isGridViewFunction()
Check if F models the GridViewFunction concept with given signature.
Definition: functionconcepts.hh:343
static constexpr bool isEntitySet()
Check if F models the GridFunction concept with given signature and entity set.
Definition: functionconcepts.hh:231
static constexpr bool isDifferentiableGridFunction()
Check if F models the DifferentiableGridFunction concept with given signature and entity set.
Definition: functionconcepts.hh:310
static constexpr bool isLocalFunction()
Check if F models the LocalFunction concept with given signature and local context.
Definition: functionconcepts.hh:166
TrigonometricFunction< K, -cosFactor, sinFactor > derivative(const TrigonometricFunction< K, sinFactor, cosFactor > &f)
Obtain derivative of TrigonometricFunction function.
Definition: trigonometricfunction.hh:39
static constexpr auto isCallable()
Check if f is callable with given argument list.
Definition: functionconcepts.hh:47
Definition: polynomial.hh:10
Default implementation for derivative traits.
Definition: defaultderivativetraits.hh:37
Concept objects that can be called with given argument list.
Definition: functionconcepts.hh:33
auto require(F &&f) -> decltype(f(std::declval< Args >()...))
Definition: functionconcepts.hh:66
auto require(F &&f) -> decltype(requireConvertible< Range >(f(std::declval< Domain >())))
Definition: functionconcepts.hh:100
typename SignatureTraits< Range(Domain)>::template DerivativeSignature< DerivativeTraits > DerivativeSignature
Definition: functionconcepts.hh:116
auto require(F &&f) -> decltype(derivative(f), requireConcept< Function< DerivativeSignature > >(derivative(f)))
Definition: functionconcepts.hh:139
auto require(F &&f) -> decltype(f.bind(std::declval< LocalContext >()), f.unbind(), requireConvertible< bool >(f.bound()), f.localContext(), requireConvertible< LocalContext >(f.localContext()))
Definition: functionconcepts.hh:172
auto require(F &&f) -> decltype(f.bind(std::declval< LocalContext >()), f.unbind(), f.localContext(), requireConvertible< LocalContext >(f.localContext()))
Concept for an entity set for a Concept::GridFunction<Range(Domain), EntitySet, DerivativeTraits>
Definition: functionconcepts.hh:220
auto require(E &&f) -> decltype(requireType< typename E::Element >(), requireType< typename E::LocalCoordinate >(), requireType< typename E::GlobalCoordinate >())
Definition: functionconcepts.hh:238
typename EntitySet::Element LocalContext
Definition: functionconcepts.hh:254
Range(typename EntitySet::LocalCoordinate) LocalSignature
Definition: functionconcepts.hh:253
auto require(F &&f) -> decltype(localFunction(f), f.entitySet(), requireConcept< LocalFunction< LocalSignature, LocalContext > >(localFunction(f)), requireConcept< Concept::EntitySet, EntitySet >(), requireConvertible< EntitySet >(f.entitySet()), requireConvertible< typename EntitySet::GlobalCoordinate, Domain >())
Definition: functionconcepts.hh:275
typename Dune::Functions::LocalDerivativeTraits< EntitySet, DerivativeTraits >::template Traits< R > LocalDerivativeTraits
Definition: functionconcepts.hh:300
auto require(F &&f) -> decltype(requireConcept< DifferentiableLocalFunction< LocalSignature, LocalContext, LocalDerivativeTraits > >(localFunction(f)))
Range(typename EntitySet::LocalCoordinate) LocalSignature
Definition: functionconcepts.hh:296
typename EntitySet::Element LocalContext
Definition: functionconcepts.hh:297
Definition: functionconcepts.hh:317
auto require(F &&f) -> decltype(0)
Definition: functionconcepts.hh:349
auto require(F &&f) -> decltype(0)
Helper class to deduce the signature of a callable.
Definition: signature.hh:56
Definition: signature.hh:102
Derivative traits for local functions.
Definition: localderivativetraits.hh:28