g4tools  5.4.0
Public Member Functions | Protected Member Functions | List of all members
tools::mpi::world Class Reference
Inheritance diagram for tools::mpi::world:
Inheritance graph
[legend]
Collaboration diagram for tools::mpi::world:
Collaboration graph
[legend]

Public Member Functions

virtual bool init (int *a_argc, char ***a_argv)
 
virtual bool rank (int &a_rank) const
 
virtual bool size (int &a_size) const
 
virtual bool processor_name (std::string &a_s) const
 
 world ()
 
virtual ~world ()
 
- Public Member Functions inherited from tools::impi_world
virtual ~impi_world ()
 

Protected Member Functions

 world (const world &a_from)
 
worldoperator= (const world &)
 

Detailed Description

Definition at line 24 of file world.

Constructor & Destructor Documentation

◆ world() [1/2]

tools::mpi::world::world ( )
inline

Definition at line 54 of file world.

54  {
55 #ifdef TOOLS_MEM
56  tools::mem::increment(s_class().c_str());
57 #endif
58  }

◆ ~world()

virtual tools::mpi::world::~world ( )
inlinevirtual

Definition at line 59 of file world.

59  {
60 #ifdef TOOLS_MEM
61  tools::mem::decrement(s_class().c_str());
62 #endif
63  }

◆ world() [2/2]

tools::mpi::world::world ( const world a_from)
inlineprotected

Definition at line 65 of file world.

65  :parent(a_from) {
66 #ifdef TOOLS_MEM
67  tools::mem::increment(s_class().c_str());
68 #endif
69  }

Member Function Documentation

◆ init()

virtual bool tools::mpi::world::init ( int *  a_argc,
char ***  a_argv 
)
inlinevirtual

Implements tools::impi_world.

Definition at line 34 of file world.

34  {
35  if(::MPI_Init(a_argc,a_argv)!=MPI_SUCCESS) return false;
36  return true;
37  }

◆ operator=()

world& tools::mpi::world::operator= ( const world )
inlineprotected

Definition at line 70 of file world.

70 {return *this;}

◆ processor_name()

virtual bool tools::mpi::world::processor_name ( std::string &  a_s) const
inlinevirtual

Implements tools::impi_world.

Definition at line 46 of file world.

46  {
47  char name[MPI_MAX_PROCESSOR_NAME];
48  int lname;
49  if(::MPI_Get_processor_name(name,&lname)!=MPI_SUCCESS) {a_s.clear();return false;}
50  a_s = std::string(name);
51  return true;
52  }

◆ rank()

virtual bool tools::mpi::world::rank ( int &  a_rank) const
inlinevirtual

Implements tools::impi_world.

Definition at line 38 of file world.

38  {
39  if(::MPI_Comm_rank(MPI_COMM_WORLD,&a_rank)!=MPI_SUCCESS) {a_rank=-1;return false;}
40  return true;
41  }

◆ size()

virtual bool tools::mpi::world::size ( int &  a_size) const
inlinevirtual

Implements tools::impi_world.

Definition at line 42 of file world.

42  {
43  if(::MPI_Comm_size(MPI_COMM_WORLD,&a_size)!=MPI_SUCCESS) {a_size=0;return false;}
44  return true;
45  }

The documentation for this class was generated from the following file:
MPI_Comm_size
int MPI_Comm_size(MPI_Comm, int *)
Definition: dummy_mpi.h:64
MPI_MAX_PROCESSOR_NAME
#define MPI_MAX_PROCESSOR_NAME
Definition: dummy_mpi.h:60
MPI_Comm_rank
int MPI_Comm_rank(MPI_Comm, int *)
Definition: dummy_mpi.h:65
MPI_SUCCESS
#define MPI_SUCCESS
Definition: dummy_mpi.h:30
MPI_Get_processor_name
int MPI_Get_processor_name(char *, int *)
Definition: dummy_mpi.h:66
MPI_Init
int MPI_Init(int *, char ***)
Definition: dummy_mpi.h:62
MPI_COMM_WORLD
#define MPI_COMM_WORLD
to pass examples/cpp/mpi.cpp //////////////////////////////
Definition: dummy_mpi.h:59