schwz  Generated automatically from develop
mpi_datatype.hpp (92dbd95)
1 
2 /*******************************<SCHWARZ LIB LICENSE>***********************
3 Copyright (c) 2019, the SCHWARZ LIB authors
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its
18 contributors may be used to endorse or promote products derived from
19 this software without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ******************************<SCHWARZ LIB LICENSE>*************************/
33 
34 #ifndef mpi_datatype_hpp
35 #define mpi_datatype_hpp
36 
37 namespace schwz {
38 namespace mpi {
39 
40 #define SCHWZ_MPI_DATATYPE(BaseType, MPIType) \
41  inline MPI_Datatype get_mpi_datatype(const BaseType &) { return MPIType; } \
42  static_assert(true, \
43  "This assert is used to counter the false positive extra " \
44  "semi-colon warnings")
45 
46 
47 SCHWZ_MPI_DATATYPE(char, MPI_CHAR);
48 SCHWZ_MPI_DATATYPE(unsigned char, MPI_UNSIGNED_CHAR);
49 SCHWZ_MPI_DATATYPE(unsigned, MPI_UNSIGNED);
50 SCHWZ_MPI_DATATYPE(int, MPI_INT);
51 SCHWZ_MPI_DATATYPE(unsigned long, MPI_UNSIGNED_LONG);
52 SCHWZ_MPI_DATATYPE(unsigned short, MPI_UNSIGNED_SHORT);
53 SCHWZ_MPI_DATATYPE(long, MPI_LONG);
54 SCHWZ_MPI_DATATYPE(float, MPI_FLOAT);
55 SCHWZ_MPI_DATATYPE(double, MPI_DOUBLE);
56 SCHWZ_MPI_DATATYPE(long double, MPI_LONG_DOUBLE);
57 SCHWZ_MPI_DATATYPE(std::complex<float>, MPI_COMPLEX);
58 SCHWZ_MPI_DATATYPE(std::complex<double>, MPI_DOUBLE_COMPLEX);
59 
60 
61 } // namespace mpi
62 } // namespace schwz
63 
64 
65 #endif // mpi_datatype.hpp
The Schwarz wrappers namespace.
Definition: comm_helpers.hpp:49