UPstream::Communicator Class Reference

An opaque wrapper for MPI_Comm with a vendor-independent representation without any <mpi.h> header. More...

Public Types

typedef std::intptr_t value_type
 Storage for MPI_Comm (as integer or pointer) More...
 

Public Member Functions

 Communicator (const Communicator &) noexcept=default
 Copy construct. More...
 
 Communicator (Communicator &&) noexcept=default
 Move construct. More...
 
Communicatoroperator= (const Communicator &) noexcept=default
 Copy assignment. More...
 
Communicatoroperator= (Communicator &&) noexcept=default
 Move assignment. More...
 
bool operator== (const Communicator &rhs) const noexcept
 Test for equality. More...
 
bool operator!= (const Communicator &rhs) const noexcept
 Test for inequality. More...
 
 Communicator () noexcept
 Default construct as MPI_COMM_NULL. More...
 
 Communicator (const void *p) noexcept
 Construct from MPI_Comm (as pointer type) More...
 
 Communicator (value_type val) noexcept
 Construct from MPI_Comm (as integer type) More...
 
value_type value () const noexcept
 Return raw value. More...
 
const void * pointer () const noexcept
 Return as pointer value. More...
 
bool good () const noexcept
 True if not equal to MPI_COMM_NULL. More...
 
void reset () noexcept
 Reset to default constructed value (MPI_COMM_NULL) More...
 
int size () const
 The number of ranks associated with the communicator. More...
 

Static Public Member Functions

static Communicator lookup (const int comm)
 Transcribe internally indexed communicator to wrapped value. More...
 

Detailed Description

An opaque wrapper for MPI_Comm with a vendor-independent representation without any <mpi.h> header.

The MPI standard states that MPI_Comm is always an opaque object. Generally it is either an integer (eg, mpich) or a pointer (eg, openmpi).

Definition at line 2451 of file UPstream.H.

Member Typedef Documentation

◆ value_type

typedef std::intptr_t value_type

Storage for MPI_Comm (as integer or pointer)

Definition at line 2460 of file UPstream.H.

Constructor & Destructor Documentation

◆ Communicator() [1/5]

Communicator ( const Communicator )
defaultnoexcept

Copy construct.

◆ Communicator() [2/5]

Communicator ( Communicator &&  )
defaultnoexcept

Move construct.

◆ Communicator() [3/5]

Communicator ( )
noexcept

Default construct as MPI_COMM_NULL.

Definition at line 25 of file UPstreamCommunicator.C.

◆ Communicator() [4/5]

Communicator ( const void *  p)
inlineexplicitnoexcept

Construct from MPI_Comm (as pointer type)

Definition at line 2526 of file UPstream.H.

◆ Communicator() [5/5]

Communicator ( value_type  val)
inlineexplicitnoexcept

Construct from MPI_Comm (as integer type)

Definition at line 2534 of file UPstream.H.

Member Function Documentation

◆ operator=() [1/2]

Communicator& operator= ( const Communicator )
defaultnoexcept

Copy assignment.

◆ operator=() [2/2]

Communicator& operator= ( Communicator &&  )
defaultnoexcept

Move assignment.

◆ operator==()

bool operator== ( const Communicator rhs) const
inlinenoexcept

Test for equality.

Definition at line 2502 of file UPstream.H.

◆ operator!=()

bool operator!= ( const Communicator rhs) const
inlinenoexcept

Test for inequality.

Definition at line 2510 of file UPstream.H.

◆ lookup()

Foam::UPstream::Communicator lookup ( const int  comm)
static

Transcribe internally indexed communicator to wrapped value.

Example,

Definition at line 34 of file UPstreamCommunicator.C.

◆ value()

value_type value ( ) const
inlinenoexcept

Return raw value.

Definition at line 2561 of file UPstream.H.

◆ pointer()

const void* pointer ( ) const
inlinenoexcept

Return as pointer value.

Definition at line 2566 of file UPstream.H.

◆ good()

bool good ( ) const
noexcept

True if not equal to MPI_COMM_NULL.

Definition at line 42 of file UPstreamCommunicator.C.

◆ reset()

void reset ( )
noexcept

Reset to default constructed value (MPI_COMM_NULL)

Definition at line 48 of file UPstreamCommunicator.C.

◆ size()

int size ( ) const

The number of ranks associated with the communicator.

Definition at line 52 of file UPstreamCommunicator.C.


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