SCOREC core
Parallel unstructured mesh tools
Public Member Functions | List of all members
pcu::PCU Class Reference

The Parallel Contrul Unit class encapsulates parallel communication. More...

Public Member Functions

int Self () const noexcept
 Returns the rank of the current process. More...
 
int Peers () const noexcept
 Returns the number of ranks in the communicator. More...
 
std::unique_ptr< PCUSplit (int color, int key) noexcept
 Split a communicator into distinct subgroups. More...
 
int DupComm (PCU_Comm *newcomm) const noexcept
 Duplicate the underlying communicator. More...
 

Detailed Description

The Parallel Contrul Unit class encapsulates parallel communication.

Definition at line 26 of file PCU.h.

Member Function Documentation

◆ DupComm()

int pcu::PCU::DupComm ( PCU_Comm *  newcomm) const
noexcept

Duplicate the underlying communicator.

It is the user's responsiblity to cleanup the returned communicator. This function may be used to initialize other libraries using the PCU-defined communication group.

If SCOREC::core was compiled with the SCOREC_NO_MPI flag, the return value is not meaningful.

Parameters
[out]newcommThe output address for the new communicator copy.
Returns
0 on success.

◆ Peers()

int pcu::PCU::Peers ( ) const
noexcept

Returns the number of ranks in the communicator.

Returns
The number of ranks in the communicator.

◆ Self()

int pcu::PCU::Self ( ) const
noexcept

Returns the rank of the current process.

Returns
The rank of the current process.

◆ Split()

std::unique_ptr<PCU> pcu::PCU::Split ( int  color,
int  key 
)
noexcept

Split a communicator into distinct subgroups.

The resulting communicator is marked owned and automatically free the underlying communicator. This can be disabled with PCU::OwnsComm(bool). In that case, the user is responsible for cleanup.

Parameters
colorsubgroup indicator.
keyused for subgroup ordering; specify 0 if you don't care.
Returns
a new communicator defined on the resulting subgroup.

The documentation for this class was generated from the following file: