Loading...
Searching...
No Matches
ParRunControl Class Reference

Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc. Also handles cleanup of parallel (or serial) jobs. More...

#include <parRun.H>

Public Member Functions

constexpr ParRunControl () noexcept
 Default construct.
 ~ParRunControl ()
 Destructor. Shutdown (finalize) MPI as required.
int dryRun () const noexcept
 Return the dry-run level (default: 0).
void incrDryRun (int i=1) noexcept
 Increase the dry-run level.
int dryRun (int level) noexcept
 Change dry-run level, returns old value.
int verbose () const noexcept
 Return the verbosity level (default: 0).
void incrVerbose (int i=1) noexcept
 Increase the verbosity level.
int verbose (int level) noexcept
 Change verbosity level, returns old value.
bool parRun () const noexcept
 True if this is (or will be) a parallel run.
bool parRun (bool on) noexcept
 Set as parallel run on/off, return the previous value.
bool distributed () const noexcept
 True if a parallel run and uses distributed roots.
void distributed (bool on) noexcept
 Set use of distributed roots, but only if actually parallel.
bool threads () const noexcept
 True if MPI threads are desired (default: false).
void threads (bool on) noexcept
 Set preference for use of MPI threads.
void runPar (int &argc, char **&argv)
 Initialize UPstream for a parallel run.

Detailed Description

Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc. Also handles cleanup of parallel (or serial) jobs.

Note
In the meantime the class name may be slightly misleading.

Definition at line 48 of file parRun.H.

Constructor & Destructor Documentation

◆ ParRunControl()

ParRunControl ( )
inlineconstexprnoexcept

Default construct.

Definition at line 85 of file parRun.H.

References Foam::noexcept.

◆ ~ParRunControl()

~ParRunControl ( )
inline

Destructor. Shutdown (finalize) MPI as required.

Definition at line 98 of file parRun.H.

References Foam::endl(), Foam::Info, Foam::infoDetailLevel, Foam::InfoErr, and UPstream::shutdown().

Here is the call graph for this function:

Member Function Documentation

◆ dryRun() [1/2]

int dryRun ( ) const
inlinenoexcept

Return the dry-run level (default: 0).

Definition at line 115 of file parRun.H.

References Foam::noexcept.

◆ incrDryRun()

void incrDryRun ( int i = 1)
inlinenoexcept

Increase the dry-run level.

Definition at line 120 of file parRun.H.

References Foam::noexcept.

◆ dryRun() [2/2]

int dryRun ( int level)
inlinenoexcept

Change dry-run level, returns old value.

Definition at line 125 of file parRun.H.

◆ verbose() [1/2]

int verbose ( ) const
inlinenoexcept

Return the verbosity level (default: 0).

Definition at line 135 of file parRun.H.

References Foam::noexcept.

◆ incrVerbose()

void incrVerbose ( int i = 1)
inlinenoexcept

Increase the verbosity level.

Definition at line 140 of file parRun.H.

References Foam::noexcept.

◆ verbose() [2/2]

int verbose ( int level)
inlinenoexcept

Change verbosity level, returns old value.

Definition at line 145 of file parRun.H.

◆ parRun() [1/2]

bool parRun ( ) const
inlinenoexcept

True if this is (or will be) a parallel run.

Definition at line 158 of file parRun.H.

References Foam::noexcept.

◆ parRun() [2/2]

bool parRun ( bool on)
inlinenoexcept

Set as parallel run on/off, return the previous value.

Use with extreme caution if runPar() has already been called.

Definition at line 169 of file parRun.H.

◆ distributed() [1/2]

bool distributed ( ) const
inlinenoexcept

True if a parallel run and uses distributed roots.

Definition at line 179 of file parRun.H.

References Foam::noexcept.

◆ distributed() [2/2]

void distributed ( bool on)
inlinenoexcept

Set use of distributed roots, but only if actually parallel.

Definition at line 187 of file parRun.H.

◆ threads() [1/2]

bool threads ( ) const
inlinenoexcept

True if MPI threads are desired (default: false).

Definition at line 195 of file parRun.H.

References Foam::noexcept.

◆ threads() [2/2]

void threads ( bool on)
inlinenoexcept

Set preference for use of MPI threads.

Definition at line 203 of file parRun.H.

◆ runPar()

void runPar ( int & argc,
char **& argv )
inline

Initialize UPstream for a parallel run.

Definition at line 211 of file parRun.H.

References Foam::endl(), UPstream::exit(), Foam::Info, Foam::infoDetailLevel, Foam::InfoErr, and UPstream::init().

Here is the call graph for this function:

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