This function object 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, bool readNow=true) | |
Construct for given objectRegistry and dictionary. More... | |
virtual | ~codedFunctionObject () |
Destructor. More... | |
functionObject & | redirectFunctionObject () const |
Dynamically compiled functionObject. More... | |
virtual bool | start () |
Called at the start of the time-loop. More... | |
virtual bool | execute (const bool forceWrite) |
Called at each ++ or += of the time-loop. forceWrite overrides the. More... | |
virtual bool | end () |
Called when Time::run() determines that the time-loop exits. More... | |
virtual bool | timeSet () |
Called when time was set at the end of the Time::operator++. More... | |
virtual bool | read (const dictionary &) |
Read and set the function object if its data have changed. More... | |
virtual void | updateMesh (const mapPolyMesh &) |
Update mesh. More... | |
virtual void | movePoints (const polyMesh &) |
Move points. More... | |
![]() | |
virtual const word & | type () const =0 |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &t, const dictionary &dict),(name, t, dict)) | |
functionObject (const word &name) | |
Construct from components. More... | |
autoPtr< functionObject > | clone () const |
Return clone. More... | |
virtual | ~functionObject () |
Destructor. More... | |
virtual const word & | name () const |
Name. More... | |
virtual bool | adjustTimeStep () |
Called at the end of Time::adjustDeltaT() if adjustTime is true. 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 &redirectType) const |
Update library as required. More... | |
Protected Attributes | |
const Time & | time_ |
Reference to the time database. More... | |
dictionary | dict_ |
Input dictionary. More... | |
word | redirectType_ |
string | codeData_ |
string | codeRead_ |
string | codeExecute_ |
string | codeEnd_ |
string | codeTimeSet_ |
autoPtr< functionObject > | redirectFunctionObjectPtr_ |
Underlying functionObject. More... | |
Private Member Functions | |
codedFunctionObject (const codedFunctionObject &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const codedFunctionObject &) |
Disallow default bitwise assignment. More... | |
Additional Inherited Members | |
![]() | |
static autoPtr< functionObject > | New (const word &name, const Time &, const dictionary &) |
Select from dictionary, based on its "type" entry. More... | |
![]() | |
static int | debug |
This function object provides a general interface to enable dynamic code compilation.
The entries are code : c++; upon functionObject::write() codeInclude : include files codeOptions : include paths; inserted into EXE_INC in Make/options codeLibs : link line; inserted into LIB_LIBS in Make/options
codeExecute : c++;upon functionObject::execute(); codeRead : c++; upon functionObject::read(); codeEnd : c++; upon functionObject::end(); codeData : c++; local member data (null constructed); codeTimeSet : c++; upon functionObject::timeSet(); localCode : c++; local static functions
Example of function object specification:
difference { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; // Name of on-the-fly generated functionObject redirectType writeMagU; code #{ // Lookup U const volVectorField& U = mesh().lookupObject<volVectorField>("U"); // Write mag(U).write(); } }
Definition at line 91 of file codedFunctionObject.H.
|
private |
Disallow default bitwise copy construct.
codedFunctionObject | ( | const word & | name, |
const Time & | time, | ||
const dictionary & | dict, | ||
bool | readNow = true |
||
) |
Construct for given objectRegistry and dictionary.
Allow the possibility to load fields from files
Definition at line 124 of file codedFunctionObject.C.
References Foam::read().
|
virtual |
Destructor.
Definition at line 145 of file codedFunctionObject.C.
|
protectedvirtual |
Get the loaded dynamic libraries.
Implements codedBase.
Definition at line 97 of file codedFunctionObject.C.
References codedFunctionObject::time_.
|
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 103 of file codedFunctionObject.C.
References Foam::name().
|
protectedvirtual |
Implements codedBase.
Definition at line 109 of file codedFunctionObject.C.
|
protectedvirtual |
Implements codedBase.
Definition at line 115 of file codedFunctionObject.C.
|
private |
Disallow default bitwise assignment.
TypeName | ( | "coded" | ) |
Runtime type information.
Foam::functionObject & redirectFunctionObject | ( | ) | const |
Dynamically compiled functionObject.
Definition at line 152 of file codedFunctionObject.C.
References functionObject::New(), and dictionary::set().
|
virtual |
Called at the start of the time-loop.
Implements functionObject.
Definition at line 170 of file codedFunctionObject.C.
|
virtual |
Called at each ++ or += of the time-loop. forceWrite overrides the.
outputControl behaviour.
Implements functionObject.
Definition at line 177 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 184 of file codedFunctionObject.C.
|
virtual |
Called when time was set at the end of the Time::operator++.
Reimplemented from functionObject.
Definition at line 191 of file codedFunctionObject.C.
|
virtual |
Read and set the function object if its data have changed.
Implements functionObject.
Definition at line 198 of file codedFunctionObject.C.
References dynamicCodeContext::addLineDirective(), dict, Foam::stringOps::inplaceExpand(), dictionary::lookup(), dictionary::lookupEntryPtr(), dictionaryName::name(), entry::startLineNumber(), entry::stream(), and Foam::stringOps::trim().
|
virtual |
|
virtual |
|
protected |
Reference to the time database.
Definition at line 101 of file codedFunctionObject.H.
Referenced by codedFunctionObject::libs().
|
protected |
Input dictionary.
Definition at line 104 of file codedFunctionObject.H.
|
protected |
Definition at line 106 of file codedFunctionObject.H.
|
protected |
Definition at line 108 of file codedFunctionObject.H.
|
protected |
Definition at line 109 of file codedFunctionObject.H.
|
protected |
Definition at line 110 of file codedFunctionObject.H.
|
protected |
Definition at line 111 of file codedFunctionObject.H.
|
protected |
Definition at line 112 of file codedFunctionObject.H.
|
mutableprotected |
Underlying functionObject.
Definition at line 115 of file codedFunctionObject.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.