30#define MPI_COMM_NULL nullptr
255struct fmt::formatter<
precice::utils::Parallel::CommState> : ostream_formatter {
Utility class for managing MPI operations.
static bool isMPIInitialized()
Return true if MPI is initialized.
static InitializationState _initState
static void finalizeTestingMPI()
Unconditionally finalizes MPI environment.
static void resetCommState()
static void finalizeOrCleanupMPI()
Finalized a managed MPI environment or cleans up after an non-managed session.
static CommStatePtr current()
Returns an owning pointer to the current CommState.
static Rank getProcessRank()
static void resetManagedMPI()
static void pushState(CommStatePtr newState)
InitializationState
Kind of initialization that took place.
@ Unmanaged
preCICE manages the lifetime of the MPI environment
@ Managed
Communicator was provided by the user.
@ Provided
Not initialized.
@ Testing
preCICE was initialized in an existing MPI environment
static CommStatePtr _currentState
static bool _mpiInitializedByPrecice
Flag to saveguard against reinitializing MPI, which is forbidden.
static void initializeOrDetectMPI(std::optional< Communicator > userProvided=std::nullopt)
static void initializeTestingMPI(int *argc, char ***argv)
static void splitCommunicator(std::optional< int > group=std::nullopt)
Splits and creates a local MPI communicator according to groupName.
static logging::Logger _log
std::ostream & operator<<(std::ostream &out, const RangePreview< Iter > &rp)
Allows streaming of RangePreview objects.
Main namespace of the precice library.
static CommStatePtr world()
returns a commstate containing MPI_COMM_WORLD
void print(std::ostream &out) const
pretty printer for comms
int size() const
Returns size of comm.
Rank rank() const
Returns the current rank in comm.
static CommStatePtr fromComm(Communicator comm)
returns the commstate representing comm
static CommStatePtr self()
returns the commstate representing MPI_COMM_SELF
static CommStatePtr null()
returns an blank commstate representing MPI_COMM_NULL
CommState(const CommState &)=delete
CommState & operator=(const CommState &)=delete
bool _owning
Whether this state owns the communicator and has to free it.
bool isNull() const
Returns weather the comm is NULL.
Communicator comm
The native communicator that represents this state.
CommStatePtr parent
A shared pointer to the parent CommState.
static CommStatePtr fromExtern(Communicator comm)