42namespace 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);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
Base class for function objects and boundary conditions using dynamic code that provides methods for ...
void updateLibrary(const word &name, const dynamicCodeContext &context) const
Update library as required, using the given context.
void setCodeContext(const dictionary &dict)
Set code context from a dictionary.
dynamicCodeContext & codeContext()
Access to the dynamic code context.
A wrapper for dictionary content, without operators that could affect inheritance patterns.
const dictionary & dict() const noexcept
Read-access to the content.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A table of dynamically loaded libraries.
Encapsulation of dynamic code dictionaries.
const string & libs() const noexcept
The code libs (LIB_LIBS)
const SHA1 & sha1() const noexcept
The SHA1 calculated from options, libs, include, code, etc.
const string & options() const noexcept
The code options (Make/options)
Tools for handling dynamic code compilation.
void addCopyFile(const fileName &name)
Add a file template name, which will be found and filtered.
void setFilterVariable(const word &key, const std::string &value)
Define a filter variable.
void addCompileFile(const fileName &name)
Add a file template name, which will be found and filtered.
void setMakeOptions(const std::string &content)
Define contents for Make/options.
Abstract base-class for Time/database function objects.
Provides a general interface to enable dynamic code compilation.
virtual const dictionary & codeContext() const
Additional 'codeContext' dictionary to pass through.
virtual void prepare(dynamicCode &, const dynamicCodeContext &) const
Adapt the context for the current object.
functionObject & redirectFunctionObject() const
Dynamically compiled functionObject.
dictionary dict_
Input dictionary.
virtual const dictionary & codeDict() const
The code dictionary.
virtual void clearRedirect() const
Clear redirected object(s)
virtual bool execute()
Called at each ++ or += of the time-loop.
virtual bool write()
Called at each ++ or += of the time-loop.
virtual dlLibraryTable & libs() const
Mutable access to the loaded dynamic libraries.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
virtual string description() const
Description (type + name) for the output.
Virtual base class for function objects with a reference to Time.
const Time & time_
Reference to the time database.
A class for handling character strings derived from std::string.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)