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...

Public Member Functions

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

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 ( )
inlinenoexcept

Default construct.

Definition at line 85 of file parRun.H.

◆ ~ParRunControl()

~ParRunControl ( )
inline

Destructor. Shutdown (finalize) MPI as required.

Definition at line 98 of file parRun.H.

References Foam::endl(), Foam::Info, 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 113 of file parRun.H.

◆ incrDryRun()

void incrDryRun ( int  level = 1)
inlinenoexcept

Increase the dry-run level.

Definition at line 118 of file parRun.H.

◆ dryRun() [2/2]

int dryRun ( const int  level)
inlinenoexcept

Change dry-run level, returns old value.

Definition at line 123 of file parRun.H.

◆ verbose() [1/2]

int verbose ( ) const
inlinenoexcept

Return the verbosity level (default: 0)

Definition at line 133 of file parRun.H.

◆ incrVerbose()

void incrVerbose ( int  level = 1)
inlinenoexcept

Increase the verbosity level.

Definition at line 138 of file parRun.H.

◆ verbose() [2/2]

int verbose ( const int  level)
inlinenoexcept

Change verbosity level, returns old value.

Definition at line 143 of file parRun.H.

◆ parRun() [1/2]

bool parRun ( ) const
inlinenoexcept

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

Definition at line 156 of file parRun.H.

◆ parRun() [2/2]

bool parRun ( const 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 167 of file parRun.H.

◆ distributed() [1/2]

bool distributed ( ) const
inlinenoexcept

True if a parallel run and uses distributed roots.

Definition at line 177 of file parRun.H.

◆ distributed() [2/2]

void distributed ( bool  on)
inlinenoexcept

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

Definition at line 185 of file parRun.H.

◆ threads() [1/2]

bool threads ( ) const
inlinenoexcept

True if MPI threads are desired (default: false)

Definition at line 193 of file parRun.H.

◆ threads() [2/2]

void threads ( bool  on)
inlinenoexcept

Set preference for use of MPI threads.

Definition at line 201 of file parRun.H.

◆ runPar()

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

Initialize UPstream for a parallel run.

Definition at line 209 of file parRun.H.

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

Here is the call graph for this function:

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