42 namespace functionObjects
65 return "functionObject " +
name();
71 redirectFunctionObjectPtr_.reset(
nullptr);
113 <<
"compile " << name_ <<
" sha1: " << context.
sha1() <<
endl;
120 "-I$(LIB_SRC)/finiteVolume/lnInclude \\\n" 121 "-I$(LIB_SRC)/meshTools/lnInclude \\\n" 123 +
"\n\nLIB_LIBS = \\\n" 125 " -lfiniteVolume \\\n" 157 if (!redirectFunctionObjectPtr_)
160 constructDict.set(
"type", name_);
176 contentPtr->
dict(this->codeContext());
181 << name_ <<
" Did not derive from dictionaryContent" 185 return *redirectFunctionObjectPtr_;
191 updateLibrary(name_);
192 return redirectFunctionObject().execute();
198 updateLibrary(name_);
199 return redirectFunctionObject().write();
205 updateLibrary(name_);
206 return redirectFunctionObject().end();
216 dict.readCompat<
word>(
"name", {{
"redirectType", 1706}}, name_);
222 nKeywords += ctx.readIfPresent(
"codeData", codeData_);
223 nKeywords += ctx.readIfPresent(
"codeRead", codeRead_);
224 nKeywords += ctx.readIfPresent(
"codeExecute", codeExecute_);
225 nKeywords += ctx.readIfPresent(
"codeWrite", codeWrite_);
226 nKeywords += ctx.readIfPresent(
"codeEnd", codeEnd_);
231 <<
"No critical \"code\" prefixed keywords found." <<
nl 232 <<
"Please check the code documentation for more details." <<
nl 236 updateLibrary(name_);
237 return redirectFunctionObject().read(
dict);
functionObject & redirectFunctionObject() const
Dynamically compiled functionObject.
defineTypeNameAndDebug(ObukhovLength, 0)
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
virtual void clearRedirect() const
Clear redirected object(s)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void setMakeOptions(const std::string &content)
Define contents for Make/options.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void addCompileFile(const fileName &name)
Add a file template name, which will be found and filtered.
Abstract base-class for Time/database function objects.
virtual void prepare(dynamicCode &, const dynamicCodeContext &) const
Adapt the context for the current object.
virtual const dictionary & codeDict() const
The code dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
virtual bool write()
Called at each ++ or += of the time-loop.
virtual const dictionary & codeContext() const
Additional 'codeContext' dictionary to pass through.
virtual dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const string & options() const noexcept
The code options (Make/options)
A class for handling words, derived from Foam::string.
const dictionary & dict() const noexcept
Read-access to the content.
virtual bool execute()
Called at each ++ or += of the time-loop.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Base class for function objects and boundary conditions using dynamic code that provides methods for ...
A table of dynamically loaded libraries.
A wrapper for dictionary content, without operators that could affect inheritance patterns...
void setCodeContext(const dictionary &dict)
Set code context from a dictionary.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
Tools for handling dynamic code compilation.
Encapsulation of dynamic code dictionaries.
void updateLibrary(const word &name, const dynamicCodeContext &context) const
Update library as required, using the given context.
void setFilterVariable(const word &key, const std::string &value)
Define a filter variable.
dictionary dict_
Input dictionary.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
virtual string description() const
Description (type + name) for the output.
void addCopyFile(const fileName &name)
Add a file template name, which will be found and filtered.
const string & libs() const noexcept
The code libs (LIB_LIBS)
dynamicCodeContext & codeContext()
Access to the dynamic code context.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
static autoPtr< functionObject > New(const word &name, const Time &runTime, const dictionary &dict)
Select from dictionary, based on its "type" entry.
codedFunctionObject(const codedFunctionObject &)=delete
No copy construct.
A class for handling character strings derived from std::string.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
Virtual base class for function objects with a reference to Time.
const SHA1 & sha1() const noexcept
The SHA1 calculated from options, libs, include, code, etc.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and a sub-dictionary) otherwise return nullptr...
const Time & time_
Reference to the time database.