39 "caseDicts/postProcessing" 51 functionObject* ptr = 0;
56 if (fnd != indices_.
end())
61 ptr = this->
set(oldIndex, 0).ptr();
73 void Foam::functionObjectList::listDir
84 if (foFiles[
f].ext().
empty())
86 foMap.insert(foFiles[
f]);
96 listDir(dir/foDirs[fd], foMap);
110 listDir(etcDirs[ed], foMap);
114 <<
"Available configured functionObjects:" 122 const word& funcName,
163 if (!dictFile.empty())
175 Foam::functionObjectList::unsetEntries(
const dictionary& funcDict)
177 const wordRe unsetPattern(
"<.*>");
184 if (iter().isStream())
188 bool isUnset =
false;
193 if (its[i].isWord() && unsetPattern.
match(its[i].wordToken()))
214 unsetEntries(iter().
dict());
222 iter().keyword() +
'/' + subUnsetArgs[i].
first(),
223 subUnsetArgs[i].second()
236 const string& funcArgs,
255 <<
"Cannot find functionObject file " << funcType <<
endl;
262 ISstream& fileStream = fileStreamPtr();
267 dictionary funcsDict(funcType, functionsDict, fileStream);
272 if (funcsDict.
found(funcType) && funcsDict.
isDict(funcType))
274 funcDictPtr = &funcsDict.
subDict(funcType);
291 if (namedArgs[i].
first() ==
"field")
298 namedArgs[i].
first() ==
"fields" 299 || namedArgs[i].
first() ==
"objects" 306 if (fieldArgs.
size() == 1)
308 funcDict.
set(
"field", fieldArgs[0].
first());
309 funcDict.
merge(fieldArgs[0].second());
311 if (fieldArgs.
size() >= 1)
313 funcDict.
set(
"fields", fieldArgs);
314 funcDict.
set(
"objects", fieldArgs);
322 namedArgs[i].
first() !=
"field" 323 && namedArgs[i].
first() !=
"fields" 324 && namedArgs[i].
first() !=
"objects" 331 dAk.
second() +
' ' + namedArgs[i].second() +
';' 340 funcDict.
set(
"region", region);
353 bool hasUnsetError =
false;
358 unsetArgs[i].
first() !=
"fields" 359 && unsetArgs[i].
first() !=
"objects" 362 hasUnsetError =
true;
380 <<
"Essential value for keyword '" << unsetArgs[i].first()
381 <<
"' not set" <<
nl;
385 <<
nl <<
"In function entry:" <<
nl 386 <<
" " << funcArgs.c_str() <<
nl 387 <<
nl <<
"In " << contextTypeAndValue.
first().c_str() <<
":" <<
nl 388 <<
" " << contextTypeAndValue.
second().c_str() <<
nl;
398 args[i].strip(
" \n");
399 argList += (argList.size() ?
", " :
"") + args[i];
403 namedArgs[i].second().strip(
" \n");
405 (argList.size() ?
", " :
"")
406 + namedArgs[i].
first() +
" = " + namedArgs[i].second();
410 unsetArgs[i].second().strip(
" \n");
412 (argList.size() ?
", " :
"")
413 + unsetArgs[i].
first() +
" = " + unsetArgs[i].second();
417 <<
nl <<
"The function entry should be:" <<
nl 418 <<
" " << funcType <<
'(' << argList.c_str() <<
')' 425 funcArgsDict.
add(funcName, funcDict);
428 funcArgsDict.
write(os);
440 if (functionObject::debug)
444 << funcArgs << expandedFuncDict
447 if (expandedFuncDict.found(
"field"))
449 requiredFields.
insert(
word(expandedFuncDict.lookup(
"field")));
451 if (expandedFuncDict.found(
"fields"))
459 if (expandedFuncDict.found(
"objects"))
469 functionsDict.
merge(funcArgsDict);
489 execution_(execution),
505 parentDict_(parentDict),
506 execution_(execution),
533 region = args[
"region"];
595 functionsPtr->read();
622 if (
operator[](oi).
name() == name)
641 updated_ = execution_ =
false;
659 if (
operator[](oi).executeAtStart())
716 scalar result = vGreat;
738 updated_ = execution_;
765 <<
"'functions' entry is not a dictionary" 775 functionObject::dictionaryConstructorTablePtr_
778 newPtrs.
setSize(functionsDict.size());
779 newDigs.
setSize(functionsDict.size());
783 const word& key = iter().keyword();
785 if (!iter().isDict())
790 <<
"Entry " << key <<
" is not a dictionary" <<
endl;
799 newDigs[nFunc] = dict.
digest();
809 if (newDigs[nFunc] != digests_[oldIndex])
811 ok = objPtr->
read(dict) && ok;
832 dict.
found(
"writeControl")
833 || dict.
found(
"outputControl")
854 <<
"Caught FatalError " << err <<
nl <<
endl;
861 objPtr = foPtr.
ptr();
872 newPtrs.
set(nFunc, objPtr);
873 newIndices.
insert(key, nFunc);
884 digests_.transfer(newDigs);
Template class for intrusive linked lists.
bool read()
Read and set the function objects if their data have changed.
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
A HashTable with keys but without contents.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
Ostream & indent(Ostream &os)
Indent stream.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
bool set(const label) const
Is element set.
functionObjectList(const Time &runTime, const bool execution=true)
Construct from Time and the execution setting.
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
SHA1Digest digest() const
Return the SHA1 digest of the dictionary contents.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void off()
Switch the function objects off.
scalar timeToNextWrite()
Return the time to the next write.
A list of keyword definitions, which are a keyword followed by any number of values (e...
A 2-tuple for storing two objects of different types.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static void list()
Print a list of functionObject configuration files in.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
void size(const label)
Override size to be inconsistent with allocated storage.
static const fileName null
An empty fileName.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
const T & operator[](const label) const
Return element const reference.
bool empty() const
Return true if the UPtrList is empty (ie, size() is zero)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
void on()
Switch the function objects on.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Info<< "Calculating turbulent flame speed field St\"<< endl;volScalarField St(IOobject("St", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
T * ptr()
Return object pointer for reuse.
Abstract base-class for Time/database functionObjects.
bool insert(const Key &key)
Insert a new entry.
A keyword and a list of tokens is a 'dictionaryEntry'.
Tuple of a word and dictionary, used to read in per-field options for function objects in the followi...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool start()
Called at the start of the time-loop.
dlLibraryTable libs
Table of loaded dynamic libraries.
bool compile() const
Compile the regular expression.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Class to handle errors and exceptions in a simple, consistent stream-based manner.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
bool execute()
Called at each ++ or += of the time-loop.
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
static int disableFunctionEntries
An ordered pair of two objects of type <T> with first() and second() elements.
const fileName & name() const
Return the dictionary name.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from string.
Functions to search 'etc' directories for configuration files etc.
Extract command arguments and options from the supplied argc and argv parameters. ...
void clear()
Clear all entries from table.
void append(const T &)
Append an element at the end of the list.
static const dictionary null
Null dictionary.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
static const word null
An empty word.
~functionObjectList()
Destructor.
const fileOperation & fileHandler()
Get current file handler.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
A wordRe is a word, but can also have a regular expression for matching words.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
virtual bool isDict() const
Return true if this entry is a dictionary.
virtual bool read(const dictionary &)
Read and set the functionObject if its data have changed.
void set(T *)
Set pointer to that given.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
const Type & second() const
Return second.
void clear()
Clear the list of function objects.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
bool status() const
Return the execution status (on/off) of the function objects.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Input from memory buffer stream.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
static autoPtr< functionObject > New(const word &name, const Time &, const dictionary &)
Select from dictionary, based on its "type" entry.
string str() const
Return the string.
const dictionary & controlDict() const
Return the control dict.
void set(entry *)
Assign a new entry, overwrite any existing entry.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
bool merge(const dictionary &)
Merge entries from the given dictionary.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Mesh consisting of general polyhedral cells.
label findObjectID(const word &name) const
Find the ID of a given function object by name.
void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
static bool readFunctionObject(const string &funcArgs, dictionary &functionsDict, const Pair< string > &contextTypeAndValue, HashSet< word > &requiredFields, const word ®ion=word::null)
Read the specified functionObject configuration dictionary.
static autoPtr< functionObjectList > New(const argList &args, const Time &runTime, dictionary &controlDict, HashSet< word > &requiredFields)
Construct and return a functionObjectList for an application.
const string & commandLine() const
Return the command line string.
friend class iterator
Declare friendship with the iterator.
Foam::argList args(argc, argv)
void movePoints(const polyMesh &mesh)
Update for changes of mesh.
List< fileName > fileNameList
A List of fileNames.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const Type & first() const
Return first.
static fileName functionObjectDictPath
Default relative path to the directory structure.
bool end()
Called when Time::run() determines that the time-loop exits.
Output to memory buffer stream.
void dictArgList(const string &funcArgs, word &funcName, wordReList &args, List< Tuple2< word, string >> &namedArgs)
Parse dictionary substitution argument list.
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.
A keyword and a list of tokens is an 'entry'.
static fileName findDict(const word &funcName, const word ®ion=word::null)
Search for functionObject dictionary file for given region.
void dontThrowExceptions()
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
#define InfoInFunction
Report an information message using Foam::Info.
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
T & first()
Return reference to the first element of the list.