AMDiS  0.1
The Adaptive Multi-Dimensional Simulation Toolbox
Derivative.hpp
1 #pragma once
2 
3 #include <type_traits>
4 
5 #include <amdis/common/Concepts.hpp>
6 #include <amdis/common/DerivativeTraits.hpp>
7 #include <amdis/common/Index.hpp>
8 
9 namespace AMDiS
10 {
12  template <class LocalFunction, class Type,
13  REQUIRES(std::is_convertible_v<tag::derivative_type, Type>)>
14  auto derivativeOf(LocalFunction const& lf, Type const& type)
15  -> decltype(lf.makeDerivative(type))
16  {
17  return lf.makeDerivative(type);
18  }
19 
20  namespace Concepts
21  {
26  namespace Definition
27  {
29  {
30  template <class F, class T>
31  auto require(F&& f, T&& t) -> decltype( derivativeOf(f,t) );
32  };
33 
35  {
36  template <class F, class T>
37  auto require(F&& f, T&& t) -> decltype( derivativeOf(localFunction(f),t) );
38  };
39 
40  struct HasPartial
41  {
42  template <class F, class I>
43  auto require(F&& f, I&& i) -> decltype( partial(f, i) );
44  };
45 
46  } // end namespace Definition
47 
48 
50  template <class GF, class Type>
51  constexpr bool HasDerivative = models<Definition::HasDerivative(GF,Type)>;
52 
53  template <class GF, class Type>
54  using HasDerivative_t = models_t<Definition::HasDerivative(GF,Type)>;
55 
56 
58  template <class GF, class Type>
59  constexpr bool HasLocalFunctionDerivative = models<Definition::HasLocalFunctionDerivative(GF,Type)>;
60 
61  template <class GF, class Type>
62  using HasLocalFunctionDerivative_t = models_t<Definition::HasLocalFunctionDerivative(GF,Type)>;
63 
64 
66  template <class F>
67  constexpr bool HasPartial = models<Definition::HasPartial(F,index_t<0>)>;
68 
69  template <class F>
70  using HasPartial_t = models_t<Definition::HasPartial(F,index_t<0>)>;
71 
74  } // end namespace Concepts
75 
76 } // end namespace AMDiS
constexpr bool HasPartial
Functor F has free function partial(F,_0)
Definition: Derivative.hpp:67
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
auto derivativeOf(AnalyticLocalFunction< R(D), LC, F > const &lf, Type const &type)
Definition: AnalyticGridFunction.hpp:103
constexpr bool HasLocalFunctionDerivative
GridFunction GF has free function derivativeOf(localFunction(F))
Definition: Derivative.hpp:59
Definition: Derivative.hpp:28
Definition: Derivative.hpp:40
constexpr bool HasDerivative
GridFunction GF has free function derivativeOf(F,type)
Definition: Derivative.hpp:51