Public Member Functions | Protected Member Functions | Protected Attributes
valueAverage Class Reference

This function object calculates the average value from the output of function objects that generate singular values. More...

Inheritance diagram for valueAverage:
Inheritance graph
[legend]
Collaboration diagram for valueAverage:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("valueAverage")
 Runtime type information. More...
 
 valueAverage (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
 Constructor. More...
 
virtual ~valueAverage ()
 Destructor. More...
 
virtual void read (const dictionary &)
 Read the field min/max data. More...
 
virtual void execute ()
 Execute, currently does nothing. More...
 
virtual void end ()
 Execute at the final time-loop, currently does nothing. More...
 
virtual void timeSet ()
 Called when time was set at the end of the Time::operator++. More...
 
virtual void write ()
 Write the fieldMinMax. More...
 
virtual void updateMesh (const mapPolyMesh &)
 Update for changes of mesh. More...
 
virtual void movePoints (const polyMesh &)
 Update for changes of mesh. More...
 
- Public Member Functions inherited from functionObjectState
 functionObjectState (const objectRegistry &obr, const word &name)
 Construct from components. More...
 
virtual ~functionObjectState ()
 Destructor. More...
 
const wordname () const
 Return the name. More...
 
bool active () const
 Return the active flag. More...
 
const IOdictionarystateDict () const
 Return access to the state dictionary. More...
 
dictionarypropertyDict ()
 Return access to the property dictionary. More...
 
template<class Type >
bool setActive ()
 Set the active status by querying objectRegistry type. More...
 
bool foundProperty (const word &entryName) const
 Return true if the property exists. More...
 
template<class Type >
Type getProperty (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve generic property. More...
 
template<class Type >
void getProperty (const word &entryName, Type &value) const
 Retrieve generic property. More...
 
template<class Type >
void setProperty (const word &entryName, const Type &value)
 Add generic property. More...
 
template<class Type >
Type getObjectProperty (const word &objectName, const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve generic property from named object. More...
 
template<class Type >
void getObjectProperty (const word &objectName, const word &entryName, Type &value) const
 Retrieve generic property from named object. More...
 
template<class Type >
void setObjectProperty (const word &objectName, const word &entryName, const Type &value)
 Add generic property from named object. More...
 
template<class Type >
void setResult (const word &entryName, const Type &value)
 Add result. More...
 
template<class Type >
void setObjectResult (const word &objectName, const word &entryName, const Type &value)
 Add result from named object. More...
 
template<class Type >
Type getResult (const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve result. More...
 
template<class Type >
Type getObjectResult (const word &objectName, const word &entryName, const Type &defaultValue=pTraits< Type >::zero) const
 Retrieve result from named object. More...
 
template<class Type >
void getObjectResult (const word &objectName, const word &entryName, Type &value) const
 Retrieve result from named object. More...
 
word resultType (const word &entryName) const
 Retrieve the result type. More...
 
word objectResultType (const word &objectName, const word &entryName) const
 Return the type of result. More...
 
List< wordobjectResultEntries () const
 Retrieve the result entries. More...
 
List< wordobjectResultEntries (const word &objectName) const
 Return result entries for named object. More...
 
- Public Member Functions inherited from functionObjectFile
 functionObjectFile (const objectRegistry &obr, const word &prefix)
 Construct null. More...
 
 functionObjectFile (const objectRegistry &obr, const word &prefix, const word &fileName, const dictionary &dict)
 Construct from components and read options from dictionary. More...
 
virtual ~functionObjectFile ()
 Destructor. More...
 
void read (const dictionary &dict)
 Read. More...
 
OFstreamfile ()
 Return access to the file (if only 1) More...
 
bool writeToFile () const
 Return true if can write to file. More...
 
void writeCommented (Ostream &os, const string &str) const
 Write a commented string to stream. More...
 
void writeTabbed (Ostream &os, const string &str) const
 Write a tabbed string to stream. More...
 
void writeHeader (Ostream &os, const string &str) const
 Write a commented header to stream. More...
 
void writeTime (Ostream &os) const
 Write the current time to 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...
 
label charWidth () const
 Return width of character stream output. More...
 

Protected Member Functions

template<class Type >
void calc (const word &fieldName, const word &meanName, const scalar alpha, const scalar beta, bool &processed)
 Templated function to calculate the average. More...
 
virtual void writeFileHeader (Ostream &os) const
 Output file header information. More...
 
 valueAverage (const valueAverage &)
 Disallow default bitwise copy construct. More...
 
void operator= (const valueAverage &)
 Disallow default bitwise assignment. More...
 
- Protected Member Functions inherited from functionObjectState
 functionObjectState (const functionObjectState &)
 Disallow default bitwise copy construct. More...
 
void operator= (const functionObjectState &)
 Disallow default bitwise assignment. More...
 
- Protected Member Functions inherited from functionObjectFile
virtual void initStream (Ostream &os) const
 Initialise the output stream for writing. More...
 
virtual fileName baseFileDir () const
 Return the base directory for output. More...
 
virtual fileName baseTimeDir () const
 Return the base directory for the current time value. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Return an autoPtr to a new file. More...
 
virtual void resetFile (const word &name)
 Reset internal file pointer to new file with new name. More...
 
virtual Omanip< int > valueWidth (const label offset=0) const
 Return the value width when writing to stream with optional offset. More...
 
 functionObjectFile (const functionObjectFile &)
 Disallow default bitwise copy construct. More...
 
void operator= (const functionObjectFile &)
 Disallow default bitwise assignment. More...
 

Protected Attributes

const objectRegistryobr_
 Reference to the database. More...
 
word functionObjectName_
 Name of function object to retrueve data from. More...
 
wordList fieldNames_
 List of fields on which to operate. More...
 
const scalar window_
 Averaging window. More...
 
List< scalar > totalTime_
 Average time per field. More...
 
Switch resetOnRestart_
 Reset the averaging process on restart flag. More...
 
Switch log_
 Switch to send output to Info as well. More...
 
- Protected Attributes inherited from functionObjectState
const word name_
 Name of model. More...
 
bool active_
 Flag to indicate whether the object is active. More...
 
IOdictionarystateDict_
 Reference to the state dictionary. More...
 
- Protected Attributes inherited from functionObjectFile
bool writeToFile_
 Flag to enable/disable writing to file. More...
 

Additional Inherited Members

- Static Public Attributes inherited from functionObjectFile
static const word outputPrefix = "postProcessing"
 Directory prefix. More...
 
static label addChars = 7
 Additional characters for writing. More...
 

Detailed Description

This function object calculates the average value from the output of function objects that generate singular values.

Example of function object specification:

valueAverage1
{
    type        valueAverage;
    functionObjectLibs ("libfieldFunctionObjects.so");
    ...
    writeToFile yes;
    log         yes;
    functionObjectName forceCoeffs1;
    fields      (Cm Cd Cl);
    window      0.5;
}


Function object usage

Property Description Required Default value
type type name: valueAverage yes
writeToFile write average data to file no yes
log write average data to standard output no yes
fields list of fields to process yes

Output data is written to the file <timeDir>/valueAverage.dat

See also
Foam::functionObject Foam::functionObjectFile Foam::functionObjectState Foam::OutputFilterFunctionObject
Source files

Definition at line 120 of file valueAverage.H.

Constructor & Destructor Documentation

◆ valueAverage() [1/2]

valueAverage ( const valueAverage )
protected

Disallow default bitwise copy construct.

◆ valueAverage() [2/2]

valueAverage ( const word name,
const objectRegistry obr,
const dictionary dict,
const bool  loadFromFiles = false 
)

Constructor.

Definition at line 54 of file valueAverage.C.

References dict, forAll, dictionary::found(), dictionary::lookup(), Foam::readScalar(), and dictionary::subDict().

Here is the call graph for this function:

◆ ~valueAverage()

~valueAverage ( )
virtual

Destructor.

Definition at line 91 of file valueAverage.C.

Member Function Documentation

◆ calc()

void calc ( const word fieldName,
const word meanName,
const scalar  alpha,
const scalar  beta,
bool &  processed 
)
protected

Templated function to calculate the average.

Definition at line 30 of file valueAverageTemplates.C.

References Foam::constant::atomic::alpha, beta(), Foam::Info, Foam::nl, and Foam::tab.

Here is the call graph for this function:

◆ writeFileHeader()

void writeFileHeader ( Ostream os) const
protectedvirtual

Output file header information.

Definition at line 39 of file valueAverage.C.

References Foam::endl(), valueAverage::fieldNames_, forAll, functionObjectFile::writeCommented(), functionObjectFile::writeHeader(), and functionObjectFile::writeTabbed().

Here is the call graph for this function:

◆ operator=()

void operator= ( const valueAverage )
protected

Disallow default bitwise assignment.

◆ TypeName()

TypeName ( "valueAverage"  )

Runtime type information.

◆ read()

void read ( const dictionary dict)
virtual

Read the field min/max data.

Definition at line 97 of file valueAverage.C.

References dict, dictionary::lookupOrDefault(), and functionObjectFile::read().

Here is the call graph for this function:

◆ execute()

void execute ( )
virtual

Execute, currently does nothing.

Definition at line 108 of file valueAverage.C.

References Foam::constant::atomic::alpha, DynamicList::append(), beta(), Foam::endl(), forAll, Foam::Info, Foam::nl, Foam::tab, Foam::type(), and WarningInFunction.

Here is the call graph for this function:

◆ end()

void end ( )
virtual

Execute at the final time-loop, currently does nothing.

Definition at line 181 of file valueAverage.C.

◆ timeSet()

void timeSet ( )
virtual

Called when time was set at the end of the Time::operator++.

Definition at line 187 of file valueAverage.C.

◆ write()

void write ( )
virtual

Write the fieldMinMax.

Definition at line 193 of file valueAverage.C.

◆ updateMesh()

virtual void updateMesh ( const mapPolyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 210 of file valueAverage.H.

◆ movePoints()

virtual void movePoints ( const polyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 214 of file valueAverage.H.

Field Documentation

◆ obr_

const objectRegistry& obr_
protected

Reference to the database.

Definition at line 130 of file valueAverage.H.

◆ functionObjectName_

word functionObjectName_
protected

Name of function object to retrueve data from.

Definition at line 133 of file valueAverage.H.

◆ fieldNames_

wordList fieldNames_
protected

List of fields on which to operate.

Definition at line 136 of file valueAverage.H.

Referenced by valueAverage::writeFileHeader().

◆ window_

const scalar window_
protected

Averaging window.

Definition at line 139 of file valueAverage.H.

◆ totalTime_

List<scalar> totalTime_
protected

Average time per field.

Definition at line 142 of file valueAverage.H.

◆ resetOnRestart_

Switch resetOnRestart_
protected

Reset the averaging process on restart flag.

Definition at line 145 of file valueAverage.H.

◆ log_

Switch log_
protected

Switch to send output to Info as well.

Definition at line 148 of file valueAverage.H.


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