Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
fieldValueDelta Class Reference

This function object provides applies an operation to the output of two fieldValue function objects. More...

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

Public Types

enum  operationType {
  opAdd, opSubtract, opMin, opMax,
  opAverage
}
 Operation type enumeration. More...
 

Public Member Functions

 TypeName ("fieldValueDelta")
 Run-time type information. More...
 
 fieldValueDelta (const word &name, const objectRegistry &obr, const dictionary &dict, const bool loadFromFiles=false)
 Construct from components. More...
 
virtual ~fieldValueDelta ()
 Destructor. More...
 
virtual void read (const dictionary &)
 Read from dictionary. More...
 
virtual void write ()
 Calculate and write. More...
 
virtual void execute ()
 Execute. More...
 
virtual void end ()
 Execute the 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 updateMesh (const mapPolyMesh &)
 Update mesh. More...
 
virtual void movePoints (const polyMesh &)
 Move points. 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...
 

Static Public Attributes

static const NamedEnum< operationType, 5 > operationTypeNames_
 Operation type names. More...
 
- Static Public Attributes inherited from functionObjectFile
static const word outputPrefix = "postProcessing"
 Directory prefix. More...
 
static label addChars = 7
 Additional characters for writing. More...
 

Protected Member Functions

virtual void writeFileHeader (Ostream &os) const
 Output file header information. 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...
 

Private Member Functions

template<class Type >
void apply (const word &resultType, const word &name1, const word &name2, const word &entryName1, const word &entryName2, bool &found)
 Templated function to apply the operation. More...
 

Private Attributes

const objectRegistryobr_
 Database this class is registered to. More...
 
bool loadFromFiles_
 Flag to indicate to load from files. More...
 
Switch log_
 Switch to send output to Info as well as to file. More...
 
operationType operation_
 Operation to apply to values. More...
 
autoPtr< fieldValuesource1Ptr_
 Field value source object 1. More...
 
autoPtr< fieldValuesource2Ptr_
 Field value source object 2. More...
 

Additional Inherited Members

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

Detailed Description

This function object provides applies an operation to the output of two fieldValue function objects.

The operation is applied to all results of each fieldValue object. Accordingly, each object must generate the same number and type of results.

Example of function object specification:

fieldValueDelta1
{
    type            fieldValueDelta;
    functionObjectLibs ("libfieldFunctionObjects.so");
    operation       subtract;

    source1
    {
        ...
    }
    source2
    {
        ...
    }
}


Function object usage

Property Description Required Default value
type type name: fieldValueDelta yes


The operation is one of:

add : add
subtract : subtract
min : minimum
max : maximum
average : average
See also
Foam::fieldValue
Source files

Definition at line 129 of file fieldValueDelta.H.

Member Enumeration Documentation

◆ operationType

Operation type enumeration.

Enumerator
opAdd 
opSubtract 
opMin 
opMax 
opAverage 

Definition at line 136 of file fieldValueDelta.H.

Constructor & Destructor Documentation

◆ fieldValueDelta()

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

Construct from components.

Definition at line 91 of file fieldValueDelta.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~fieldValueDelta()

~fieldValueDelta ( )
virtual

Destructor.

Definition at line 117 of file fieldValueDelta.C.

Member Function Documentation

◆ apply()

void apply ( const word resultType,
const word name1,
const word name2,
const word entryName1,
const word entryName2,
bool &  found 
)
private

Templated function to apply the operation.

Definition at line 30 of file fieldValueDeltaTemplates.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, found, Foam::Info, Foam::max(), Foam::min(), and Foam::tab.

Here is the call graph for this function:

◆ writeFileHeader()

void writeFileHeader ( Ostream os) const
protectedvirtual

◆ TypeName()

TypeName ( "fieldValueDelta"  )

Run-time type information.

◆ read()

void read ( const dictionary dict)
virtual

Read from dictionary.

Definition at line 123 of file fieldValueDelta.C.

References dict, fieldValue::New(), and functionObjectFile::read().

Here is the call graph for this function:

◆ write()

void write ( )
virtual

Calculate and write.

Definition at line 158 of file fieldValueDelta.C.

◆ execute()

void execute ( )
virtual

Execute.

Definition at line 164 of file fieldValueDelta.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, found, Foam::Info, Foam::nl, List::size(), and Foam::type().

Here is the call graph for this function:

◆ end()

void end ( )
virtual

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

Definition at line 240 of file fieldValueDelta.C.

◆ timeSet()

void timeSet ( )
virtual

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

Definition at line 246 of file fieldValueDelta.C.

◆ updateMesh()

void updateMesh ( const mapPolyMesh )
virtual

Update mesh.

Definition at line 252 of file fieldValueDelta.C.

◆ movePoints()

void movePoints ( const polyMesh )
virtual

Move points.

Definition at line 258 of file fieldValueDelta.C.

Field Documentation

◆ operationTypeNames_

const NamedEnum< fieldValues::fieldValueDelta::operationType, 5 > operationTypeNames_
static

Operation type names.

Definition at line 146 of file fieldValueDelta.H.

Referenced by fieldValueDelta::writeFileHeader().

◆ obr_

const objectRegistry& obr_
private

Database this class is registered to.

Definition at line 154 of file fieldValueDelta.H.

◆ loadFromFiles_

bool loadFromFiles_
private

Flag to indicate to load from files.

Definition at line 157 of file fieldValueDelta.H.

◆ log_

Switch log_
private

Switch to send output to Info as well as to file.

Definition at line 160 of file fieldValueDelta.H.

◆ operation_

operationType operation_
private

Operation to apply to values.

Definition at line 163 of file fieldValueDelta.H.

Referenced by fieldValueDelta::writeFileHeader().

◆ source1Ptr_

autoPtr<fieldValue> source1Ptr_
private

Field value source object 1.

Definition at line 166 of file fieldValueDelta.H.

Referenced by fieldValueDelta::writeFileHeader().

◆ source2Ptr_

autoPtr<fieldValue> source2Ptr_
private

Field value source object 2.

Definition at line 169 of file fieldValueDelta.H.

Referenced by fieldValueDelta::writeFileHeader().


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