Base class for function objects and boundary conditions using dynamic code. More...
Public Member Functions | |
ClassName ("codedBase") | |
Runtime type information. More... | |
codedBase () | |
Construct null. More... | |
virtual | ~codedBase () |
Destructor. More... | |
Protected Member Functions | |
void | updateLibrary (const word &redirectType) const |
Update library as required. More... | |
virtual dlLibraryTable & | libs () const =0 |
Get the loaded dynamic libraries. More... | |
virtual void | prepare (dynamicCode &, const dynamicCodeContext &) const =0 |
Adapt the context for the current object. More... | |
virtual string | description () const =0 |
virtual void | clearRedirect () const =0 |
virtual const dictionary & | codeDict () const =0 |
Private Types | |
typedef void(* | loaderFunctionType) (bool) |
Global loader/unloader function type. More... | |
Private Member Functions | |
void * | loadLibrary (const fileName &libPath, const string &globalFuncName, const dictionary &contextDict) const |
Load specified library and execute globalFuncName(true) More... | |
void | unloadLibrary (const fileName &libPath, const string &globalFuncName, const dictionary &contextDict) const |
Execute globalFuncName(false) and unload specified library. More... | |
void | createLibrary (dynamicCode &, const dynamicCodeContext &) const |
Create library based on the dynamicCodeContext. More... | |
codedBase (const codedBase &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const codedBase &) |
Disallow default bitwise assignment. More... | |
Private Attributes | |
fileName | oldLibPath_ |
Previously loaded library. More... | |
Base class for function objects and boundary conditions using dynamic code.
Definition at line 53 of file codedBase.H.
|
private |
Global loader/unloader function type.
Definition at line 63 of file codedBase.H.
codedBase | ( | ) |
Construct null.
Definition at line 343 of file codedBase.C.
|
virtual |
Destructor.
Definition at line 349 of file codedBase.C.
|
private |
Load specified library and execute globalFuncName(true)
Definition at line 46 of file codedBase.C.
References Foam::dlSym(), Foam::dlSymFound(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::nl.
|
private |
Execute globalFuncName(false) and unload specified library.
Definition at line 114 of file codedBase.C.
References Foam::dlSym(), Foam::dlSymFound(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, and Foam::nl.
|
private |
Create library based on the dynamicCodeContext.
Since the library has only been compiled on the master the
other nodes need to pick this library up through NFS We do this by just polling a few times using the fileModificationSkew.
Definition at line 171 of file codedBase.C.
References dynamicCode::copyOrCreateFiles(), dynamicCodeContext::dict(), Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::fileSize(), dynamicCode::libPath(), dynamicCode::libRelPath(), Foam::nl, Foam::Pout, Foam::reduce(), dynamicCode::reset(), Foam::sleep(), dynamicCode::upToDate(), and dynamicCode::wmakeLibso().
|
private |
Disallow default bitwise assignment.
|
protected |
Update library as required.
Definition at line 282 of file codedBase.C.
References dynamicCode::codeName(), dict, dynamicCodeContext::dict(), Foam::endl(), Foam::Info, dynamicCode::libPath(), dynamicCodeContext::sha1(), and SHA1Digest::str().
|
protectedpure virtual |
Get the loaded dynamic libraries.
Implemented in CodedSource< Type >, codedMixedFvPatchField< Type >, codedFixedValueFvPatchField< Type >, codedFixedValuePointPatchField< Type >, and codedFunctionObject.
|
protectedpure virtual |
Adapt the context for the current object.
Implemented in CodedSource< Type >, codedMixedFvPatchField< Type >, codedFixedValueFvPatchField< Type >, codedFixedValuePointPatchField< Type >, and codedFunctionObject.
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedpure virtual |
ClassName | ( | "codedBase" | ) |
Runtime type information.
|
mutableprivate |
Previously loaded library.
Definition at line 58 of file codedBase.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.