AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
DerivativeTraits.hpp
1#pragma once
2
3#include <dune/functions/common/defaultderivativetraits.hh>
4
5namespace Dune
6{
7 template <class K, int n>
8 class FieldVector;
9
10 template <class K, int n, int m>
11 class FieldMatrix;
12}
13
14namespace AMDiS
15{
16 namespace tag
17 {
18 struct value {};
19 struct jacobian {};
20 using gradient = jacobian;
21 struct divergence {};
22 struct partial { std::size_t comp = 0; };
23
24 // register possible types for derivative traits
26 }
27
28 template <class Sig, class Type>
30
31 template <class R, class D>
32 struct DerivativeTraits<R(D), tag::value>
33 {
34 using Range = R;
35 };
36
37 template <class R, class D>
38 struct DerivativeTraits<R(D), tag::jacobian>
39 : public Dune::Functions::DefaultDerivativeTraits<R(D)>
40 {};
41
42 template <class K, int n>
43 struct DerivativeTraits<K(Dune::FieldVector<K,n>), tag::jacobian>
44 {
45 using Range = Dune::FieldVector<K,n>;
46 };
47
48 template <class K, int n>
49 struct DerivativeTraits<Dune::FieldVector<K,1>(Dune::FieldVector<K,n>), tag::jacobian>
50 {
51 using Range = Dune::FieldVector<K,n>;
52 };
53
54 template <class R, class K, int n>
55 struct DerivativeTraits<R(Dune::FieldVector<K,n>), tag::partial>
56 {
57 using Range = R;
58 };
59
60 template <class K, int n>
61 struct DerivativeTraits<Dune::FieldVector<K,n>(Dune::FieldVector<K,n>), tag::divergence>
62 {
63 using Range = K;
64 };
65
66 template <class K, int n, int m>
67 struct DerivativeTraits<Dune::FieldMatrix<K,n,m>(FieldVector<K,n>), tag::divergence>
68 {
69 using Range = Dune::FieldVector<K,m>;
70 };
71
72} // end namespace AMDiS
Definition: DerivativeTraits.hpp:29
Definition: DerivativeTraits.hpp:25
Definition: DerivativeTraits.hpp:21
Definition: DerivativeTraits.hpp:19
Definition: DerivativeTraits.hpp:22
Definition: DerivativeTraits.hpp:18