ESyS-Particle  4.0.1
gettype.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __GETTYPE_H
00014 #define __GETTYPE_H
00015 
00016 //--- MPI ---
00017 #include <mpi.h>
00018 
00019 //--- STL includes ---
00020 #include <utility>
00021 
00022 #include <Foundation/triplet.h>
00023 #include <Foundation/quadtuple.h>
00024 #include <Foundation/quintuple.h>
00025 
00026 using std::pair;
00027 
00033 class SGetType
00034 {
00035  public:
00036   template <typename T> MPI_Datatype operator()(const T &);
00037 
00038   template<typename T1,typename T2>
00039   MPI_Datatype operator()(const pair<T1,T2>&);
00040 
00041   template<typename T1, typename T2, typename T3>
00042   MPI_Datatype operator()(const esys::lsm::triplet<T1,T2,T3> &trip);
00043 
00044   template<typename T1, typename T2, typename T3, typename T4>
00045   MPI_Datatype operator()(const esys::lsm::quadtuple<T1,T2,T3,T4> &quad);
00046 
00047   template<typename T1, typename T2, typename T3, typename T4, typename T5>
00048   MPI_Datatype operator()(const esys::lsm::quintuple<T1,T2,T3,T4,T5> &quin);
00049 };
00050 
00054 template<typename T1,typename T2> 
00055 struct tml_pair {
00056   static MPI_Datatype type;
00057   static bool initialized;
00058 };
00059 template<typename T1,typename T2> MPI_Datatype tml_pair<T1,T2>::type=MPI_DATATYPE_NULL;
00060 template<typename T1,typename T2> bool tml_pair<T1,T2>::initialized=false;
00061 
00065 template<typename T1, typename T2, typename T3>
00066 struct tml_trip {
00067   static MPI_Datatype type;
00068   static bool initialized;
00069 };
00070 template<typename T1, typename T2, typename T3> MPI_Datatype tml_trip<T1,T2,T3>::type=MPI_DATATYPE_NULL;
00071 template<typename T1, typename T2, typename T3> bool tml_trip<T1,T2,T3>::initialized=false;
00072 
00076 template<typename T1, typename T2, typename T3, typename T4>
00077 struct tml_quad {
00078   static MPI_Datatype type;
00079   static bool initialized;
00080 };
00081 template<typename T1, typename T2, typename T3, typename T4> MPI_Datatype tml_quad<T1,T2,T3,T4>::type=MPI_DATATYPE_NULL;
00082 template<typename T1, typename T2, typename T3, typename T4> bool tml_quad<T1,T2,T3,T4>::initialized=false;
00083 
00087 template<typename T1, typename T2, typename T3, typename T4, typename T5>
00088 struct tml_quin {
00089   static MPI_Datatype type;
00090   static bool initialized;
00091 };
00092 template<typename T1, typename T2, typename T3, typename T4, typename T5> MPI_Datatype tml_quin<T1,T2,T3,T4,T5>::type=MPI_DATATYPE_NULL;
00093 template<typename T1, typename T2, typename T3, typename T4, typename T5> bool tml_quin<T1,T2,T3,T4,T5>::initialized=false;
00094 
00095 static SGetType GetType;
00096 
00097 #include "tml/type/gettype.hpp"
00098 
00099 #endif //__GETTYPE_H