Dictionary entry that contains C++ OpenFOAM code that is compiled to generate the entry itself. So. More...
Public Member Functions | |
ClassName ("codeStream") | |
Runtime type information. More... | |
![]() | |
declareMemberFunctionSelectionTable (bool, functionEntry, execute, dictionaryIstream,(dictionary &parentDict, Istream &is),(parentDict, is)) | |
declareMemberFunctionSelectionTable (bool, functionEntry, execute, primitiveEntryIstream,(const dictionary &parentDict, primitiveEntry &entry, Istream &is),(parentDict, entry, is)) | |
Static Public Member Functions | |
static bool | execute (dictionary &parentDict, Istream &) |
Execute the functionEntry in a sub-dict context. More... | |
static bool | execute (const dictionary &parentDict, primitiveEntry &, Istream &) |
Execute the functionEntry in a primitiveEntry context. More... | |
![]() | |
static bool | execute (const word &functionName, dictionary &parentDict, Istream &) |
Execute the functionEntry in a sub-dict context. More... | |
static bool | execute (const word &functionName, const dictionary &parentDict, primitiveEntry &, Istream &) |
Execute the functionEntry in a primitiveEntry context. More... | |
Static Public Attributes | |
static const word | codeTemplateC = "codeStreamTemplate.C" |
Name of the C code template to be used. More... | |
Friends | |
class | calcEntry |
Declare friendship with the calcEntry class. More... | |
Dictionary entry that contains C++ OpenFOAM code that is compiled to generate the entry itself. So.
- codeStream reads three entries: 'code', 'codeInclude' (optional), 'codeOptions' (optional) and uses those to generate library sources inside codeStream/
E.g. to set the internal field of a field:
internalField #codeStream { code #{ const IOdictionary& d = static_cast<const IOdictionary&>(dict); const fvMesh& mesh = refCast<const fvMesh>(d.db()); scalarField fld(mesh.nCells(), 12.34); fld.writeEntry("", os); #}; //! Optional: codeInclude #{ #include "fvCFD.H" #}; //! Optional: codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude #}; };
Note the #{
... #}
syntax is a 'verbatim' input mode that allows inputting strings with embedded newlines.
Limitations:
$
and ~
sequences)codeStream
directory with a subdirectory name corresponding to the SHA1 of the contents.The corresponding library code is located under the local codeStream/platforms/$WM_OPTIONS/lib
directory in a library libcodeStream_SHA1.so
Definition at line 112 of file codeStream.H.
ClassName | ( | "codeStream" | ) |
Runtime type information.
|
static |
Execute the functionEntry in a sub-dict context.
Definition at line 359 of file codeStream.C.
References dynamicCode::checkSecurity(), Foam::endl(), IOstream::format(), Foam::Info, IOstream::lineNumber(), dictionaryName::name(), and dictionary::read().
Referenced by codeStream::execute().
|
static |
Execute the functionEntry in a primitiveEntry context.
Definition at line 325 of file codeStream.C.
References dynamicCode::checkSecurity(), Foam::endl(), codeStream::execute(), IOstream::format(), Foam::Info, IOstream::lineNumber(), dictionaryName::name(), and primitiveEntry::read().
|
friend |
Declare friendship with the calcEntry class.
Definition at line 153 of file codeStream.H.
|
static |
Name of the C code template to be used.
Definition at line 148 of file codeStream.H.