cgma
|
00001 #ifndef CGM_PROC_CONFIG_HPP 00002 #define CGM_PROC_CONFIG_HPP 00003 00004 #ifdef USE_MPI 00005 # include "CGMmpi.h" 00006 #else 00007 typedef int MPI_Comm; 00008 #define MPI_COMM_WORLD 0 00009 #endif 00010 00012 class CGMProcConfig { 00013 public: 00014 00015 CGMProcConfig(MPI_Comm proc_comm = MPI_COMM_WORLD); 00016 00017 ~CGMProcConfig(); 00018 00020 unsigned proc_rank() const 00021 { return procRank; } 00022 00024 unsigned proc_size() const 00025 { return procSize; } 00026 00028 MPI_Comm proc_comm() const {return procComm;} 00029 void proc_comm(MPI_Comm this_comm) {procComm = this_comm;} 00030 00031 void set_master(unsigned int proc); 00032 unsigned int get_master(); 00033 00034 private: 00035 00037 MPI_Comm procComm; 00038 00040 unsigned procRank; 00041 00043 unsigned procSize; 00044 00045 unsigned int master; 00046 00047 }; 00048 00049 inline void CGMProcConfig::set_master(unsigned int proc) { 00050 master = proc; 00051 } 00052 00053 inline unsigned int CGMProcConfig::get_master() { 00054 return master; 00055 } 00056 00057 #endif