Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

MPITraits.h

Go to the documentation of this file.
00001 #ifndef MPITRAITS_H
00002 #define MPITRAITS_H
00003 
00004 #include "MPIComm.h"
00005 
00006 namespace Sundance
00007 {
00008   using std::string;
00009 
00010   /** \ingroup MPI 
00011    * MPITraits let us bind MPI types to C++ types.
00012    */
00013   template <class T> class MPITraits
00014     {
00015     public:
00016       /** return the MPI data type of the template argument */
00017       static int type();
00018     };
00019   
00020   /** \ingroup MPI 
00021    * Binds MPI_INT to int
00022    */
00023   template <> class MPITraits<int>
00024     {
00025     public:
00026       /** return the MPI data type of the template argument */
00027       static int type() {return MPIComm::INT;}
00028     };
00029   
00030   /** \ingroup MPI 
00031    * Binds MPI_FLOAT to float
00032    */
00033   template <> class MPITraits<float>
00034     {
00035     public:
00036       /** return the MPI data type of the template argument */
00037       static int type() {return MPIComm::FLOAT;}
00038     };
00039   
00040   /** \ingroup MPI 
00041    * Binds MPI_DOUBLE to double
00042    */
00043   template <> class MPITraits<double>
00044     {
00045     public:
00046       /** return the MPI data type of the template argument */
00047       static int type() {return MPIComm::DOUBLE;}
00048     };
00049   
00050   /** \ingroup MPI 
00051    * Binds MPI_CHAR to char
00052    */
00053   template <> class MPITraits<char>
00054     {
00055     public:
00056       /** return the MPI data type of the template argument */
00057       static int type() {return MPIComm::CHAR;}
00058     };
00059   
00060 }
00061 
00062 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by