caseInfo Class Reference

Collects and writes case information to file. More...

Inheritance diagram for caseInfo:
Collaboration diagram for caseInfo:

Public Types

enum  writeFormat { dict, json }
 Write format enumeration. More...
 
enum  lookupMode { none, warn, error }
 Lookup mode enumeration. More...
 

Public Member Functions

 TypeName ("caseInfo")
 Runtime type information. More...
 
 caseInfo (const word &name, const Time &runTime, const dictionary &dict)
 Construct from Time and dictionary. More...
 
virtual ~caseInfo ()=default
 Destructor. More...
 
virtual bool read (const dictionary &dict)
 Read the controls. More...
 
virtual bool execute ()
 Execute, does nothing. More...
 
virtual bool write ()
 Write the caseInfo. More...
 
- Public Member Functions inherited from stateFunctionObject
 stateFunctionObject (const word &name, const Time &runTime)
 Construct from components. More...
 
virtual ~stateFunctionObject ()=default
 Destructor. More...
 
dictionarypropertyDict ()
 Return access to the property dictionary. More...
 
bool foundProperty (const word &entryName) const
 Return true if the property exists. More...
 
void clearTrigger ()
 Remove the trigger index from the properties. More...
 
label getTrigger () const
 Get the current trigger index. More...
 
bool setTrigger (const label triggeri)
 Set new trigger index. More...
 
bool getDict (const word &entryName, dictionary &dict) const
 Set dictionary, return true if set. More...
 
bool getObjectDict (const word &objectName, const word &entryName, dictionary &dict) const
 Set dictionary from named object, return true if set. More...
 
template<class Type >
Type getProperty (const word &entryName, const Type &defaultValue=Type(Zero)) const
 Retrieve generic property. More...
 
template<class Type >
bool getProperty (const word &entryName, Type &value) const
 Set generic property, return true if set. 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=Type(Zero)) const
 Retrieve generic property from named object. More...
 
template<class Type >
bool getObjectProperty (const word &objectName, const word &entryName, Type &value) const
 Set generic property from named object, return true if set. More...
 
template<class Type >
void setObjectProperty (const word &objectName, const word &entryName, const Type &value)
 Add generic property from named object. More...
 
bool getObjectResultDict (const word &objectName, dictionary &dict) const
 
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=Type(Zero)) const
 Retrieve result. More...
 
template<class Type >
Type getObjectResult (const word &objectName, const word &entryName, const Type &defaultValue=Type(Zero)) const
 Retrieve result from named object. More...
 
template<class Type >
bool getObjectResult (const word &objectName, const word &entryName, Type &value) const
 Set result from named object, return true if set. 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...
 
wordList objectResultEntries () const
 Retrieve the result entries. More...
 
wordList objectResultEntries (const word &objectName) const
 Return result entries for named object. More...
 
void writeResultEntries (Ostream &os) const
 Write the results entries for all objects to stream. More...
 
void writeResultEntries (const word &objectName, Ostream &os) const
 Write the results entries for named object to stream. More...
 
void writeAllResultEntries (Ostream &os) const
 Write the results entries for all objects to stream. More...
 
- Public Member Functions inherited from timeFunctionObject
 timeFunctionObject (const word &name, const Time &runTime)
 Construct from Time. More...
 
virtual ~timeFunctionObject ()=default
 Destructor. More...
 
const Timetime () const
 Return time database. More...
 
objectRegistrystoredObjects ()
 Write access to the output objects ("functionObjectObjects") registered on Time. More...
 
const objectRegistrystoredObjects () const
 Const access to the output objects ("functionObjectObjects") registered on Time. More...
 
- Public Member Functions inherited from functionObject
 declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict))
 
 functionObject (const word &name, const bool withNamePrefix=defaultUseNamePrefix)
 Construct from components. More...
 
autoPtr< functionObjectclone () const
 Return clone. More...
 
virtual ~functionObject ()=default
 Destructor. More...
 
virtual const wordtype () const =0
 Runtime type information. More...
 
const wordname () const noexcept
 Return the name of this functionObject. More...
 
bool useNamePrefix () const noexcept
 Return the flag for adding a scoping name prefix. More...
 
bool useNamePrefix (bool on) noexcept
 Modify the flag for adding a scoping name prefix. More...
 
virtual bool execute (const label subIndex)
 Execute using the specified subIndex. More...
 
virtual bool end ()
 Called when Time::run() determines that the time-loop exits. More...
 
virtual bool adjustTimeStep ()
 Called at the end of Time::adjustDeltaT() if adjustTime is true. More...
 
virtual bool filesModified () const
 Did any file get changed during execution? More...
 
virtual void updateMesh (const mapPolyMesh &mpm)
 Update for changes of mesh. More...
 
virtual void movePoints (const polyMesh &mesh)
 Update for changes of mesh. 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)
 Construct from objectRegistry, prefix, fileName and read options from dictionary. More...
 
 writeFile (const writeFile &wf)
 Construct copy. More...
 
virtual ~writeFile ()=default
 Destructor. 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 canWriteToFile () const
 Flag to allow writing to the file. More...
 
virtual bool canResetFile () const
 Flag to allow resetting the 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 Member Functions

 caseInfo (const caseInfo &)=delete
 No copy construct. More...
 
void operator= (const caseInfo &)=delete
 No copy assignment. More...
 
void writeMeta (dictionary &dict) const
 Write case meta data. More...
 
void writeRegisteredDicts (const objectRegistry &obr, dictionary &dict, dictionary &dictionaries) const
 Write registered dictionaries. More...
 
void writeFileDicts (dictionary &dict, dictionary &dictionaries) const
 Write file-based dictionaries. More...
 
void writeFunctionObjects (dictionary &dict) const
 Write function object results. More...
 
void writeMeshStats (const polyMesh &mesh, dictionary &dict) const
 Write mesh statistics. More...
 
void writePatches (const fvMesh &mesh, dictionary &dict) const
 Write mesh patches. More...
 
- Protected Member Functions inherited from stateFunctionObject
const functionObjects::propertiesstateDict () const
 Return a const reference to the state dictionary. More...
 
functionObjects::propertiesstateDict ()
 Return non-const access to the state dictionary. More...
 
 stateFunctionObject (const stateFunctionObject &)=delete
 No copy construct. More...
 
void operator= (const stateFunctionObject &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from timeFunctionObject
void clearOutputObjects (const wordList &objNames)
 Remove specified items from "functionObjectObjects". More...
 
 timeFunctionObject (const timeFunctionObject &)=delete
 No copy construct. More...
 
void operator= (const timeFunctionObject &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from functionObject
word scopedName (const word &name) const
 Return a scoped (prefixed) name. 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...
 
fileName filePath (const fileName &fName) const
 Return the full path for the supplied file name. More...
 
virtual autoPtr< OFstreamnewFile (const fileName &fName) const
 Return autoPtr to a new file using file name. More...
 
virtual autoPtr< OFstreamnewFileAtTime (const word &name, scalar timeValue) const
 Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamnewFileAtStartTime (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...
 
virtual autoPtr< OFstreamcreateFile (const word &name, scalar timeValue) const
 Deprecated(2022-09) Return autoPtr to a new file for a given time. More...
 
virtual autoPtr< OFstreamcreateFile (const word &name) const
 Deprecated(2022-09) Return autoPtr to a new file using the simulation start time. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from functionObject
static autoPtr< functionObjectNew (const word &name, const Time &runTime, const dictionary &dict)
 Select from dictionary, based on its "type" entry. More...
 
- Public Attributes inherited from functionObject
bool log
 Flag to write log into Info. More...
 
- Static Public Attributes inherited from functionObject
static int debug
 Flag to execute debug content. More...
 
static bool postProcess
 Global post-processing mode switch. More...
 
static bool defaultUseNamePrefix
 Global default for useNamePrefix. More...
 
static word outputPrefix
 Directory prefix. More...
 
- Static Public Attributes inherited from writeFile
static label addChars = 8
 Additional characters for writing. More...
 
- Protected Attributes inherited from timeFunctionObject
const Timetime_
 Reference to the time database. 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_
 Flag to update the header, e.g. on mesh changes. Default is true. More...
 
bool writtenHeader_
 Flag to identify whether the header has been written. More...
 
bool useUserTime_
 Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true. More...
 
scalar startTime_
 Start time value. More...
 

Detailed Description

Collects and writes case information to file.

Example of function object specification:

caseInfo
{
    type            caseInfo;
    libs            (utilityFunctionObjects);

    // Warn when entries are not found
    lookupMode  warn; // none | warn | error;

    // Write format
    writeFormat json; //  dictionary | json;

    dictionaries
    {
        USolver // User-specified names
        {
            // Look up using registered name
            name        "fvSolution";

            // Optionally limit to specific entries
            include
            (
                "solvers/U/solver"
            );
        }
        fvSchemes
        {
            name        "fvSchemes";

            // include all entries by default
        }
        timeScheme
        {
            name        "fvSchemes";

            include
            (
                "/ddtSchemes/default"
            );
        }

        turbulence
        {
            name        "turbulenceProperties";

            // include all entries by default
        }
        controlDict
        {
            // Look up using file path
            path        "<case>/system/controlDict";

            include
            (
                "application"
                "deltaT"
                "startTime"
                "endTime"
            );
        }
    }

    functionObjects (minMax1); // v2306 only
}

Where the entries comprise:

Property Description Required Default
type Type name: caseInfo yes
lookupMode Lookup mode no warn
writeFormat Write format yes
dictionaries Dictionaries to process no <none>
functionObjects Function objects to process no <none>
See also
Foam::functionObject Foam::timeFunctionObject
Source files

Definition at line 165 of file caseInfo.H.

Member Enumeration Documentation

◆ writeFormat

enum writeFormat
strong

Write format enumeration.

Enumerator
dict 
json 

Definition at line 177 of file caseInfo.H.

◆ lookupMode

enum lookupMode
strong

Lookup mode enumeration.

Enumerator
none 
warn 
error 

Definition at line 186 of file caseInfo.H.

Constructor & Destructor Documentation

◆ caseInfo() [1/2]

caseInfo ( const caseInfo )
protecteddelete

No copy construct.

◆ caseInfo() [2/2]

caseInfo ( const word name,
const Time runTime,
const dictionary dict 
)

Construct from Time and dictionary.

Definition at line 391 of file caseInfo.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~caseInfo()

virtual ~caseInfo ( )
virtualdefault

Destructor.

Member Function Documentation

◆ operator=()

void operator= ( const caseInfo )
protecteddelete

No copy assignment.

◆ writeMeta()

void writeMeta ( dictionary dict) const
protected

Write case meta data.

Definition at line 166 of file caseInfo.C.

References dictionary::add(), and UPstream::nProcs().

Here is the call graph for this function:

◆ writeRegisteredDicts()

void writeRegisteredDicts ( const objectRegistry obr,
dictionary dict,
dictionary dictionaries 
) const
protected

◆ writeFileDicts()

void writeFileDicts ( dictionary dict,
dictionary dictionaries 
) const
protected

Write file-based dictionaries.

Definition at line 224 of file caseInfo.C.

References Foam::constant::electromagnetic::e, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dictionary::findEntry(), io(), IOobjectOption::MUST_READ, word::null, path(), and dictionary::subDictOrAdd().

Here is the call graph for this function:

◆ writeFunctionObjects()

void writeFunctionObjects ( dictionary dict) const
protected

Write function object results.

Definition at line 280 of file caseInfo.C.

References dictionary::add(), and dict.

Here is the call graph for this function:

◆ writeMeshStats()

void writeMeshStats ( const polyMesh mesh,
dictionary dict 
) const
protected

Write mesh statistics.

Definition at line 300 of file caseInfo.C.

References dict, and mesh.

◆ writePatches()

void writePatches ( const fvMesh mesh,
dictionary dict 
) const
protected

Write mesh patches.

Definition at line 364 of file caseInfo.C.

References dictionary::add(), dict, fld, mesh, pbm, and pp().

Here is the call graph for this function:

◆ TypeName()

TypeName ( "caseInfo"  )

Runtime type information.

◆ read()

bool read ( const dictionary dict)
virtual

Read the controls.

Reimplemented from writeFile.

Definition at line 408 of file caseInfo.C.

References dict, writeFile::read(), and functionObject::read().

Here is the call graph for this function:

◆ execute()

bool execute ( )
virtual

Execute, does nothing.

Implements functionObject.

Definition at line 427 of file caseInfo.C.

◆ write()

bool write ( )
virtual

Write the caseInfo.

Implements functionObject.

Definition at line 433 of file caseInfo.C.

References dict, Foam::endl(), filePtr, Foam::Info, UPstream::master(), mesh, meshes(), Foam::name(), os(), dictionary::sortedToc(), dictionary::subDictOrAdd(), and JSONformatter::writeDict().

Here is the call graph for this function:

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