CodedField< Type > Class Template Reference

PatchFunction1 with the code supplied by an on-the-fly compiled C++ expression. More...

Inheritance diagram for CodedField< Type >:
[legend]
Collaboration diagram for CodedField< Type >:
[legend]

Public Member Functions

 TypeName ("coded")
 Runtime type information. More...
 
void operator= (const CodedField< Type > &)=delete
 No copy assignment. More...
 
 CodedField (const polyPatch &pp, const word &redirectType, const word &entryName, const dictionary &dict, const bool faceValues=true)
 Construct from entry name and dictionary. More...
 
 CodedField (const CodedField< Type > &rhs)
 Copy construct. More...
 
 CodedField (const CodedField< Type > &rhs, const polyPatch &pp)
 Copy construct, setting patch. More...
 
virtual tmp< PatchFunction1< Type > > clone () const
 Construct and return a clone. More...
 
virtual tmp< PatchFunction1< Type > > clone (const polyPatch &pp) const
 Construct and return a clone setting patch. More...
 
virtual ~CodedField ()=default
 Destructor. More...
 
virtual tmp< Field< Type > > value (const scalar x) const
 Return CodedField value. More...
 
virtual bool constant () const
 Is value constant (i.e. independent of x) More...
 
virtual bool uniform () const
 Is value uniform (i.e. independent of coordinate) More...
 
virtual tmp< Field< Type > > integrate (const scalar x1, const scalar x2) const
 Integrate between two values. More...
 
virtual void autoMap (const FieldMapper &mapper)
 Map (and resize as needed) from self given a mapping object. More...
 
virtual void rmap (const PatchFunction1< Type > &pf1, const labelList &addr)
 Reverse map the given PatchFunction1 onto this PatchFunction1. More...
 
virtual void writeData (Ostream &os) const
 Write in dictionary format. More...
 
- Public Member Functions inherited from PatchFunction1< Type >
 TypeName ("PatchFunction1") declareRunTimeSelectionTable(autoPtr
 Runtime type information. More...
 
 PatchFunction1 (const polyPatch &pp, const word &entryName, const bool faceValues=true)
 Construct from polyPatch and entry name. More...
 
 PatchFunction1 (const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true)
 Construct from polyPatch, dictionary and entry name. More...
 
 PatchFunction1 (const PatchFunction1< Type > &rhs)
 Copy construct. More...
 
 PatchFunction1 (const PatchFunction1< Type > &rhs, const polyPatch &pp)
 Copy construct setting patch. More...
 
virtual ~PatchFunction1 ()=default
 Destructor. More...
 
virtual tmp< pointFieldlocalPosition (const pointField &globalPos) const
 Helper: optionally convert coordinates to local coordinates. More...
 
virtual tmp< Field< Type > > transform (const Field< Type > &fld) const
 Apply optional transformation. More...
 
virtual tmp< Field< Type > > transform (const tmp< Field< Type >> &tfld) const
 Apply optional transformation. More...
 

Static Public Attributes

static constexpr const char *const codeTemplateC = "codedPatchFunction1Template.C"
 Name of the C code template to be used. More...
 
static constexpr const char *const codeTemplateH = "codedPatchFunction1Template.H"
 Name of the H code template to be used. More...
 

Protected Member Functions

virtual dlLibraryTablelibs () const
 Mutable access to the loaded dynamic libraries. More...
 
virtual void prepare (dynamicCode &, const dynamicCodeContext &) const
 Adapt the context for the current object. More...
 
virtual string description () const
 
virtual void clearRedirect () const
 
virtual const dictionarycodeDict (const dictionary &fullDict) const
 
virtual const dictionarycodeDict () const
 
- Protected Member Functions inherited from PatchFunction1< Type >
void operator= (const PatchFunction1< Type > &)=delete
 No copy assignment. More...
 
- Protected Member Functions inherited from codedBase
void setCodeContext (const dictionary &dict)
 Set code context from a dictionary. More...
 
void append (const std::string &str)
 Add content to SHA1 hashing. More...
 
void updateLibrary (const word &name, const dynamicCodeContext &context) const
 Update library as required, using the given context. More...
 
void updateLibrary (const word &name, const dictionary &dict) const
 
void updateLibrary (const word &name) const
 
 codedBase (const codedBase &)=delete
 No copy construct. More...
 
void operator= (const codedBase &)=delete
 No copy assignment. More...
 
 ClassName ("codedBase")
 Runtime type information. More...
 
 codedBase ()=default
 Default construct. More...
 
virtual ~codedBase ()=default
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from PatchFunction1< Type >
typedef Field< Type > returnType
 
- Static Public Member Functions inherited from PatchFunction1< Type >
static autoPtr< PatchFunction1< Type > > New (const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true, const bool mandatory=true)
 Selector. More...
 
static autoPtr< PatchFunction1< Type > > NewCompat (const polyPatch &pp, const word &entryName, std::initializer_list< std::pair< const char *, int >> compat, const dictionary &dict, const bool faceValues=true, const bool mandatory=true)
 Compatibility selector. More...
 
static autoPtr< PatchFunction1< Type > > NewIfPresent (const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true)
 An optional selector. More...
 
- Public Attributes inherited from PatchFunction1< Type >
 PatchFunction1
 
 dictionary
 
const polyPatchpp
 
const polyPatch const wordtype
 
const polyPatch const word const wordentryName
 
const polyPatch const word const word const dictionarydict
 
const polyPatch const word const word const dictionary const bool faceValues
 
const polyPatch const word const word const dictionary const bool pp
 
const polyPatch const word const word const dictionary const bool type
 
const polyPatch const word const word const dictionary const bool entryName
 
const polyPatch const word const word const dictionary const bool dict
 
- Static Protected Member Functions inherited from codedBase
static void writeCodeDict (Ostream &os, const dictionary &dict)
 Write code-dictionary contents. More...
 
- Protected Attributes inherited from PatchFunction1< Type >
coordinateScaling< Type > coordSys_
 Optional local co-ordinate system and scaling. More...
 

Detailed Description

template<class Type>
class Foam::PatchFunction1Types::CodedField< Type >

PatchFunction1 with the code supplied by an on-the-fly compiled C++ expression.

Usage
Example:
<patchName>
{
    type            uniformFixedValue;
    uniformValue
    {
        type            coded;
        // Explictly supply name of generated PatchFunction1. Only needed
        // if entryname ('uniformValue') would clash with existing
        // runtime selection tables.
        name            myExpression;

        code
        #{
            const polyPatch& pp = this->patch();
            Pout<< "** Patch size:" << pp.size() << endl;
            return tmp<vectorField>::New(pp.size(), vector(1, 0, 0))
        #};
    }

    //codeInclude
    //#{
    //    #include "fvCFD.H"
    //#};

    //codeOptions
    //#{
    //    -I$(LIB_SRC)/finiteVolume/lnInclude
    //#};
}
See also
Foam::dynamicCode Foam::codedFixedValue Foam::functionEntries::codeStream
Source files

Definition at line 94 of file CodedField.H.

Constructor & Destructor Documentation

◆ CodedField() [1/3]

CodedField ( const polyPatch pp,
const word redirectType,
const word entryName,
const dictionary dict,
const bool  faceValues = true 
)

Construct from entry name and dictionary.

Definition at line 136 of file CodedField.C.

◆ CodedField() [2/3]

CodedField ( const CodedField< Type > &  rhs)
explicit

Copy construct.

Definition at line 155 of file CodedField.C.

◆ CodedField() [3/3]

CodedField ( const CodedField< Type > &  rhs,
const polyPatch pp 
)
explicit

Copy construct, setting patch.

Definition at line 165 of file CodedField.C.

◆ ~CodedField()

virtual ~CodedField ( )
virtualdefault

Destructor.

Member Function Documentation

◆ libs()

Foam::dlLibraryTable & libs ( ) const
protectedvirtual

Mutable access to the loaded dynamic libraries.

Implements codedBase.

Definition at line 34 of file CodedField.C.

References dlLibraryTable::libs().

Here is the call graph for this function:

◆ prepare()

void prepare ( dynamicCode dynCode,
const dynamicCodeContext context 
) const
protectedvirtual

Adapt the context for the current object.

Implements codedBase.

Definition at line 42 of file CodedField.C.

References dynamicCode::addCompileFile(), dynamicCode::addCopyFile(), dynamicCodeContext::code(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dynamicCodeContext::libs(), dynamicCodeContext::options(), dynamicCode::setFieldTemplates(), dynamicCode::setFilterVariable(), and dynamicCode::setMakeOptions().

Here is the call graph for this function:

◆ description()

Foam::string description ( ) const
protectedvirtual

Implements codedBase.

Definition at line 118 of file CodedField.C.

◆ clearRedirect()

void clearRedirect ( ) const
protectedvirtual

Implements codedBase.

Definition at line 125 of file CodedField.C.

◆ codeDict() [1/2]

const Foam::dictionary & codeDict ( const dictionary fullDict) const
protectedvirtual

Definition at line 92 of file CodedField.C.

References dict.

◆ codeDict() [2/2]

const Foam::dictionary & codeDict ( ) const
protectedvirtual

Implements codedBase.

Definition at line 110 of file CodedField.C.

◆ TypeName()

TypeName ( "coded"  )

Runtime type information.

◆ operator=()

void operator= ( const CodedField< Type > &  )
delete

No copy assignment.

◆ clone() [1/2]

virtual tmp<PatchFunction1<Type> > clone ( ) const
inlinevirtual

Construct and return a clone.

Implements PatchFunction1< Type >.

Definition at line 183 of file CodedField.H.

◆ clone() [2/2]

virtual tmp<PatchFunction1<Type> > clone ( const polyPatch pp) const
inlinevirtual

Construct and return a clone setting patch.

Implements PatchFunction1< Type >.

Definition at line 192 of file CodedField.H.

References PatchFunction1< Type >::pp.

◆ value()

Foam::tmp< Foam::Field< Type > > value ( const scalar  x) const
virtual

Return CodedField value.

Reimplemented from PatchFunction1< Type >.

Definition at line 213 of file CodedField.C.

References x.

◆ constant()

virtual bool constant ( ) const
inlinevirtual

Is value constant (i.e. independent of x)

Implements PatchFunction1< Type >.

Definition at line 213 of file CodedField.H.

◆ uniform()

virtual bool uniform ( ) const
inlinevirtual

Is value uniform (i.e. independent of coordinate)

Implements PatchFunction1< Type >.

Definition at line 219 of file CodedField.H.

◆ integrate()

Foam::tmp< Foam::Field< Type > > integrate ( const scalar  x1,
const scalar  x2 
) const
virtual

Integrate between two values.

Reimplemented from PatchFunction1< Type >.

Definition at line 227 of file CodedField.C.

◆ autoMap()

void autoMap ( const FieldMapper mapper)
virtual

Map (and resize as needed) from self given a mapping object.

Reimplemented from PatchFunction1< Type >.

Definition at line 241 of file CodedField.C.

◆ rmap()

void rmap ( const PatchFunction1< Type > &  pf1,
const labelList addr 
)
virtual

Reverse map the given PatchFunction1 onto this PatchFunction1.

Reimplemented from PatchFunction1< Type >.

Definition at line 255 of file CodedField.C.

◆ writeData()

void writeData ( Ostream os) const
virtual

Write in dictionary format.

Reimplemented from PatchFunction1< Type >.

Definition at line 270 of file CodedField.C.

References Foam::name().

Here is the call graph for this function:

Member Data Documentation

◆ codeTemplateC

constexpr const char* const codeTemplateC = "codedPatchFunction1Template.C"
staticconstexpr

Name of the C code template to be used.

Definition at line 143 of file CodedField.H.

◆ codeTemplateH

constexpr const char* const codeTemplateH = "codedPatchFunction1Template.H"
staticconstexpr

Name of the H code template to be used.

Definition at line 147 of file CodedField.H.


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