moab
moab::ProcConfig Class Reference

Multi-CPU information for parallel MOAB. More...

#include <ProcConfig.hpp>

List of all members.

Public Member Functions

 ProcConfig (MPI_Comm proc_comm)
 Constructor.
 ~ProcConfig ()
unsigned proc_rank () const
 Get the current processor number.
unsigned proc_size () const
 Get the number of processors.
gs_data::crystal_datacrystal_router (bool construct_if_missing=true)
 get a crystal router for this parallel job
MPI_Comm proc_comm () const
 get/set the communicator for this proc config
void proc_comm (MPI_Comm this_comm)
void proc_rank (unsigned r)
 set rank/size; USED FOR TESTING ONLY!
void proc_size (unsigned s)

Private Attributes

MPI_Comm procComm
 MPI communicator set for this instance.
unsigned procRank
 rank of this processor
unsigned procSize
 number of processors
gs_data::crystal_datacrystalData
 crystal router for this parallel job

Detailed Description

Multi-CPU information for parallel MOAB.

Examples:
CrystalRouterExample.cpp.

Definition at line 32 of file ProcConfig.hpp.


Constructor & Destructor Documentation

Constructor.

Definition at line 23 of file ProcConfig.cpp.

    : procComm(proc_comm1),
      crystalData(0)
{
#ifdef USE_MPI
  int rank, size;
  MPI_Comm_rank(procComm, &rank); 
  procRank = (unsigned int) rank;
  MPI_Comm_size(procComm, &size); 
  procSize = (unsigned int) size;
#else
  procRank = 0;
  procSize = 1;
#endif
}

Definition at line 50 of file ProcConfig.cpp.

{
  if (crystalData) {
#ifdef USE_MPI
    crystalData->reset();
#endif
    delete crystalData;
    crystalData = 0;
  }
}

Member Function Documentation

gs_data::crystal_data * moab::ProcConfig::crystal_router ( bool  construct_if_missing = true)

get a crystal router for this parallel job

Examples:
CrystalRouterExample.cpp.

Definition at line 39 of file ProcConfig.cpp.

{
#ifdef USE_MPI
  if (!crystalData && construct_if_missing) {
    crystalData = new gs_data::crystal_data(procComm);
  }
#endif

  return crystalData;
}

get/set the communicator for this proc config

Examples:
HelloParMOAB.cpp.

Definition at line 51 of file ProcConfig.hpp.

{return procComm;}
void moab::ProcConfig::proc_comm ( MPI_Comm  this_comm) [inline]

Definition at line 52 of file ProcConfig.hpp.

{procComm = this_comm;}
unsigned moab::ProcConfig::proc_rank ( ) const [inline]

Get the current processor number.

Examples:
CrystalRouterExample.cpp, and HelloParMOAB.cpp.

Definition at line 40 of file ProcConfig.hpp.

    { return procRank; }
void moab::ProcConfig::proc_rank ( unsigned  r) [inline]

set rank/size; USED FOR TESTING ONLY!

Definition at line 55 of file ProcConfig.hpp.

{procRank = r;}
unsigned moab::ProcConfig::proc_size ( ) const [inline]

Get the number of processors.

Examples:
CrystalRouterExample.cpp, and HelloParMOAB.cpp.

Definition at line 44 of file ProcConfig.hpp.

    { return procSize; }
void moab::ProcConfig::proc_size ( unsigned  s) [inline]

Definition at line 56 of file ProcConfig.hpp.

{procSize = s;}

Member Data Documentation

crystal router for this parallel job

Definition at line 70 of file ProcConfig.hpp.

MPI communicator set for this instance.

Definition at line 61 of file ProcConfig.hpp.

unsigned moab::ProcConfig::procRank [private]

rank of this processor

Definition at line 64 of file ProcConfig.hpp.

unsigned moab::ProcConfig::procSize [private]

number of processors

Definition at line 67 of file ProcConfig.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines