-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTypeInference.h
186 lines (179 loc) · 4.17 KB
/
TypeInference.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// SPDX-FileCopyrightText: 2019-2023 Technical University of Munich
//
// SPDX-License-Identifier: BSD-3-Clause
/**
* @file
* This file is part of PUML
*
* For conditions of distribution and use, please see the copyright
* notice in the file 'COPYING' at the root directory of this package
* and the copyright notice at https://github.com/TUM-I5/PUMGen
*
* @author David Schneller <[email protected]>
*/
#ifndef PUML_TYPE_INFERENCE_H
#define PUML_TYPE_INFERENCE_H
#include <hdf5.h>
#ifdef USE_MPI
#include <mpi.h>
#endif // USE_MPI
namespace PUML {
#ifdef USE_MPI
template <typename T>
class MPITypeInfer {
public:
static auto type() -> MPI_Datatype { return MPI_BYTE; }
};
template <>
class MPITypeInfer<char> {
public:
static auto type() -> MPI_Datatype { return MPI_CHAR; }
};
template <>
class MPITypeInfer<signed char> {
public:
static auto type() -> MPI_Datatype { return MPI_SIGNED_CHAR; }
};
template <>
class MPITypeInfer<unsigned char> {
public:
static auto type() -> MPI_Datatype { return MPI_UNSIGNED_CHAR; }
};
template <>
class MPITypeInfer<short> {
public:
static auto type() -> MPI_Datatype { return MPI_SHORT; }
};
template <>
class MPITypeInfer<unsigned short> {
public:
static auto type() -> MPI_Datatype { return MPI_UNSIGNED_SHORT; }
};
template <>
class MPITypeInfer<int> {
public:
static auto type() -> MPI_Datatype { return MPI_INT; }
};
template <>
class MPITypeInfer<unsigned> {
public:
static auto type() -> MPI_Datatype { return MPI_UNSIGNED; }
};
template <>
class MPITypeInfer<long> {
public:
static auto type() -> MPI_Datatype { return MPI_LONG; }
};
template <>
class MPITypeInfer<unsigned long> {
public:
static auto type() -> MPI_Datatype { return MPI_UNSIGNED_LONG; }
};
template <>
class MPITypeInfer<long long> {
public:
static auto type() -> MPI_Datatype { return MPI_LONG_LONG; }
};
template <>
class MPITypeInfer<unsigned long long> {
public:
static auto type() -> MPI_Datatype { return MPI_UNSIGNED_LONG_LONG; }
};
template <>
class MPITypeInfer<float> {
public:
static auto type() -> MPI_Datatype { return MPI_FLOAT; }
};
template <>
class MPITypeInfer<double> {
public:
static auto type() -> MPI_Datatype { return MPI_DOUBLE; }
};
template <>
class MPITypeInfer<long double> {
public:
static auto type() -> MPI_Datatype { return MPI_LONG_DOUBLE; }
};
template <>
class MPITypeInfer<wchar_t> {
public:
static auto type() -> MPI_Datatype { return MPI_WCHAR; }
};
#endif
template <typename T>
class HDF5TypeInfer {
public:
static auto type() -> hid_t { return -1; }
};
template <>
class HDF5TypeInfer<char> {
public:
static auto type() -> hid_t { return H5T_NATIVE_CHAR; }
};
template <>
class HDF5TypeInfer<signed char> {
public:
static auto type() -> hid_t { return H5T_NATIVE_SCHAR; }
};
template <>
class HDF5TypeInfer<unsigned char> {
public:
static auto type() -> hid_t { return H5T_NATIVE_UCHAR; }
};
template <>
class HDF5TypeInfer<short> {
public:
static auto type() -> hid_t { return H5T_NATIVE_SHORT; }
};
template <>
class HDF5TypeInfer<unsigned short> {
public:
static auto type() -> hid_t { return H5T_NATIVE_USHORT; }
};
template <>
class HDF5TypeInfer<int> {
public:
static auto type() -> hid_t { return H5T_NATIVE_INT; }
};
template <>
class HDF5TypeInfer<unsigned> {
public:
static auto type() -> hid_t { return H5T_NATIVE_UINT; }
};
template <>
class HDF5TypeInfer<long> {
public:
static auto type() -> hid_t { return H5T_NATIVE_LONG; }
};
template <>
class HDF5TypeInfer<unsigned long> {
public:
static auto type() -> hid_t { return H5T_NATIVE_ULONG; }
};
template <>
class HDF5TypeInfer<long long> {
public:
static auto type() -> hid_t { return H5T_NATIVE_LLONG; }
};
template <>
class HDF5TypeInfer<unsigned long long> {
public:
static auto type() -> hid_t { return H5T_NATIVE_ULLONG; }
};
template <>
class HDF5TypeInfer<float> {
public:
static auto type() -> hid_t { return H5T_NATIVE_FLOAT; }
};
template <>
class HDF5TypeInfer<double> {
public:
static auto type() -> hid_t { return H5T_NATIVE_DOUBLE; }
};
template <>
class HDF5TypeInfer<long double> {
public:
static auto type() -> hid_t { return H5T_NATIVE_LDOUBLE; }
};
} // namespace PUML
#endif