Coded< DimensionedFieldType > Class Template Reference

Coded internal and patch field initialisation, evaluation and update with dimension checking. More...

Inheritance diagram for Coded< DimensionedFieldType >:
Collaboration diagram for Coded< DimensionedFieldType >:

Public Member Functions

 TypeName ("coded")
 Runtime type information. More...
 
 Coded (const dictionary &dict, DimensionedFieldType &field)
 Construct with dictionary to initialise given field. More...
 
 Coded (const Coded &dff, DimensionedFieldType &field)
 Construct a copy for the given field. More...
 
virtual autoPtr< DimensionedFieldFunction< DimensionedFieldType > > clone (DimensionedFieldType &field) const
 Construct and return a clone for the specified field. More...
 
virtual ~Coded ()
 Destructor. More...
 
virtual void evaluate ()
 Evaluate the function and set the field. More...
 
virtual bool update ()
 Update the field if the function has changed and return true. More...
 
virtual void write (Ostream &os) const
 Write data to dictionary stream. More...
 
- Public Member Functions inherited from DimensionedFieldFunction< DimensionedFieldType >
 TypeName ("DimensionedFieldFunction")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, DimensionedFieldFunction, dictionary,(const dictionary &dict, DimensionedFieldType &field),(dict, field))
 
 DimensionedFieldFunction (const dictionary &dict, DimensionedFieldType &field)
 Construct with dictionary to initialise given field. More...
 
 DimensionedFieldFunction (const DimensionedFieldFunction &dff, DimensionedFieldType &field)
 Construct a copy for the given field. More...
 
 DimensionedFieldFunction (const DimensionedFieldFunction< DimensionedFieldType > &)=delete
 Disallow default bitwise copy construction. More...
 
virtual autoPtr< DimensionedFieldFunction< DimensionedFieldType > > clone () const
 Construct and return a clone for the specified field. More...
 
virtual ~DimensionedFieldFunction ()
 Destructor. More...
 
virtual void reset ()
 Reset the field size. More...
 
void operator= (const DimensionedFieldFunction< DimensionedFieldType > &)=delete
 Disallow default bitwise assignment. More...
 
- Public Member Functions inherited from codedBase
 TypeName ("codedBase")
 Runtime type information. More...
 
 codedBase (const word &name, const dictionary &dict, const wordList &codeKeys, const wordList &codeDictVars, const word &codeOptionsFileName, const wordList &compileFiles, const wordList &copyFiles, const bool reloadable=true)
 Construct from name and dictionary. More...
 
virtual ~codedBase ()
 Destructor. More...
 
bool updateLibrary (const dictionary &dict) const
 Update library from given updated dictionary as required. More...
 
void operator= (const codedBase &)=delete
 Disallow default bitwise assignment. More...
 
- Public Member Functions inherited from dynamicCode
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from DimensionedFieldFunction< DimensionedFieldType >
static autoPtr< DimensionedFieldFunction< DimensionedFieldType > > New (const dictionary &dict, DimensionedFieldType &field)
 Select null constructed. More...
 
- Static Public Member Functions inherited from codedBase
static word codedName (const word &name)
 Create a coded name from the given name. More...
 
- Static Public Member Functions inherited from dynamicCode
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 inherited from dynamicCode
static int allowSystemOperations
 Flag if system operations are allowed. More...
 
- Protected Attributes inherited from DimensionedFieldFunction< DimensionedFieldType >
DimensionedFieldType & field_
 Reference to the field the function applies to. More...
 

Detailed Description

template<class DimensionedFieldType>
class Foam::DimensionedFieldFunctions::Coded< DimensionedFieldType >

Coded internal and patch field initialisation, evaluation and update with dimension checking.

Code can be provided for field initialisation in the evaluate function or field update (time dependent) in the update function which can call the evaluate function if appropriate. The evaluate function provides direct access to the point, cell or face centres in the C field and also time t and the field is set by assignment. If the update function changes the field updated should be set true.

Usage
To initialise the swirl velocity and set the inlet value using Foam::functionalFixedValue in the incompressibleFluid/pipeCyclic case:
internalField
{
    type        coded;

    evaluate
    #{
        field = velocity(1, 0, 0) + (C ^ rate(2, 0, 0));
    #};
}

boundaryField
{
    inlet
    {
        type           functionalFixedValue;

        value
        {
            $internalField;
        }
    }
    .
    .
    .
Source files

Definition at line 90 of file Coded_DimensionedFieldFunction.H.

Constructor & Destructor Documentation

◆ Coded() [1/2]

Coded ( const dictionary dict,
DimensionedFieldType &  field 
)

Construct with dictionary to initialise given field.

Definition at line 65 of file Coded_DimensionedFieldFunction.C.

References codedBase::codedName(), Foam::name(), Foam::typeName(), codedBase::updateLibrary(), and dynamicCode::varSubstitutions().

Here is the call graph for this function:

◆ Coded() [2/2]

Coded ( const Coded< DimensionedFieldType > &  dff,
DimensionedFieldType &  field 
)

Construct a copy for the given field.

Definition at line 116 of file Coded_DimensionedFieldFunction.C.

◆ ~Coded()

virtual ~Coded ( )
inlinevirtual

Destructor.

Definition at line 141 of file Coded_DimensionedFieldFunction.H.

Member Function Documentation

◆ TypeName()

TypeName ( "coded"  )

Runtime type information.

◆ clone()

Foam::autoPtr< Foam::DimensionedFieldFunction< DimensionedFieldType > > clone ( DimensionedFieldType &  field) const
virtual

Construct and return a clone for the specified field.

Implements DimensionedFieldFunction< DimensionedFieldType >.

Definition at line 130 of file Coded_DimensionedFieldFunction.C.

◆ evaluate()

void evaluate
virtual

Evaluate the function and set the field.

Implements DimensionedFieldFunction< DimensionedFieldType >.

Definition at line 145 of file Coded_DimensionedFieldFunction.C.

References DimensionedFieldFunction< DimensionedFieldType >::New().

Here is the call graph for this function:

◆ update()

bool update
virtual

Update the field if the function has changed and return true.

otherwise return false

Reimplemented from DimensionedFieldFunction< DimensionedFieldType >.

Definition at line 166 of file Coded_DimensionedFieldFunction.C.

References DimensionedFieldFunction< DimensionedFieldType >::New().

Here is the call graph for this function:

◆ write()

void write ( Ostream os) const
virtual

Write data to dictionary stream.

Implements DimensionedFieldFunction< DimensionedFieldType >.

Definition at line 187 of file Coded_DimensionedFieldFunction.C.

References dynamicCode::write().

Here is the call graph for this function:

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