aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/typeprops.hh
blob: e8a1ec342d3bf6bb6b8fa782d1dfd09737b734a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef TYPEPROPS_HH
#define TYPEPROPS_HH

#include <cctk.h>



template <typename T>
struct typeprops {
  typedef T complex;
  typedef T real;
  static inline complex fromreal (real const x) { return x; }
};

#ifdef HAVE_CCTK_COMPLEX8
template <>
struct typeprops <CCTK_COMPLEX8> {
  typedef CCTK_COMPLEX8 complex;
  typedef CCTK_REAL4 real;
  static inline complex fromreal (real const x) { return CCTK_Cmplx8 (x, 0); }
};
#endif

#ifdef HAVE_CCTK_COMPLEX16
template <>
struct typeprops <CCTK_COMPLEX16> {
  typedef CCTK_COMPLEX16 complex;
  typedef CCTK_REAL8 real;
  static inline complex fromreal (real const x) { return CCTK_Cmplx16 (x, 0); }
};
#endif

#ifdef HAVE_CCTK_COMPLEX32
template <>
struct typeprops <CCTK_COMPLEX32> {
  typedef CCTK_COMPLEX32 complex;
  typedef CCTK_REAL16 real;
  static inline complex fromreal (real const x) { return CCTK_Cmplx32 (x, 0); }
};
#endif



#endif // #ifndef TYPEPROPS_HH