timeControl Class Reference

General time dependent execution controller. The execution parameters are given by the "Control" and (optionally) the "Interval", with the default being to execute every time-step. More...

Public Types

enum  timeControls {
  ocNone = 0 , ocAlways , ocTimeStep , ocWriteTime ,
  ocRunTime , ocAdjustableRunTime , ocClockTime , ocCpuTime ,
  ocOnEnd
}
 The time control options. More...
 

Public Member Functions

 timeControl (const Time &runTime, const word &prefix="")
 Construct a control object that executes each time-step. More...
 
 timeControl (const Time &runTime, const dictionary &dict, const word &prefix)
 
 ~timeControl ()=default
 Destructor. More...
 
void read (const dictionary &dict)
 Read from dictionary. More...
 
const Timetime () const
 Return the Time. More...
 
const wordname () const
 Return the name (prefix) More...
 
const wordtype () const
 Return the named control enumeration as its 'type'. More...
 
void clear ()
 Reset control to 'always' - ie, no intervention. More...
 
timeControls control () const
 Return the control enumeration. More...
 
bool always () const
 Return true if the control will always execute - ie, no intervention. More...
 
bool execute ()
 Flag to indicate whether to execute. More...
 
scalar interval () const
 Return interval. More...
 
label executionIndex () const
 Return the index of the previous execution. More...
 

Static Public Member Functions

static bool entriesPresent (const dictionary &dict, const word &prefix)
 Identify if a timeControl object is present in the dictionary. More...
 

Detailed Description

General time dependent execution controller. The execution parameters are given by the "Control" and (optionally) the "Interval", with the default being to execute every time-step.

For example, an "execute" control every tenth write time:

    executeControl  writeTime;
    executeInterval 10;

See Foam::functionObject for a list of known selection types.

Source files

Definition at line 61 of file timeControl.H.

Member Enumeration Documentation

◆ timeControls

The time control options.

Enumerator
ocNone 

No execution.

ocAlways 

Always execute.

ocTimeStep 

Execution coupled to time-step (default)

ocWriteTime 

Execution coupled to write-time.

ocRunTime 

Use run-time for execution.

ocAdjustableRunTime 

Currently identical to "runTime".

ocClockTime 

Use clock time for execution.

ocCpuTime 

Use CPU time for execution.

ocOnEnd 

Execute on end of run.

Definition at line 66 of file timeControl.H.

Constructor & Destructor Documentation

◆ timeControl() [1/2]

timeControl ( const Time runTime,
const word prefix = "" 
)
explicit

Construct a control object that executes each time-step.

For places where a time control object is required, but should not actually intervene.

Definition at line 56 of file timeControl.C.

◆ timeControl() [2/2]

timeControl ( const Time runTime,
const dictionary dict,
const word prefix 
)

Construct from Time object, dictionary and the prefix for the control name.

Definition at line 71 of file timeControl.C.

References dict, and timeControl::read().

Here is the call graph for this function:

◆ ~timeControl()

~timeControl ( )
default

Destructor.

Member Function Documentation

◆ entriesPresent()

bool entriesPresent ( const dictionary dict,
const word prefix 
)
static

Identify if a timeControl object is present in the dictionary.

Matches prefix + "Control"

Definition at line 86 of file timeControl.C.

References dict, and dictionary::found().

Referenced by timeControl::entriesPresent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

void read ( const dictionary dict)

Read from dictionary.

Definition at line 109 of file timeControl.C.

References dict, Foam::endl(), dictionary::found(), dictionary::get(), dictionary::getOrDefault(), IOWarningInFunction, Foam::nl, and error::warnAboutAge().

Referenced by timeControl::timeControl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ time()

const Foam::Time & time ( ) const
inline

Return the Time.

Definition at line 31 of file timeControlI.H.

◆ name()

const Foam::word & name ( ) const
inline

Return the name (prefix)

Definition at line 37 of file timeControlI.H.

◆ type()

const Foam::word & type ( ) const
inline

Return the named control enumeration as its 'type'.

Definition at line 43 of file timeControlI.H.

◆ clear()

void clear ( )

Reset control to 'always' - ie, no intervention.

Definition at line 100 of file timeControl.C.

◆ control()

Foam::timeControl::timeControls control ( ) const
inline

Return the control enumeration.

Definition at line 49 of file timeControlI.H.

◆ always()

bool always ( ) const
inline

Return true if the control will always execute - ie, no intervention.

Definition at line 55 of file timeControlI.H.

◆ execute()

bool execute ( )

Flag to indicate whether to execute.

Definition at line 170 of file timeControl.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and Foam::returnReduce().

Here is the call graph for this function:

◆ interval()

Foam::scalar interval ( ) const
inline

Return interval.

Definition at line 65 of file timeControlI.H.

◆ executionIndex()

Foam::label executionIndex ( ) const
inline

Return the index of the previous execution.

Definition at line 71 of file timeControlI.H.


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