cgma
ProcData.cpp
Go to the documentation of this file.
00001 //
00002 //
00003 #include "ProcData.hpp"
00004 
00005 ProcData *ProcData::instance_ = 0;
00006 int ProcData::isInitialized = 0;
00007 
00008 int ProcData::initialize(int &argc, char **&argv) 
00009 {
00010   if (isInitialized == 1) return 1;
00011 
00012 #ifdef USE_MPI  
00013   int ierror;
00014   ierror = MPI_Init(&argc, &argv);
00015   ierror = MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
00016   ierror = MPI_Comm_size(MPI_COMM_WORLD, &numProcs);
00017 #else
00018   myRank = 0;
00019   numProcs = 1;
00020 #endif
00021   
00022 /* initialize designated rank of master */  
00023   masterRank = 0;
00024 
00025   isInitialized = 1;
00026 
00027   return ierror;
00028 }
00029 
00030 ProcData::~ProcData() 
00031 {
00032 #ifdef USE_MPI
00033   MPI_Finalize();
00034 #endif
00035 
00036   isInitialized = 0;
00037 }
00038 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines