averageCondition Class Reference

Average run time condition - satisfied when average does not change by more than a given value. More...

Inheritance diagram for averageCondition:
[legend]
Collaboration diagram for averageCondition:
[legend]

Public Member Functions

 TypeName ("average")
 Runtime type information. More...
 
 averageCondition (const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
 Constructor. More...
 
virtual ~averageCondition ()=default
 Destructor. More...
 
virtual bool apply ()
 Apply the condition. More...
 
virtual void write ()
 Write. More...
 
virtual void reset ()
 Reset. More...
 
- Public Member Functions inherited from runTimeCondition
 TypeName ("runTimeCondition")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, runTimeCondition, dictionary,(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state),(name, obr, dict, state))
 Declare runtime constructor selection table. More...
 
 runTimeCondition (const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
 Constructor. More...
 
virtual ~runTimeCondition ()=default
 Destructor. More...
 
virtual const wordname () const
 Return the condition name. More...
 
virtual bool active () const
 Return the active flag. More...
 
virtual label groupID () const
 Return the group index. More...
 
virtual bool apply ()=0
 Apply the condition. More...
 
virtual void write ()=0
 Write. More...
 
virtual void reset ()=0
 Reset. More...
 
- Public Member Functions inherited from valueAverageBase
 valueAverageBase (const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state, const bool writeToFile=true)
 Construct from Time and dictionary. More...
 
 valueAverageBase (const valueAverageBase &)=delete
 No copy construct. More...
 
void operator= (const valueAverageBase &)=delete
 No copy assignment. More...
 
virtual ~valueAverageBase ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read the field value average data. More...
 
virtual bool calculate (dictionary &dict)
 Calculate the averages. More...
 
- Public Member Functions inherited from writeFile
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true)
 Construct from objectRegistry, prefix, fileName. More...
 
 writeFile (const objectRegistry &obr, const fileName &prefix, const word &name, const dictionary &dict, const bool writeToFile=true)
 
 writeFile (const writeFile &wf)
 Construct copy. More...
 
virtual ~writeFile ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read. More...
 
virtual OFstreamfile ()
 Return access to the file (if only 1) More...
 
virtual bool writeToFile () const
 Flag to allow writing to file. More...
 
virtual bool canWriteHeader () const
 Flag to allow writing the header. More...
 
virtual label charWidth () const
 Return width of character stream output. More...
 
virtual void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
virtual void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
virtual void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
virtual void writeCurrentTime (Ostream &os) const
 Write the current time to stream. More...
 
virtual void writeBreak (Ostream &os) const
 Write a break marker to the stream. More...
 
template<class Type >
void writeHeaderValue (Ostream &os, const string &property, const Type &value) const
 Write a (commented) header property and value pair. More...
 
template<class Type >
void writeValue (Ostream &os, const Type &val) const
 Write a given value to stream with the space delimiter. More...
 

Protected Attributes

label nIterStartUp_
 Number of start-up iterations before allowing satisfied checks. More...
 
label iter_
 Current iteration count. More...
 
- Protected Attributes inherited from runTimeCondition
word name_
 Condition name. More...
 
const objectRegistryobr_
 Reference to the object registry. More...
 
stateFunctionObjectstate_
 State. More...
 
bool active_
 On/off switch. More...
 
dictionaryconditionDict_
 Reference to the condition dictionary. More...
 
label groupID_
 Group index - if applied, all conditions in a group must be. More...
 
- Protected Attributes inherited from valueAverageBase
bool resetOnRestart_
 Reset the averaging process on restart. More...
 
windowType windowType_
 Window type. More...
 
stateFunctionObjectstate_
 Reference to the state functionObject. More...
 
word functionObjectName_
 Name of function object to retrieve data from. More...
 
wordList fieldNames_
 List of fields on which to operate. More...
 
scalar tolerance_
 Optional tolerance to check for converged results. More...
 
scalar window_
 Averaging window. More...
 
List< scalar > totalTime_
 Average time per field. More...
 
- Protected Attributes inherited from writeFile
const objectRegistryfileObr_
 Reference to the region objectRegistry. More...
 
const fileName prefix_
 Prefix. More...
 
word fileName_
 Name of file. More...
 
autoPtr< OFstreamfilePtr_
 File pointer. More...
 
label writePrecision_
 Write precision. More...
 
bool writeToFile_
 Flag to enable/disable writing to file. More...
 
bool updateHeader_
 
bool writtenHeader_
 Flag to identify whether the header has been written. More...
 
bool useUserTime_
 
scalar startTime_
 Start time value. More...
 

Additional Inherited Members

- Public Types inherited from valueAverageBase
enum class  windowType : uint8_t { NONE , APPROXIMATE , EXACT }
 Averaging window types. More...
 
- Static Public Member Functions inherited from runTimeCondition
static autoPtr< runTimeConditionNew (const word &conditionName, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
 Selector. More...
 
- Public Attributes inherited from runTimeCondition
Switch log
 Switch to send output to Info. More...
 
- Static Public Attributes inherited from valueAverageBase
static const Enum< windowTypewindowTypeNames
 Names for windowType enumeration. More...
 
- Static Public Attributes inherited from writeFile
static label addChars = 8
 Additional characters for writing. More...
 
- Protected Member Functions inherited from runTimeCondition
dictionarysetConditionDict ()
 Set the condition dictionary (create if necessary) More...
 
const dictionaryconditionDict () const
 Return const access to the conditions dictionary. More...
 
dictionaryconditionDict ()
 Return non-const access to the conditions dictionary. More...
 
- Protected Member Functions inherited from valueAverageBase
template<class Type , class Type2 = Type>
bool calc (const label fieldi, bool &converged, dictionary &dict)
 Templated function to calculate the average. More...
 
virtual void writeFileHeader (Ostream &os) const
 Output file header information. More...
 
virtual void readState (dictionary &dict)
 Read state from dictionary. More...
 
virtual void writeState (dictionary &dict)
 Write state to dictionary for restarts. More...
 
virtual void resetState (dictionary &dict)
 Reset state. More...
 
- Protected Member Functions inherited from writeFile
void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
fileName baseFileDir () const
 Return the base directory for output. More...
 
fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Return autoPtr to a new file using the simulation start time. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
void operator= (const writeFile &)=delete
 No copy assignment. More...
 

Detailed Description

Average run time condition - satisfied when average does not change by more than a given value.

See also
Source files

Definition at line 60 of file averageCondition.H.

Constructor & Destructor Documentation

◆ averageCondition()

averageCondition ( const word name,
const objectRegistry obr,
const dictionary dict,
stateFunctionObject state 
)

Constructor.

Definition at line 47 of file averageCondition.C.

References runTimeCondition::conditionDict(), averageCondition::iter_, Foam::name(), dictionary::readIfPresent(), and valueAverageBase::readState().

Here is the call graph for this function:

◆ ~averageCondition()

virtual ~averageCondition ( )
virtualdefault

Destructor.

Member Function Documentation

◆ TypeName()

TypeName ( "average"  )

Runtime type information.

◆ apply()

bool apply ( )
virtual

Apply the condition.

Implements runTimeCondition.

Definition at line 70 of file averageCondition.C.

References Foam::decrIndent(), Foam::incrIndent(), and Foam::Info.

Here is the call graph for this function:

◆ write()

void write ( )
virtual

Write.

Implements runTimeCondition.

Definition at line 92 of file averageCondition.C.

References dictionary::set(), and valueAverageBase::writeState().

Here is the call graph for this function:

◆ reset()

void reset ( )
virtual

Reset.

Implements runTimeCondition.

Definition at line 102 of file averageCondition.C.

References valueAverageBase::resetState().

Here is the call graph for this function:

Member Data Documentation

◆ nIterStartUp_

label nIterStartUp_
protected

Number of start-up iterations before allowing satisfied checks.

Definition at line 70 of file averageCondition.H.

◆ iter_

label iter_
protected

Current iteration count.

Definition at line 73 of file averageCondition.H.

Referenced by averageCondition::averageCondition().


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