moab
ProcConfig.cpp
Go to the documentation of this file.
00001 
00016 #include "moab/ProcConfig.hpp"
00017 #include "moab/gs.hpp"
00018 
00019 namespace moab {
00020 
00021 
00023 ProcConfig::ProcConfig(MPI_Comm proc_comm1)
00024     : procComm(proc_comm1),
00025       crystalData(0)
00026 {
00027 #ifdef USE_MPI
00028   int rank, size;
00029   MPI_Comm_rank(procComm, &rank); 
00030   procRank = (unsigned int) rank;
00031   MPI_Comm_size(procComm, &size); 
00032   procSize = (unsigned int) size;
00033 #else
00034   procRank = 0;
00035   procSize = 1;
00036 #endif
00037 }
00038 
00039 gs_data::crystal_data *ProcConfig::crystal_router(bool construct_if_missing)
00040 {
00041 #ifdef USE_MPI
00042   if (!crystalData && construct_if_missing) {
00043     crystalData = new gs_data::crystal_data(procComm);
00044   }
00045 #endif
00046 
00047   return crystalData;
00048 }
00049 
00050 ProcConfig::~ProcConfig() 
00051 {
00052   if (crystalData) {
00053 #ifdef USE_MPI
00054     crystalData->reset();
00055 #endif
00056     delete crystalData;
00057     crystalData = 0;
00058   }
00059 }
00060 
00061 
00062 } // namespace moab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines