UPstream::communicator Class Reference

Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorComponents() and UPstream::freeCommunicatorComponents() More...

Public Member Functions

 communicator (const communicator &)=delete
 No copy construct. More...
 
void operator= (const communicator &)=delete
 No copy assignment. More...
 
 communicator () noexcept
 Default construct (a placeholder communicator) More...
 
 communicator (communicator &&c)
 Move construct, takes ownership. More...
 
 communicator (const label parentComm, const labelRange &subRanks)
 Allocate communicator for contiguous sub-ranks on given parent. More...
 
 communicator (const label parentComm, const labelUList &subRanks)
 Allocate communicator for sub-ranks on given parent. More...
 
 ~communicator ()
 Free allocated communicator. More...
 
bool good () const noexcept
 True if communicator is non-negative (ie, was allocated) More...
 
label comm () const noexcept
 The communicator label. More...
 
communicatorconstCast () const noexcept
 Return non-const reference to this. More...
 
label release () noexcept
 Release ownership of the communicator, return old value. More...
 
void reset ()
 Free allocated communicator. More...
 
void reset (label parent, const labelRange &subRanks)
 Allocate with contiguous sub-ranks of parent communicator. More...
 
void reset (label parent, const labelUList &subRanks)
 Allocate with sub-ranks of parent communicator. More...
 
void reset (communicator &&c)
 Take ownership, free managed communicator. More...
 
void swap (communicator &c)
 Swap communicator labels. More...
 
 operator label () const noexcept
 Implicit cast to label - the same as comm() More...
 
void operator= (communicator &&c)
 Move assignment, takes ownership. More...
 
bool operator== (const communicator &c) const noexcept
 Test for equality. More...
 
bool operator!= (const communicator &c) const noexcept
 Test for inequality. More...
 

Static Public Member Functions

static communicator duplicate (const label parentComm)
 Duplicate the given communicator. More...
 
static communicator split (const label parentComm, const int colour, const bool two_step=true)
 Factory Method : Split the communicator on the given colour. More...
 

Detailed Description

Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorComponents() and UPstream::freeCommunicatorComponents()

Definition at line 2237 of file UPstream.H.

Constructor & Destructor Documentation

◆ communicator() [1/5]

communicator ( const communicator )
delete

No copy construct.

◆ communicator() [2/5]

communicator ( )
inlinenoexcept

Default construct (a placeholder communicator)

Definition at line 2266 of file UPstream.H.

◆ communicator() [3/5]

communicator ( communicator &&  c)
inline

Move construct, takes ownership.

Definition at line 2271 of file UPstream.H.

References Foam::constant::universal::c.

◆ communicator() [4/5]

communicator ( const label  parentComm,
const labelRange subRanks 
)
inline

Allocate communicator for contiguous sub-ranks on given parent.

Parameters
parentCommThe parent communicator
subRanksThe contiguous sub-ranks of parent to use

Definition at line 2277 of file UPstream.H.

◆ communicator() [5/5]

communicator ( const label  parentComm,
const labelUList subRanks 
)
inline

Allocate communicator for sub-ranks on given parent.

Parameters
parentCommThe parent communicator
subRanksThe sub-ranks of parent to use (negative values ignored)

Definition at line 2291 of file UPstream.H.

◆ ~communicator()

~communicator ( )
inline

Free allocated communicator.

Definition at line 2307 of file UPstream.H.

References UPstream::freeCommunicator().

Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

void operator= ( const communicator )
delete

No copy assignment.

◆ duplicate()

static communicator duplicate ( const label  parentComm)
inlinestatic

Duplicate the given communicator.

Definition at line 2315 of file UPstream.H.

References Foam::constant::universal::c, and UPstream::dupCommunicator().

Here is the call graph for this function:

◆ split()

static communicator split ( const label  parentComm,
const int  colour,
const bool  two_step = true 
)
inlinestatic

Factory Method : Split the communicator on the given colour.

Parameters
parentCommThe parent communicator
colourThe colouring to select which ranks to include. Negative values correspond to 'ignore'
two_stepUse MPI_Allgather+MPI_Comm_create_group vs MPI_Comm_split

Definition at line 2327 of file UPstream.H.

References Foam::constant::universal::c, and UPstream::splitCommunicator().

Here is the call graph for this function:

◆ good()

bool good ( ) const
inlinenoexcept

True if communicator is non-negative (ie, was allocated)

Definition at line 2348 of file UPstream.H.

◆ comm()

label comm ( ) const
inlinenoexcept

The communicator label.

Definition at line 2353 of file UPstream.H.

◆ constCast()

communicator& constCast ( ) const
inlinenoexcept

Return non-const reference to this.

Definition at line 2358 of file UPstream.H.

◆ release()

label release ( )
inlinenoexcept

Release ownership of the communicator, return old value.

Leave further management to the caller

Definition at line 2368 of file UPstream.H.

References Foam::constant::universal::c.

◆ reset() [1/4]

void reset ( )
inline

Free allocated communicator.

Definition at line 2373 of file UPstream.H.

References UPstream::freeCommunicator().

Here is the call graph for this function:

◆ reset() [2/4]

void reset ( label  parent,
const labelRange subRanks 
)
inline

Allocate with contiguous sub-ranks of parent communicator.

Definition at line 2378 of file UPstream.H.

References UPstream::freeCommunicator(), UPstream::newCommunicator(), and UPstream::parent().

Here is the call graph for this function:

◆ reset() [3/4]

void reset ( label  parent,
const labelUList subRanks 
)
inline

Allocate with sub-ranks of parent communicator.

Definition at line 2387 of file UPstream.H.

References UPstream::freeCommunicator(), UPstream::newCommunicator(), and UPstream::parent().

Here is the call graph for this function:

◆ reset() [4/4]

void reset ( communicator &&  c)
inline

Take ownership, free managed communicator.

Definition at line 2396 of file UPstream.H.

References Foam::constant::universal::c, and UPstream::freeCommunicator().

Here is the call graph for this function:

◆ swap()

void swap ( communicator c)
inline

Swap communicator labels.

Definition at line 2407 of file UPstream.H.

References Foam::constant::universal::c.

◆ operator label()

operator label ( ) const
inlinenoexcept

Implicit cast to label - the same as comm()

Definition at line 2415 of file UPstream.H.

◆ operator=() [2/2]

void operator= ( communicator &&  c)
inline

Move assignment, takes ownership.

Definition at line 2420 of file UPstream.H.

References Foam::constant::universal::c, and reset().

Here is the call graph for this function:

◆ operator==()

bool operator== ( const communicator c) const
inlinenoexcept

Test for equality.

Definition at line 2425 of file UPstream.H.

References Foam::constant::universal::c.

◆ operator!=()

bool operator!= ( const communicator c) const
inlinenoexcept

Test for inequality.

Definition at line 2433 of file UPstream.H.

References Foam::constant::universal::c.


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