Function1 with the code supplied by an on-the-fly compiled C++ expression. More...
#include <CodedFunction1.H>


Static Public Attributes | |
| static constexpr const char *const | codeTemplateC = "codedFunction1Template.C" |
| Name of the C code template to be used. | |
| static constexpr const char *const | codeTemplateH = "codedFunction1Template.H" |
| Name of the H code template to be used. | |
| Static Public Attributes inherited from Function1< Type > | |
| static const ::Foam::word | typeName |
| static int | debug |
| static dictionaryConstructorTableType * | dictionaryConstructorTablePtr_ |
| static std::unique_ptr< dictionaryConstructorCompatTableType > | dictionaryConstructorCompatTablePtr_ |
Protected Member Functions | |
| virtual dlLibraryTable & | libs () const |
| Mutable access to the loaded dynamic libraries. | |
| virtual string | description () const |
| Description (type + name) for the output. | |
| virtual void | clearRedirect () const |
| Clear redirected object(s). | |
| virtual const dictionary & | codeContext () const |
| Additional 'codeContext' dictionary to pass through. | |
| virtual const dictionary & | codeDict (const dictionary &dict) const |
| virtual const dictionary & | codeDict () const |
| virtual void | prepare (dynamicCode &, const dynamicCodeContext &) const |
| Adapt the context for the current object. | |
| void | operator= (const CodedFunction1< Type > &)=delete |
| No copy assignment. | |
| Protected Member Functions inherited from Function1< Type > | |
| void | operator= (const Function1< Type > &)=delete |
| No copy assignment. | |
| Protected Member Functions inherited from function1Base | |
| void | operator= (const function1Base &)=delete |
| No copy assignment. | |
| Protected Member Functions inherited from codedBase | |
| dynamicCodeContext & | codeContext () |
| Access to the dynamic code context. | |
| void | setCodeContext (const dictionary &dict) |
| Set code context from a dictionary. | |
| void | append (const std::string &str) |
| Add content to SHA1 hashing. | |
| void | updateLibrary (const word &name, const dynamicCodeContext &context) const |
| Update library as required, using the given context. | |
| void | updateLibrary (const word &name, const dictionary &dict) const |
| Update library as required, using the given code dictionary to use for the context. | |
| void | updateLibrary (const word &name) const |
| Update library as required, using the predefined context or use the codeDict() to generate one. | |
| ClassName ("codedBase") | |
| Runtime type information. | |
| codedBase (const codedBase &)=delete | |
| No copy construct. | |
| void | operator= (const codedBase &)=delete |
| No copy assignment. | |
| codedBase ()=default | |
| Default construct. | |
| virtual | ~codedBase ()=default |
| Destructor. | |
Additional Inherited Members | |
| Public Types inherited from Function1< Type > | |
| typedef Type | returnType |
| The return type. | |
| typedef autoPtr< Function1 >(* | dictionaryConstructorPtr) (const word &entryName, const dictionary &dict, const objectRegistry *obrPtr) |
| Declare runtime constructor selection table. | |
| typedef ::Foam::HashTable< dictionaryConstructorPtr, ::Foam::word, ::Foam::Hash<::Foam::word > > | dictionaryConstructorTableType |
| typedef ::Foam::HashTable< std::pair<::Foam::word, int >, ::Foam::word, ::Foam::Hash<::Foam::word > > | dictionaryConstructorCompatTableType |
| Static Public Member Functions inherited from Function1< Type > | |
| static const char * | typeName_ () |
| Runtime type information. | |
| static dictionaryConstructorCompatTableType & | dictionaryConstructorCompatTable () |
| static void | dictionaryConstructorTablePtr_construct (bool load) |
| static dictionaryConstructorPtr | dictionaryConstructorTable (const ::Foam::word &k) |
| template<class Derived> | |
| static tmp< Function1< Type > > | Clone (const Derived &fun) |
| Clone a Function1. | |
| static autoPtr< Function1< Type > > | New (const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr, const bool mandatory=true) |
| Selector, with fallback redirection. | |
| static autoPtr< Function1< Type > > | NewCompat (const word &entryName, std::initializer_list< std::pair< const char *, int > > compat, const dictionary &dict, const word &redirectType=word::null, const objectRegistry *obrPtr=nullptr, const bool mandatory=true) |
| Compatibility selector, with fallback redirection. | |
| static autoPtr< Function1< Type > > | New (const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr, const bool mandatory=true) |
| Selector, without fallback redirection. | |
| static autoPtr< Function1< Type > > | NewIfPresent (const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr) |
| An optional selector, with fallback redirection. | |
| static autoPtr< Function1< Type > > | NewIfPresent (const word &entryName, const dictionary &dict, const objectRegistry *obrPtr=nullptr) |
| An optional selector, without fallback redirection. | |
| static refPtr< Function1< Type > > | New (HashPtrTable< Function1< Type > > &cache, const word &entryName, const dictionary &dict, enum keyType::option matchOpt=keyType::LITERAL, const objectRegistry *obrPtr=nullptr, const bool mandatory=true) |
| Selector with external storage of Function1. This also allows wildcard matches in a dictionary. | |
| Static Protected Member Functions inherited from codedBase | |
| static void | writeCodeDict (Ostream &os, const dictionary &dict) |
| Write code-dictionary contents. | |
| static const dictionary & | codeDict (const objectRegistry &obr, const word &dictName="codeDict") |
| Return "codeDict" from objectRegistry or read from disk. | |
| Protected Attributes inherited from function1Base | |
| const word | name_ |
| Name of entry. | |
| const objectRegistry * | obrPtr_ |
| Pointer to an object registry. | |
Function1 with the code supplied by an on-the-fly compiled C++ expression.
The code entries:
| codeInclude | : | include files |
| codeOptions | : | compiler line: added to EXE_INC (Make/options) |
| codeLibs | : | linker line: added to LIB_LIBS (Make/options) |
| localCode | : | c++; local static functions |
| code | : | c++; return the patch values at (scalar x) |
<patchName>
{
type uniformFixedValue;
uniformValue
{
type coded;
name myExpression; // Name of generated PatchFunction1
code
#{
const polyPatch& pp = this->patch();
Pout<< "** Patch size:" << pp.size() << endl;
return tmp<vectorField>::New(pp.size(), vector(1, 0, 0))
#};
//codeInclude
//#{
// #include "volFields.H"
//#};
//codeOptions
//#{
// -I$(LIB_SRC)/finiteVolume/lnInclude
//#};
}
}
Definition at line 120 of file CodedFunction1.H.
| CodedFunction1 | ( | const word & | entryName, |
| const dictionary & | dict, | ||
| const objectRegistry * | obrPtr = nullptr ) |
Construct from entry name, dictionary and optional registry.
Definition at line 136 of file CodedFunction1.C.
References codedBase::codedBase(), dict, Function1< Type >::Function1(), codedBase::setCodeContext(), and codedBase::updateLibrary().
Referenced by CodedFunction1(), operator=(), and TypeName().


|
explicit |
Copy construct.
Definition at line 157 of file CodedFunction1.C.
References codedBase::codedBase(), CodedFunction1(), Function1< Type >::Function1(), and Foam::rhs().

|
virtualdefault |
|
protectedvirtual |
Mutable access to the loaded dynamic libraries.
Implements codedBase.
Definition at line 29 of file CodedFunction1.C.
References function1Base::time().

|
protectedvirtual |
Description (type + name) for the output.
Implements codedBase.
Definition at line 37 of file CodedFunction1.C.
|
protectedvirtual |
|
protectedvirtual |
Additional 'codeContext' dictionary to pass through.
Definition at line 52 of file CodedFunction1.C.
|
protectedvirtual |
Definition at line 61 of file CodedFunction1.C.
References dict.
Referenced by codeDict().

|
protectedvirtual |
Implements codedBase.
Definition at line 80 of file CodedFunction1.C.
References codeDict().

|
protectedvirtual |
Adapt the context for the current object.
Implements codedBase.
Definition at line 87 of file CodedFunction1.C.
References dynamicCode::addCompileFile(), dynamicCode::addCopyFile(), dynamicCodeContext::code(), codeTemplateC, codeTemplateH, DetailInfo, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, dynamicCodeContext::libs(), dynamicCodeContext::options(), dynamicCode::setFieldTemplates(), dynamicCode::setFilterVariable(), dynamicCode::setMakeOptions(), and dynamicCodeContext::sha1().

|
protecteddelete |
| TypeName | ( | "coded" | ) |
Runtime type information.
References CodedFunction1(), dict, and Foam::rhs().

Return a clone.
Implements Function1< Type >.
Definition at line 231 of file CodedFunction1.H.
References Function1< Type >::Clone().

|
inlinevirtual |
Return value at current time.
Reimplemented from Function1< Type >.
Definition at line 215 of file CodedFunction1.C.
References codedBase::updateLibrary(), and x.

|
virtual |
Write in dictionary format.
Reimplemented from Function1< Type >.
Definition at line 228 of file CodedFunction1.C.

| const::Foam::word typeName | ( | Function1Types::CodedFunction1< scalar > | ::typeName_() | ) |
| int debug | ( | ::Foam::debug::debugSwitch(Function1Types::CodedFunction1< scalar >::typeName_(), 0) | ) |
| const::Foam::word typeName | ( | Function1Types::CodedFunction1< vector > | ::typeName_() | ) |
| int debug | ( | ::Foam::debug::debugSwitch(Function1Types::CodedFunction1< vector >::typeName_(), 0) | ) |
| const::Foam::word typeName | ( | Function1Types::CodedFunction1< sphericalTensor > | ::typeName_() | ) |
| int debug | ( | ::Foam::debug::debugSwitch(Function1Types::CodedFunction1< sphericalTensor >::typeName_(), 0) | ) |
| const::Foam::word typeName | ( | Function1Types::CodedFunction1< symmTensor > | ::typeName_() | ) |
| int debug | ( | ::Foam::debug::debugSwitch(Function1Types::CodedFunction1< symmTensor >::typeName_(), 0) | ) |
| const::Foam::word typeName | ( | Function1Types::CodedFunction1< tensor > | ::typeName_() | ) |
| int debug | ( | ::Foam::debug::debugSwitch(Function1Types::CodedFunction1< tensor >::typeName_(), 0) | ) |
|
staticconstexpr |
Name of the C code template to be used.
Definition at line 195 of file CodedFunction1.H.
Referenced by prepare().
|
staticconstexpr |
Name of the H code template to be used.
Definition at line 201 of file CodedFunction1.H.
Referenced by prepare().