Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
codeStream Class Reference

Dictionary entry that contains C++ OpenFOAM code that is compiled to generate the entry itself. So. More...

Inheritance diagram for codeStream:
Inheritance graph
[legend]
Collaboration diagram for codeStream:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("codeStream")
 Runtime type information. More...
 
- Public Member Functions inherited from functionEntry
 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 Public Member Functions inherited from functionEntry
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...
 

Detailed Description

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:

Note
The code to be compiled is stored under the local 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

Source files

Definition at line 112 of file codeStream.H.

Member Function Documentation

ClassName ( "codeStream"  )

Runtime type information.

bool execute ( dictionary parentDict,
Istream is 
)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

bool execute ( const dictionary parentDict,
primitiveEntry entry,
Istream is 
)
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().

Here is the call graph for this function:

Friends And Related Function Documentation

friend class calcEntry
friend

Declare friendship with the calcEntry class.

Definition at line 153 of file codeStream.H.

Member Data Documentation

const Foam::word codeTemplateC = "codeStreamTemplate.C"
static

Name of the C code template to be used.

Definition at line 148 of file codeStream.H.


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