Provides a general interface to enable dynamic code compilation. More...
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... | |
virtual | ~codedFunctionObject () |
Destructor. More... | |
functionObject & | redirectFunctionObject () const |
Dynamically compiled functionObject. 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... | |
![]() | |
virtual const word & | type () 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) | |
Construct from components. More... | |
autoPtr< functionObject > | clone () const |
Return clone. More... | |
virtual | ~functionObject () |
Destructor. More... | |
const word & | name () const |
Return the name of this functionObject. More... | |
virtual bool | setTimeStep () |
Called by Time::setDeltaT(). Allows the function object to override. More... | |
virtual scalar | timeToNextWrite () |
Called by Time::adjustTimeStep(). Allows the function object to. 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... | |
![]() | |
ClassName ("codedBase") | |
Runtime type information. More... | |
codedBase () | |
Construct null. More... | |
virtual | ~codedBase () |
Destructor. More... | |
Protected Member Functions | |
virtual dlLibraryTable & | libs () const |
Get the loaded dynamic libraries. More... | |
virtual void | prepare (dynamicCode &, const dynamicCodeContext &) const |
Adapt the context for the current object. More... | |
virtual string | description () const |
virtual void | clearRedirect () const |
virtual const dictionary & | codeDict () const |
![]() | |
void | updateLibrary (const word &name) const |
Update library as required. More... | |
Protected Attributes | |
const Time & | time_ |
Reference to the time database. More... | |
dictionary | dict_ |
Input dictionary. More... | |
word | name_ |
string | codeData_ |
string | codeRead_ |
string | codeExecute_ |
string | codeWrite_ |
string | codeEnd_ |
autoPtr< functionObject > | redirectFunctionObjectPtr_ |
Underlying functionObject. More... | |
Additional Inherited Members | |
![]() | |
static autoPtr< functionObject > | New (const word &name, const Time &, const dictionary &) |
Select from dictionary, based on its "type" entry. More... | |
![]() | |
Switch | log |
Switch write log to Info. More... | |
![]() | |
static int | debug |
static bool | postProcess |
Global post-processing mode switch. More... | |
Provides a general interface to enable dynamic code compilation.
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(); |
codeExecute | : | c++; upon functionObject::execute(); |
codeWrite | : | c++; upon functionObject::write() |
codeEnd | : | c++; upon functionObject::end(); |
Example of function object specification:
difference { libs ("libutilityFunctionObjects.so"); type coded; // Name of on-the-fly generated functionObject name writeMagU; codeWrite #{ // Lookup U const volVectorField& U = mesh().lookupObject<volVectorField>("U"); // Write mag(U)().write(); #}; }
Definition at line 121 of file codedFunctionObject.H.
codedFunctionObject | ( | const word & | name, |
const Time & | time, | ||
const dictionary & | dict | ||
) |
Construct from Time and dictionary.
Definition at line 120 of file codedFunctionObject.C.
References Foam::read().
|
virtual |
Destructor.
Definition at line 140 of file codedFunctionObject.C.
|
protectedvirtual |
Get the loaded dynamic libraries.
Implements codedBase.
Definition at line 93 of file codedFunctionObject.C.
|
protectedvirtual |
Adapt the context for the current object.
Implements codedBase.
Definition at line 53 of file codedFunctionObject.C.
References dynamicCode::addCompileFile(), dynamicCode::addCopyFile(), dynamicCodeContext::libs(), dynamicCodeContext::options(), dynamicCode::setFilterVariable(), and dynamicCode::setMakeOptions().
|
protectedvirtual |
Implements codedBase.
Definition at line 99 of file codedFunctionObject.C.
References Foam::name().
|
protectedvirtual |
Implements codedBase.
Definition at line 105 of file codedFunctionObject.C.
|
protectedvirtual |
Implements codedBase.
Definition at line 111 of file codedFunctionObject.C.
TypeName | ( | "coded" | ) |
Runtime type information.
Foam::functionObject & redirectFunctionObject | ( | ) | const |
Dynamically compiled functionObject.
Definition at line 146 of file codedFunctionObject.C.
References functionObject::New(), and dictionary::set().
|
virtual |
Called at each ++ or += of the time-loop.
postProcess overrides the usual executeControl behaviour and forces execution (used in post-processing mode)
Implements functionObject.
Definition at line 164 of file codedFunctionObject.C.
|
virtual |
Called at each ++ or += of the time-loop.
postProcess overrides the usual writeControl behaviour and forces writing always (used in post-processing mode)
Implements functionObject.
Definition at line 171 of file codedFunctionObject.C.
|
virtual |
Called when Time::run() determines that the time-loop exits.
By default it simply calls execute().
Reimplemented from functionObject.
Definition at line 178 of file codedFunctionObject.C.
|
virtual |
Read and set the function object if its data have changed.
Reimplemented from functionObject.
Definition at line 185 of file codedFunctionObject.C.
References dynamicCodeContext::addLineDirective(), Foam::endl(), dictionary::found(), Foam::stringOps::inplaceExpand(), IOWarningInFunction, dictionary::lookup(), dictionary::lookupEntryPtr(), dictionaryName::name(), Foam::nl, entry::startLineNumber(), entry::stream(), and Foam::stringOps::trim().
|
protected |
Reference to the time database.
Definition at line 131 of file codedFunctionObject.H.
|
protected |
Input dictionary.
Definition at line 134 of file codedFunctionObject.H.
|
protected |
Definition at line 136 of file codedFunctionObject.H.
|
protected |
Definition at line 138 of file codedFunctionObject.H.
|
protected |
Definition at line 139 of file codedFunctionObject.H.
|
protected |
Definition at line 140 of file codedFunctionObject.H.
|
protected |
Definition at line 141 of file codedFunctionObject.H.
|
protected |
Definition at line 142 of file codedFunctionObject.H.
|
mutableprotected |
Underlying functionObject.
Definition at line 145 of file codedFunctionObject.H.