preCICE v3.1.1
Loading...
Searching...
No Matches
Public Attributes | List of all members
precice::utils::Parallel::CommState Struct Reference

#include <Parallel.hpp>

Collaboration diagram for precice::utils::Parallel::CommState:
[legend]

Public Member Functions

Construction and Destruction
 CommState ()=default
 
 CommState (const CommState &)=delete
 
CommStateoperator= (const CommState &)=delete
 
 CommState (CommState &&) noexcept
 BEGIN CommState.
 
CommStateoperator= (CommState &&) noexcept
 
 ~CommState () noexcept
 Frees the communicator if allowed.
 
Communicator Access
Rank rank () const
 Returns the current rank in comm.
 
int size () const
 Returns size of comm.
 
bool isNull () const
 Returns weather the comm is NULL.
 
Misc
void synchronize () const
 
void print (std::ostream &out) const
 pretty printer for comms
 

Static Public Member Functions

Factory functions
static CommStatePtr world ()
 returns a commstate containing MPI_COMM_WORLD
 
static CommStatePtr null ()
 returns an blank commstate representing MPI_COMM_NULL
 
static CommStatePtr self ()
 returns the commstate representing MPI_COMM_SELF
 
static CommStatePtr fromComm (Communicator comm)
 returns the commstate representing comm
 
static CommStatePtr fromExtern (Communicator comm)
 

Public Attributes

Communicator comm = MPI_COMM_NULL
 The native communicator that represents this state.
 
CommStatePtr parent = nullptr
 A shared pointer to the parent CommState.
 
bool _owning = true
 Whether this state owns the communicator and has to free it.
 

Detailed Description

Represents a Communicator state based on a parent state An object of this type owns it communicator and will free it at the end of its lifetime. It also owns the CommState it originated from (parent) via shared ownership.

Definition at line 41 of file Parallel.hpp.

Constructor & Destructor Documentation

◆ CommState() [1/3]

precice::utils::Parallel::CommState::CommState ( )
default

◆ CommState() [2/3]

precice::utils::Parallel::CommState::CommState ( const CommState & )
delete

◆ CommState() [3/3]

precice::utils::Parallel::CommState::CommState ( Parallel::CommState && other)
noexcept

BEGIN CommState.

Definition at line 25 of file Parallel.cpp.

◆ ~CommState()

precice::utils::Parallel::CommState::~CommState ( )
noexcept

Frees the communicator if allowed.

Definition at line 42 of file Parallel.cpp.

Member Function Documentation

◆ fromComm()

Parallel::CommStatePtr precice::utils::Parallel::CommState::fromComm ( Communicator comm)
static

returns the commstate representing comm

Definition at line 112 of file Parallel.cpp.

◆ fromExtern()

Parallel::CommStatePtr precice::utils::Parallel::CommState::fromExtern ( Communicator comm)
static

returns the commstate representing an extern comm

Attention
This state is not owning and does not call free on comm!
See also
_owning

Definition at line 119 of file Parallel.cpp.

◆ isNull()

bool precice::utils::Parallel::CommState::isNull ( ) const

Returns weather the comm is NULL.

Definition at line 80 of file Parallel.cpp.

◆ null()

Parallel::CommStatePtr precice::utils::Parallel::CommState::null ( )
static

returns an blank commstate representing MPI_COMM_NULL

Definition at line 98 of file Parallel.cpp.

◆ operator=() [1/2]

Parallel::CommState & precice::utils::Parallel::CommState::operator= ( Parallel::CommState && other)
noexcept

Definition at line 33 of file Parallel.cpp.

◆ operator=() [2/2]

CommState & precice::utils::Parallel::CommState::operator= ( const CommState & )
delete

◆ print()

void precice::utils::Parallel::CommState::print ( std::ostream & out) const

pretty printer for comms

Definition at line 127 of file Parallel.cpp.

◆ rank()

int precice::utils::Parallel::CommState::rank ( ) const

Returns the current rank in comm.

Definition at line 51 of file Parallel.cpp.

Here is the call graph for this function:

◆ self()

Parallel::CommStatePtr precice::utils::Parallel::CommState::self ( )
static

returns the commstate representing MPI_COMM_SELF

Definition at line 103 of file Parallel.cpp.

◆ size()

int precice::utils::Parallel::CommState::size ( ) const

Returns size of comm.

Definition at line 60 of file Parallel.cpp.

Here is the call graph for this function:

◆ synchronize()

void precice::utils::Parallel::CommState::synchronize ( ) const

Synchronizes all processes in the communicator

Attention
This is a collective operation and has to be called by every rank in the communicator comm!

Definition at line 70 of file Parallel.cpp.

Here is the call graph for this function:

◆ world()

Parallel::CommStatePtr precice::utils::Parallel::CommState::world ( )
static

returns a commstate containing MPI_COMM_WORLD

Definition at line 89 of file Parallel.cpp.

Member Data Documentation

◆ _owning

bool precice::utils::Parallel::CommState::_owning = true

Whether this state owns the communicator and has to free it.

Definition at line 49 of file Parallel.hpp.

◆ comm

Communicator precice::utils::Parallel::CommState::comm = MPI_COMM_NULL

The native communicator that represents this state.

Definition at line 43 of file Parallel.hpp.

◆ parent

CommStatePtr precice::utils::Parallel::CommState::parent = nullptr

A shared pointer to the parent CommState.

Definition at line 46 of file Parallel.hpp.


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