Teuchos_RawMPITraits.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef TEUCHOS_RAW_MPI_TRAITS_H
00033 #define TEUCHOS_RAW_MPI_TRAITS_H
00034
00035 #include "Teuchos_ConfigDefs.hpp"
00036
00041 namespace Teuchos {
00042
00068 template <class T> class RawMPITraits {
00069 public:
00071 static int adjustCount(const int count) { bool *junk1; T *junk2 = &junk1; return 0; }
00073 static MPI_Datatype type() { bool *junk1; T *junk2 = &junk1; return MPI_DATATYPE_NULL; }
00075 static MPI_Op sumOp() { bool *junk1; T *junk2 = &junk1; return MPI_OP_NULL; }
00077 static MPI_Op maxOp() { bool *junk1; T *junk2 = &junk1; return MPI_OP_NULL; }
00079 static MPI_Op minOp() { bool *junk1; T *junk2 = &junk1; return MPI_OP_NULL; }
00080 };
00081
00082 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00083
00085 template <> class RawMPITraits<char> {
00086 public:
00088 static int adjustCount(const int count) { return count; }
00090 static MPI_Datatype type() { return MPI_CHAR; }
00092 static MPI_Op sumOp() { return MPI_SUM; }
00094 static MPI_Op maxOp() { return MPI_MAX; }
00096 static MPI_Op minOp() { return MPI_MIN; }
00097 };
00098
00101 template <> class RawMPITraits<int> {
00102 public:
00104 static int adjustCount(const int count) { return count; }
00106 static MPI_Datatype type() { return MPI_INT; }
00108 static MPI_Op sumOp() { return MPI_SUM; }
00110 static MPI_Op maxOp() { return MPI_MAX; }
00112 static MPI_Op minOp() { return MPI_MIN; }
00113 };
00114
00117 template <> class RawMPITraits<float> {
00118 public:
00120 static int adjustCount(const int count) { return count; }
00122 static MPI_Datatype type() { return MPI_FLOAT; }
00124 static MPI_Op sumOp() { return MPI_SUM; }
00126 static MPI_Op maxOp() { return MPI_MAX; }
00128 static MPI_Op minOp() { return MPI_MIN; }
00129 };
00130
00133 template <> class RawMPITraits<double> {
00134 public:
00136 static int adjustCount(const int count) { return count; }
00138 static MPI_Datatype type() { return MPI_DOUBLE; }
00140 static MPI_Op sumOp() { return MPI_SUM; }
00142 static MPI_Op maxOp() { return MPI_MAX; }
00144 static MPI_Op minOp() { return MPI_MIN; }
00145 };
00146
00155 template <class T> class RawMPITraits< std::complex<T> > {
00156 public:
00158 static int adjustCount(const int count) { return (2*count); }
00160 static MPI_Datatype type() { return RawMPITraits<T>::type(); }
00162 static MPI_Op sumOp() { return MPI_SUM; }
00163 };
00164
00165 #endif // DOXYGEN_SHOULD_SKIP_THIS
00166
00167 }
00168
00169 #endif // TEUCHOS_RAW_MPI_TRAITS_H