![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
An MPI worker class that wraps MPI_Init and MPI_Finalize. More...
#include <worker.hpp>
Public Member Functions | |
| MPI_Worker (int argc, char *argv[], MPI_Comm comm=MPI_COMM_WORLD, bool verbose=true) | |
| Constructs an MPI worker instance and initializes MPI if needed. | |
| ~MPI_Worker () | |
| Destroys the MPI worker instance and finalizes MPI if it owns it. | |
| int | get_rank () const |
| Returns the rank of this worker process in the MPI communicator. | |
| int | get_num_ranks () const |
| Returns the number of processes in the MPI communicator. | |
| void | mute () |
| Mutes the standard output. | |
| void | unmute () |
| Unmutes the standard output. | |
An MPI worker class that wraps MPI_Init and MPI_Finalize.
This class represents a single worker process in a MPI application. It wraps the MPI_Init and MPI_Finalize calls and provides helper functions to get the rank and number of processes in the MPI communicator.
|
inline |
Constructs an MPI worker instance and initializes MPI if needed.
This constructor initializes MPI (if not already initialized) and retrieves the rank and number of processes in the given MPI communicator. If the rank is not zero, the standard output is muted to avoid duplicate output.
| argc | Pointer to the number of command-line arguments |
| argv | Pointer to an array of command-line arguments |
| comm | MPI communicator to use |
| verbose | Print initialization message if true (default: true) |

|
inline |
Destroys the MPI worker instance and finalizes MPI if it owns it.
This destructor finalizes MPI only if this worker initialized it.
|
inline |
Returns the number of processes in the MPI communicator.
|
inline |
Returns the rank of this worker process in the MPI communicator.
|
inline |
Mutes the standard output.
This function sets the failbit of the standard output stream, effectively muting it.

|
inline |
Unmutes the standard output.
This function clears the failbit of the standard output stream, effectively unmuting it.