Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
fieldMinMax Class Reference

This function object calculates the value and position of scalar minimim and maximum for a list of user-specified fields. For variables with a rank greater than zero, either the min/max of a component value or the magnitude is reported. When operating in parallel, the processor owning the value is also given. More...

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

Public Types

enum  modeType { mdMag, mdCmpt }
 

Public Member Functions

 TypeName ("fieldMinMax")
 Runtime type information. More...
 
 fieldMinMax (const word &name, const objectRegistry &, const dictionary &, const bool loadFromFiles=false)
 Construct for given objectRegistry and dictionary. More...
 
virtual ~fieldMinMax ()
 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...
 
template<class Type >
void calcMinMaxFields (const word &fieldName, const modeType &mode)
 Calculate the field min/max. 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 output (const word &fieldName, const word &outputName, const vector &minC, const vector &maxC, const label minProcI, const label maxProcI, const Type &minValue, const Type &maxValue)
 Helper function to write the output. More...
 
virtual void writeFileHeader (Ostream &os) const
 Output file header information. More...
 
 fieldMinMax (const fieldMinMax &)
 Disallow default bitwise copy construct. More...
 
void operator= (const fieldMinMax &)
 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...
 
Switch log_
 Switch to send output to Info as well. More...
 
Switch writeLocation_
 Switch to write location of min/max values. More...
 
modeType mode_
 Mode for min/max - only applicable for ranks > 0. More...
 
wordList fieldSet_
 Fields to assess min/max. 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...
 

Static Protected Attributes

static const NamedEnum< modeType, 2 > modeTypeNames_
 Mode type names. 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 value and position of scalar minimim and maximum for a list of user-specified fields. For variables with a rank greater than zero, either the min/max of a component value or the magnitude is reported. When operating in parallel, the processor owning the value is also given.

Example of function object specification:

fieldMinMax1
{
    type        fieldMinMax;
    functionObjectLibs ("libfieldFunctionObjects.so");
    ...
    writeToFile yes;
    log         yes;
    writeLocation yes;
    mode        magnitude;
    fields      (U p);
}


Function object usage

Property Description Required Default value
type type name: fieldMinMax yes
writeToFile write min/max data to file no yes
log write min/max data to standard output no yes
writeLocation write location of the min/max value no yes
mode calculation mode: magnitude or component no magnitude
fields list of fields to process yes

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

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

Definition at line 136 of file fieldMinMax.H.

Member Enumeration Documentation

◆ modeType

enum modeType
Enumerator
mdMag 
mdCmpt 

Definition at line 145 of file fieldMinMax.H.

Constructor & Destructor Documentation

◆ fieldMinMax() [1/2]

fieldMinMax ( const fieldMinMax )
protected

Disallow default bitwise copy construct.

◆ fieldMinMax() [2/2]

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

Construct for given objectRegistry and dictionary.

Allow the possibility to load fields from files

Definition at line 94 of file fieldMinMax.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~fieldMinMax()

~fieldMinMax ( )
virtual

Destructor.

Definition at line 120 of file fieldMinMax.C.

Member Function Documentation

◆ output()

void output ( const word fieldName,
const word outputName,
const vector minC,
const vector maxC,
const label  minProcI,
const label  maxProcI,
const Type &  minValue,
const Type &  maxValue 
)
protected

Helper function to write the output.

Definition at line 33 of file fieldMinMaxTemplates.C.

References Foam::endl(), Foam::Info, maxValue, minValue, and Foam::nl.

Here is the call graph for this function:

◆ writeFileHeader()

void writeFileHeader ( Ostream os) const
protectedvirtual

Output file header information.

Definition at line 54 of file fieldMinMax.C.

References Foam::endl(), fieldMinMax::fieldSet_, forAll, UPstream::parRun(), functionObjectFile::writeCommented(), functionObjectFile::writeHeader(), fieldMinMax::writeLocation_, and functionObjectFile::writeTabbed().

Here is the call graph for this function:

◆ operator=()

void operator= ( const fieldMinMax )
protected

Disallow default bitwise assignment.

◆ TypeName()

TypeName ( "fieldMinMax"  )

Runtime type information.

◆ read()

void read ( const dictionary dict)
virtual

Read the field min/max data.

Definition at line 126 of file fieldMinMax.C.

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

Here is the call graph for this function:

◆ execute()

void execute ( )
virtual

Execute, currently does nothing.

Definition at line 141 of file fieldMinMax.C.

◆ end()

void end ( )
virtual

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

Definition at line 147 of file fieldMinMax.C.

◆ timeSet()

void timeSet ( )
virtual

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

Definition at line 153 of file fieldMinMax.C.

◆ calcMinMaxFields()

void calcMinMaxFields ( const word fieldName,
const modeType mode 
)

Calculate the field min/max.

Definition at line 112 of file fieldMinMaxTemplates.C.

References GeometricField::boundaryField(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::findMax(), Foam::findMin(), forAll, Foam::mag(), maxValue, mesh, minValue, Foam::mode(), and modeTypeNames_.

Here is the call graph for this function:

◆ write()

void write ( )
virtual

Write the fieldMinMax.

Definition at line 159 of file fieldMinMax.C.

References Foam::endl(), forAll, Foam::Info, Foam::nl, and Foam::type().

Here is the call graph for this function:

◆ updateMesh()

virtual void updateMesh ( const mapPolyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 251 of file fieldMinMax.H.

◆ movePoints()

virtual void movePoints ( const polyMesh )
inlinevirtual

Update for changes of mesh.

Definition at line 255 of file fieldMinMax.H.

Field Documentation

◆ modeTypeNames_

const Foam::NamedEnum< Foam::fieldMinMax::modeType, 2 > modeTypeNames_
staticprotected

Mode type names.

Definition at line 157 of file fieldMinMax.H.

◆ obr_

const objectRegistry& obr_
protected

Reference to the database.

Definition at line 160 of file fieldMinMax.H.

◆ log_

Switch log_
protected

Switch to send output to Info as well.

Definition at line 163 of file fieldMinMax.H.

◆ writeLocation_

Switch writeLocation_
protected

Switch to write location of min/max values.

Definition at line 166 of file fieldMinMax.H.

Referenced by fieldMinMax::writeFileHeader().

◆ mode_

modeType mode_
protected

Mode for min/max - only applicable for ranks > 0.

Definition at line 169 of file fieldMinMax.H.

◆ fieldSet_

wordList fieldSet_
protected

Fields to assess min/max.

Definition at line 172 of file fieldMinMax.H.

Referenced by fieldMinMax::writeFileHeader().


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