PSCF v1.3
MpiTraits.h
1#ifdef UTIL_MPI
2#ifndef UTIL_MPI_TRAITS_H
3#define UTIL_MPI_TRAITS_H
4
5/*
6* Util Package - C++ Utilities for Scientific Computation
7*
8* Copyright 2010 - 2017, The Regents of the University of Minnesota
9* Distributed under the terms of the GNU General Public License.
10*/
11
12#include <util/global.h>
13#include <complex>
14
15
16namespace Util
17{
18
24 class MpiTraitsNoType
25 {
26 protected:
27 MpiTraitsNoType(){};
28 ~MpiTraitsNoType(){};
29 static const MPI::Datatype type;
30 static const bool hasType;
31 };
32
42 template <typename T>
43 class MpiTraits : public MpiTraitsNoType
44 {
45 public:
46 using MpiTraitsNoType::hasType;
47 using MpiTraitsNoType::type;
48 };
49
55 template <>
56 class MpiTraits<char>
57 {
58 public:
59 static const MPI::Datatype type;
60 static const bool hasType;
61 };
62
68 template <>
69 class MpiTraits<unsigned char>
70 {
71 public:
72 static const MPI::Datatype type;
73 static const bool hasType;
74 };
75
81 template <>
82 class MpiTraits<short>
83 {
84 public:
85 static const MPI::Datatype type;
86 static const bool hasType;
87 };
88
94 template <>
95 class MpiTraits<int>
96 {
97 public:
98 static const MPI::Datatype type;
99 static const bool hasType;
100 };
101
107 template <>
108 class MpiTraits<long>
109 {
110 public:
111 static const MPI::Datatype type;
112 static const bool hasType;
113 };
114
120 template <>
121 class MpiTraits<unsigned short>
122 {
123 public:
124 static const MPI::Datatype type;
125 static const bool hasType;
126 };
127
133 template <>
134 class MpiTraits<unsigned int>
135 {
136 public:
137 static const MPI::Datatype type;
138 static const bool hasType;
139 };
140
146 template <>
147 class MpiTraits<unsigned long>
148 {
149 public:
150 static const MPI::Datatype type;
151 static const bool hasType;
152 };
153
159 template <>
160 class MpiTraits<float>
161 {
162 public:
163 static const MPI::Datatype type;
164 static const bool hasType;
165 };
166
172 template <>
173 class MpiTraits<double>
174 {
175 public:
176 static const MPI::Datatype type;
177 static const bool hasType;
178 };
179
185 template <>
186 class MpiTraits<long double>
187 {
188 public:
189 static const MPI::Datatype type;
190 static const bool hasType;
191 };
192
198 template <>
199 class MpiTraits<bool>
200 {
201 public:
202 static const MPI::Datatype type;
203 static const bool hasType;
204 };
205
206 #if 0
210 template <>
211 class MpiTraits< std::complex<float> >
212 {
213 public:
214 static const MPI::Datatype type;
215 static const bool hasType;
216 };
217
223 template <>
224 class MpiTraits< std::complex<double> >
225 {
226 public:
227 static const MPI::Datatype type;
228 static const bool hasType;
229 };
230
236 template <>
237 class MpiTraits< std::complex<long double> >
238 {
239 public:
240 static const MPI::Datatype type;
241 static const bool hasType;
242 };
243 #endif
244
245 #if 0
251 template <>
252 class MpiTraits<wchar_t>
253 {
254 public:
255 static const MPI::Datatype type;
256 static const bool hasType;
257 };
258 #endif
259
260}
261#endif
262#endif
File containing preprocessor macros for error handling.
Utility classes for scientific computation.