DUNE-ACFEM (unstable)

typetraits.hh
Go to the documentation of this file.
1 #ifndef __DUNE_ACFEM_EXPRESSIONS_TYPETRAITS_HH__
2 #define __DUNE_ACFEM_EXPRESSIONS_TYPETRAITS_HH__
3 
9 #include <dune/common/fvector.hh>
10 #include <dune/common/fmatrix.hh>
11 
12 #include "../common/types.hh"
13 
14 namespace Dune
15 {
16 
17  namespace ACFem
18  {
19 
26  template<class I>
27  struct IsIntegral
28  : std::is_integral<I>
29  {};
30 
32  template<class F, class = void>
33  struct IsScalar
34  : FalseType
35  {};
36 
37  template<class T>
38  struct IsScalar<T, std::enable_if_t<!IsDecay<T>::value> >
39  : IsScalar<std::decay_t<T> >
40  {};
41 
46  template<class F>
47  struct IsScalar<F,
48  std::enable_if_t<(std::is_convertible<F*, typename FieldTraits<F>::field_type*>::value
49  &&
50  (std::numeric_limits<typename FieldTraits<F>::real_type>::is_iec559
51  ||
52  std::numeric_limits<typename FieldTraits<F>::real_type>::is_integer))> >
53  : TrueType
54  {};
55 
56  template<class FV, class SFINAE = void>
57  struct IsFieldVector
58  : FalseType
59  {};
60 
61  template<class FV>
62  struct IsFieldVector<FV, std::enable_if_t<!IsDecay<FV>::value> >
63  : IsFieldVector<std::decay_t<FV> >
64  {};
65 
66  template<class F, int dim>
67  struct IsFieldVector<FieldVector<F, dim> >
68  : TrueType
69  {};
70 
71  template<class F>
72  struct IsScalar<FieldVector<F, 1> >
73  : TrueType
74  {};
75 
76  template<class M>
77  struct IsFieldMatrix
78  : FalseType
79  {};
80 
81  template<class F, int Rows, int Cols>
82  struct IsFieldMatrix<FieldMatrix<F, Rows, Cols> >
83  : TrueType
84  {};
85 
87 
93  template<class T, class SFINAE = void>
94  struct FieldTraits
95  : Dune::FieldTraits<T>
96  {};
97 
99 
100  } // ACFem
101 
102 } // Dune
103 
104 #endif // __DUNE_ACFEM_EXPRESSIONS_TYPETRAITS_HH__
BoolConstant< false > FalseType
Alias for std::false_type.
Definition: types.hh:110
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
Helper class for specializing Dune::FieldTraits.
Definition: typetraits.hh:96
TrueType if I is an integral type.
Definition: typetraits.hh:29
std::true_type if F is an "elementary" scalar.
Definition: typetraits.hh:35
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 26, 22:29, 2024)