codedFunctionObject Class Reference

Provides a general interface to enable dynamic code compilation. More...

Inheritance diagram for codedFunctionObject:
Collaboration diagram for codedFunctionObject:

Public Member Functions

 TypeName ("coded")
 Runtime type information. More...
 
 codedFunctionObject (const word &name, const Time &time, const dictionary &dict)
 Construct from Time and dictionary. More...
 
 codedFunctionObject (const codedFunctionObject &)=delete
 Disallow default bitwise copy construction. More...
 
virtual ~codedFunctionObject ()
 Destructor. More...
 
virtual wordList fields () const
 Return the list of fields required. More...
 
virtual bool execute ()
 Called at each ++ or += of the time-loop. More...
 
virtual bool write ()
 Called at each ++ or += of the time-loop. More...
 
virtual bool end ()
 Called when Time::run() determines that the time-loop exits. More...
 
virtual bool read (const dictionary &)
 Read and set the function object if its data have changed. More...
 
void operator= (const codedFunctionObject &)=delete
 Disallow default bitwise assignment. More...
 
- Public Member Functions inherited from functionObject
 ClassName ("functionObject")
 
virtual const wordtype () const =0
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict))
 
 functionObject (const word &name, const Time &runTime)
 Construct from components. More...
 
 functionObject (const word &name, const Time &runTime, const dictionary &dict)
 Construct from dictionary. More...
 
autoPtr< functionObjectclone () const
 Return clone. More...
 
 functionObject (const functionObject &)=delete
 Disallow default bitwise copy construction. More...
 
virtual ~functionObject ()
 Destructor. More...
 
const wordname () const
 Return the name of this functionObject. More...
 
virtual bool executeAtStart () const
 Return true if the functionObject should be executed at the start. More...
 
virtual scalar timeToNextAction ()
 Called by Time::adjustTimeStep(). Allows the functionObject to. More...
 
virtual scalar maxDeltaT () const
 Return the maximum time-step for stable operation. More...
 
virtual void movePoints (const polyMesh &mesh)
 Update topology using the given map. More...
 
virtual void topoChange (const polyTopoChangeMap &map)
 Update topology using the given map. More...
 
virtual void mapMesh (const polyMeshMap &)
 Update from another mesh using the given map. More...
 
virtual void distribute (const polyDistributionMap &)
 Redistribute or update using the given distribution map. More...
 
void operator= (const functionObject &)=delete
 Disallow default bitwise assignment. More...
 
- Public Member Functions inherited from codedBase
 TypeName ("codedBase")
 Runtime type information. More...
 
 codedBase (const word &name, const dictionary &dict, const wordList &codeKeys, const wordList &codeDictVars)
 Construct from name and dictionary. More...
 
 codedBase (const dictionary &dict, const wordList &codeKeys, const wordList &codeDictVars)
 Construct from dictionary. More...
 
 codedBase (const codedBase &cb)
 Copy constructor. More...
 
virtual ~codedBase ()
 Destructor. More...
 
const wordcodeName () const
 Name of the dynamically generated CodedType. More...
 
string description () const
 Return a description (type + name) for the output. More...
 
word codeTemplateC (const word &baseTypeName) const
 
word codeTemplateH (const word &baseTypeName) const
 
bool updateLibrary (const dictionary &dict) const
 Update library from given updated dictionary as required. More...
 
void read (const dictionary &dict)
 Read the dictionary and update the code. More...
 
void write (Ostream &os) const
 Write the code for restart. More...
 
void operator= (const codedBase &)=delete
 Disallow default bitwise assignment. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from functionObject
static autoPtr< functionObjectNew (const word &name, const Time &, const dictionary &)
 Select from dictionary, based on its "type" entry. More...
 
- Public Attributes inherited from functionObject
Switch log
 Switch write log to Info. More...
 
Switch executeAtStart_
 Switch execute at start time. More...
 
- Static Public Attributes inherited from functionObject
static bool postProcess
 Global post-processing mode switch. More...
 
- Protected Attributes inherited from functionObject
const Timetime_
 Reference to time. More...
 

Detailed Description

Provides a general interface to enable dynamic code compilation.

The entries are:

codeInclude : include files
codeOptions : include paths; inserted into EXE_INC in Make/options
codeLibs : link line; inserted into LIB_LIBS in Make/options
codeData : c++; local member data (null constructed);
localCode : c++; local static functions;
codeRead : c++; upon functionObject::read();
codeFields : c++; upon functionObject::fields();
codeExecute : c++; upon functionObject::execute();
codeWrite : c++; upon functionObject::write()
codeEnd : c++; upon functionObject::end();

Example of function object specification:

    writeMagU
    {
        libs        ("libutilityFunctionObjects.so");

        type coded;

        codeWrite
        #{
            // Lookup U
            const volVectorField& U = mesh().lookupObject<volVectorField>("U");
            // Write
            mag(U)().write();
        #};
    }
See also
Foam::functionObject Foam::codedBase
Source files

Definition at line 125 of file codedFunctionObject.H.

Constructor & Destructor Documentation

◆ codedFunctionObject() [1/2]

codedFunctionObject ( const word name,
const Time time,
const dictionary dict 
)

Construct from Time and dictionary.

Definition at line 136 of file codedFunctionObject.C.

References dict.

◆ codedFunctionObject() [2/2]

Disallow default bitwise copy construction.

◆ ~codedFunctionObject()

~codedFunctionObject ( )
virtual

Destructor.

Definition at line 152 of file codedFunctionObject.C.

Member Function Documentation

◆ TypeName()

TypeName ( "coded"  )

Runtime type information.

◆ fields()

Foam::wordList fields ( ) const
virtual

Return the list of fields required.

Implements functionObject.

Definition at line 170 of file codedFunctionObject.C.

◆ execute()

bool execute ( )
virtual

Called at each ++ or += of the time-loop.

foamPostProcess overrides the usual executeControl behaviour and forces execution (used in post-processing mode)

Implements functionObject.

Definition at line 176 of file codedFunctionObject.C.

◆ write()

bool write ( )
virtual

Called at each ++ or += of the time-loop.

foamPostProcess overrides the usual writeControl behaviour and forces writing always (used in post-processing mode)

Implements functionObject.

Definition at line 182 of file codedFunctionObject.C.

◆ end()

bool end ( )
virtual

Called when Time::run() determines that the time-loop exits.

By default it simply calls execute().

Reimplemented from functionObject.

Definition at line 188 of file codedFunctionObject.C.

◆ read()

bool read ( const dictionary dict)
virtual

Read and set the function object if its data have changed.

Reimplemented from functionObject.

Definition at line 194 of file codedFunctionObject.C.

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

Here is the call graph for this function:

◆ operator=()

void operator= ( const codedFunctionObject )
delete

Disallow default bitwise assignment.


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