00001
00002
00003
00004 #ifndef PLAYA_MPI_DATA_TYPE_H
00005 #define PLAYA_MPI_DATA_TYPE_H
00006
00007
00008 #include "PlayaDefs.hpp"
00009 #include "Teuchos_ConfigDefs.hpp"
00010 #include "Teuchos_RCP.hpp"
00011 #include <stack>
00012
00013 #ifdef HAVE_MPI
00014 #include "mpi.h"
00015 #endif
00016
00017
00018 namespace Playa
00019 {
00020 using Teuchos::RCP;
00021 using Teuchos::rcp;
00022
00023
00024 class MPIDataType
00025 {
00026 public:
00027
00028 MPIDataType(const std::string& name);
00029
00030 #ifdef HAVE_MPI
00031
00032 MPIDataType(const std::string& name, const RCP<MPI_Datatype>& mpiType);
00033 #endif
00034
00035
00036 const std::string& name() const {return name_;}
00037
00038 #ifdef HAVE_MPI
00039
00040 MPI_Datatype* ptr() ;
00041
00042
00043 const MPI_Datatype& handle() const ;
00044 #endif
00045
00046
00047 static MPIDataType intType() ;
00048
00049
00050 static MPIDataType floatType() ;
00051
00052
00053 static MPIDataType doubleType() ;
00054
00055
00056 static MPIDataType doubleIntPairType() ;
00057
00058
00059 static MPIDataType charType() ;
00060
00061
00062 static void registerType(const MPIDataType& dataType);
00063
00064 static std::stack<MPIDataType>& typeRegistry();
00065
00066 static void clearTypeRegistry();
00067
00068 private:
00069 std::string name_;
00070 #ifdef HAVE_MPI
00071 RCP<MPI_Datatype> mpiType_;
00072 #endif
00073 };
00074
00075
00076
00077 }
00078
00079 #endif