dynamicCode Class Reference

Encapsulation of dynamic code dictionaries and functionality. More...

Inheritance diagram for dynamicCode:

Public Member Functions

 ClassName ("dynamicCode")
 
 dynamicCode (const dictionary &contextDict, const dictionary &codeDict, const word &codeName, const word &codeDirName, const wordList &codeKeys, const wordList &codeDictVars, const word &optionsFileName, const wordList &compileFiles, const wordList &copyFiles)
 Construct from the context and code dictionaries. More...
 
 dynamicCode (const dictionary &contextDict, const word &codeName, const word &codeDirName, const wordList &codeKeys, const wordList &codeDictVars, const word &optionsFileName, const wordList &compileFiles, const wordList &copyFiles)
 Construct from the context dictionary also containing the code. More...
 
const wordcodeName () const
 Return the code-name. More...
 
const wordcodeSha1Name () const
 Return the unique code name. More...
 
fileName libPath () const
 Library path for specified code name. More...
 
fileName libRelPath () const
 Library path for specified code name relative to $FOAM_CASE. More...
 
HashTable< string > & varSubstitutions ()
 
bool upToDate () const
 Verify if the copied code is up-to-date, based on Make/SHA1Digest. More...
 
bool copyOrCreateFiles (const bool verbose=false) const
 Copy/create files prior to compilation. More...
 
bool wmakeLibso () const
 Compile a libso. More...
 
void * loadLibrary (const fileName &libPath) const
 
void createLibrary (const dictionary &dict, const bool masterOnlyRead=false) const
 
void read (const dictionary &contextDict, const dictionary &codeDict)
 
void read (const dictionary &contextDict)
 
void write (Ostream &os) const
 Write the code for restart. More...
 

Static Public Member Functions

static word libraryBaseName (const fileName &libPath)
 Return the library basename without leading 'lib' or trailing '.so'. More...
 
static fileName resolveTemplate (const fileName &templateName)
 Resolve code-template via Foam::findConfigFile. More...
 

Static Public Attributes

static int allowSystemOperations
 Flag if system operations are allowed. More...
 

Detailed Description

Encapsulation of dynamic code dictionaries and functionality.

Source files

Definition at line 50 of file dynamicCode.H.

Constructor & Destructor Documentation

◆ dynamicCode() [1/2]

dynamicCode ( const dictionary contextDict,
const dictionary codeDict,
const word codeName,
const word codeDirName,
const wordList codeKeys,
const wordList codeDictVars,
const word optionsFileName,
const wordList compileFiles,
const wordList copyFiles 
)

Construct from the context and code dictionaries.

and lists of which entries correspond to code

Definition at line 283 of file dynamicCode.C.

References dynamicCode::allowSystemOperations, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Foam::isAdministrator(), Foam::nl, dynamicCode::read(), and SHA1Digest::str().

Here is the call graph for this function:

◆ dynamicCode() [2/2]

dynamicCode ( const dictionary contextDict,
const word codeName,
const word codeDirName,
const wordList codeKeys,
const wordList codeDictVars,
const word optionsFileName,
const wordList compileFiles,
const wordList copyFiles 
)

Construct from the context dictionary also containing the code.

and lists of which entries correspond

Definition at line 356 of file dynamicCode.C.

Member Function Documentation

◆ ClassName()

ClassName ( "dynamicCode"  )

◆ codeName()

const word& codeName ( ) const
inline

Return the code-name.

Definition at line 226 of file dynamicCode.H.

Referenced by Coded< Type >::Coded().

Here is the caller graph for this function:

◆ codeSha1Name()

const word& codeSha1Name ( ) const
inline

Return the unique code name.

Definition at line 232 of file dynamicCode.H.

◆ libPath()

fileName libPath ( ) const
inline

Library path for specified code name.

Corresponds to codeRoot()/libSubDir()/lib<codeSha1Name>.so

Definition at line 239 of file dynamicCode.H.

◆ libRelPath()

fileName libRelPath ( ) const
inline

Library path for specified code name relative to $FOAM_CASE.

Corresponds to dynamicCode/codeDirName()/libSubDir()/lib<codeSha1Name>.so

Definition at line 247 of file dynamicCode.H.

◆ varSubstitutions()

◆ libraryBaseName()

Foam::word libraryBaseName ( const fileName libPath)
static

Return the library basename without leading 'lib' or trailing '.so'.

Definition at line 472 of file dynamicCode.C.

References fileName::name().

Referenced by codedBase::updateLibrary(), and codedBase::~codedBase().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolveTemplate()

Foam::fileName resolveTemplate ( const fileName templateName)
static

Resolve code-template via Foam::findConfigFile.

Definition at line 480 of file dynamicCode.C.

References Foam::findConfigFile().

Referenced by chemistryModel::New().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upToDate()

bool upToDate ( ) const

Verify if the copied code is up-to-date, based on Make/SHA1Digest.

Definition at line 600 of file dynamicCode.C.

References Foam::exists(), and Foam::file.

Here is the call graph for this function:

◆ copyOrCreateFiles()

bool copyOrCreateFiles ( const bool  verbose = false) const

Copy/create files prior to compilation.

Definition at line 494 of file dynamicCode.C.

References UList< T >::empty(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, forAllConstIter, IOstream::good(), Istream::good(), Foam::Info, Foam::mkDir(), fileName::name(), and Foam::nl.

Here is the call graph for this function:

◆ wmakeLibso()

bool wmakeLibso ( ) const

Compile a libso.

Definition at line 585 of file dynamicCode.C.

References Foam::system().

Here is the call graph for this function:

◆ loadLibrary()

void * loadLibrary ( const fileName libPath) const

Definition at line 613 of file dynamicCode.C.

References Foam::dlOpen(), dlLibraryTable::findLibrary(), Foam::libs, and dlLibraryTable::open().

Here is the call graph for this function:

◆ createLibrary()

void createLibrary ( const dictionary dict,
const bool  masterOnlyRead = false 
) const

◆ read() [1/2]

void read ( const dictionary contextDict,
const dictionary codeDict 
)

◆ read() [2/2]

void read ( const dictionary contextDict)

Definition at line 738 of file dynamicCode.C.

References Foam::read().

Here is the call graph for this function:

◆ write()

void write ( Ostream os) const

Write the code for restart.

Definition at line 744 of file dynamicCode.C.

References forAll, verbatimString::null, and Foam::writeEntry().

Referenced by codedFixedValueFvPatchField< Type >::write(), codedMixedFvPatchField< Type >::write(), codedFixedValuePointPatchField< Type >::write(), Coded< DimensionedFieldType >::write(), and Coded< Type >::write().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ allowSystemOperations

int allowSystemOperations
static

Flag if system operations are allowed.

Definition at line 188 of file dynamicCode.H.

Referenced by dynamicCode::dynamicCode(), chemistryModel::New(), argList::parse(), and systemCall::read().


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