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);
119 const word& funcName,
160 if (!dictFile.empty())
172 Foam::functionObjectList::unsetEntries(
const dictionary& funcDict)
174 const wordRe unsetPattern(
"<.*>");
181 if (iter().isStream())
185 bool isUnset =
false;
190 if (its[i].isWord() && unsetPattern.
match(its[i].wordToken()))
211 unsetEntries(iter().
dict());
219 iter().keyword() +
'/' + subUnsetArgs[i].
first(),
233 const string& funcArgs,
251 <<
"Cannot find functionObject configuration file " 252 << funcType <<
nl <<
nl 253 <<
"Available configured functionObjects:" 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());
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);
438 functionsDict.
merge(funcArgsDict);
458 execution_(execution),
474 parentDict_(parentDict),
475 execution_(execution),
501 region = args[
"region"];
561 functionsPtr->read();
588 if (
operator[](oi).
name() == name)
607 updated_ = execution_ =
false;
625 if (
operator[](oi).executeAtStart())
682 scalar result = vGreat;
704 updated_ = execution_;
731 <<
"'functions' entry is not a dictionary" 741 functionObject::dictionaryConstructorTablePtr_
744 newPtrs.
setSize(functionsDict.size());
745 newDigs.
setSize(functionsDict.size());
749 const word& key = iter().keyword();
751 if (!iter().isDict())
756 <<
"Entry " << key <<
" is not a dictionary" <<
endl;
765 newDigs[nFunc] = dict.
digest();
775 if (newDigs[nFunc] != digests_[oldIndex])
777 ok = objPtr->
read(dict) && ok;
794 dict.
found(
"writeControl")
795 || dict.
found(
"outputControl")
810 objPtr = foPtr.
ptr();
821 newPtrs.
set(nFunc, objPtr);
822 newIndices.
insert(key, nFunc);
833 digests_.transfer(newDigs);
834 indices_.transfer(newIndices);
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.
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
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.
FvWallInfoData< WallInfo, label > 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.
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.
void off()
Switch the function objects off.
scalar timeToNextWrite()
Return the time to the next write.
static bool readFunctionObject(const string &funcArgs, dictionary &functionsDict, const Pair< string > &contextTypeAndValue, const word ®ion=word::null)
Read the specified functionObject configuration dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static wordList list()
Return the list of functionObject configuration files in.
A 2-tuple for storing two objects of different types.
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.
General time control for functionObjects.
void on()
Switch the function objects on.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
T * ptr()
Return object pointer for reuse.
Abstract base-class for Time/database functionObjects.
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.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
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.
bool insert(const Key &, const T &newElmt)
Insert a new 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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Functions to search 'etc' directories for configuration files etc.
Extract command arguments and options from the supplied argc and argv parameters. ...
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.
virtual ~functionObjectList()
Destructor.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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.
An STL-conforming hash table.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
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.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
word name(const complex &)
Return a string representation of a complex.
labelList second(const UList< labelPair > &p)
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.
static autoPtr< functionObjectList > New(const argList &args, const Time &runTime, dictionary &controlDict)
Construct and return a functionObjectList for an application.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#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.
const string & commandLine() const
Return the command line string.
Class containing mesh-to-mesh mapping information.
friend class iterator
Declare friendship with the iterator.
Foam::argList args(argc, argv)
virtual void movePoints(const polyMesh &mesh)
Update topology using the given map.
List< fileName > fileNameList
A List of fileNames.
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.
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
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.