43 "caseDicts/postProcessing" 55 functionObject* ptr = 0;
60 if (fnd != indices_.
end())
65 ptr = this->
set(oldIndex, 0).ptr();
77 void Foam::functionObjectList::listDir
88 if (foFiles[
f].ext().
empty())
90 foMap.insert(foFiles[
f]);
100 listDir(dir/foDirs[fd], foMap);
114 listDir(etcDirs[ed], foMap);
118 <<
"Available configured functionObjects:" 126 const word& funcName,
167 if (!dictFile.empty())
178 void Foam::functionObjectList::checkUnsetEntries
180 const string& funcCall,
183 const string& context
186 const wordRe unset(
"<.*>");
191 if (iter().isStream())
197 if (tokens[i].isWord())
199 if (unset.
match(tokens[i].wordToken()))
202 <<
"Essential value for keyword '" 204 <<
"' not set in function entry" <<
nl 205 <<
" " << funcCall.c_str() <<
nl 206 <<
" in " << context.c_str() <<
nl 207 <<
" Placeholder value is " 208 << tokens[i].wordToken()
216 checkUnsetEntries(funcCall, iter().
dict(), funcDict, context);
224 const string& funcCall,
226 const string& context,
231 word funcName(funcCall);
237 bool namedArg =
false;
245 word::const_iterator iter = funcCall.begin();
246 iter != funcCall.end();
256 funcName = funcCall(start, i - start);
261 else if (c ==
',' || c ==
')')
272 funcCall(start, i - start)
295 argName = string::validate<word>(funcCall(start, i - start));
304 string::stripInvalid<word>(funcName);
312 <<
"Cannot find functionObject file " << funcName <<
endl;
319 ISstream& fileStream = fileStreamPtr();
324 dictionary funcsDict(funcName, functionsDict, fileStream);
329 if (funcsDict.
found(funcName) && funcsDict.
isDict(funcName))
331 funcDictPtr = &funcsDict.
subDict(funcName);
348 if (namedArgs[i].
first() ==
"field")
355 namedArgs[i].
first() ==
"fields" 356 || namedArgs[i].
first() ==
"objects" 363 if (fieldArgs.
size() == 1)
365 funcDict.
set(
"field", fieldArgs[0].
first());
366 funcDict.
merge(fieldArgs[0].second());
368 if (fieldArgs.
size() >= 1)
370 funcDict.
set(
"fields", fieldArgs);
371 funcDict.
set(
"objects", fieldArgs);
379 namedArgs[i].
first() !=
"field" 380 && namedArgs[i].
first() !=
"fields" 381 && namedArgs[i].
first() !=
"objects" 386 namedArgs[i].
first() +
' ' + namedArgs[i].second() +
';' 395 funcDict.
set(
"region", region);
398 const word funcCallKeyword = string::validate<word>(funcCall);
400 funcArgsDict.
add(funcCallKeyword, funcDict);
406 funcArgsDict.
write(os);
416 checkUnsetEntries(funcCall, funcArgsDict, funcDict0, context);
421 if (functionObject::debug)
425 << funcCall << expandedFuncDict
428 if (expandedFuncDict.
found(
"field"))
432 if (expandedFuncDict.
found(
"fields"))
440 if (expandedFuncDict.
found(
"objects"))
450 functionsDict.
merge(funcArgsDict);
470 execution_(execution),
486 parentDict_(parentDict),
487 execution_(execution),
514 region = args[
"region"];
576 functionsPtr->read();
603 if (
operator[](oi).
name() == name)
622 updated_ = execution_ =
false;
640 if (
operator[](oi).executeAtStart())
717 if (names.
size() > 1)
720 for (
label i = 1; i < names.size(); ++ i)
734 scalar result = vGreat;
756 updated_ = execution_;
783 <<
"'functions' entry is not a dictionary" 793 functionObject::dictionaryConstructorTablePtr_
796 newPtrs.
setSize(functionsDict.size());
797 newDigs.
setSize(functionsDict.size());
801 const word& key = iter().keyword();
803 if (!iter().isDict())
808 <<
"Entry " << key <<
" is not a dictionary" <<
endl;
817 newDigs[nFunc] = dict.
digest();
827 if (newDigs[nFunc] != digests_[oldIndex])
829 ok = objPtr->
read(dict) && ok;
850 dict.
found(
"writeControl")
851 || dict.
found(
"outputControl")
872 <<
"Caught FatalError " << err <<
nl <<
endl;
879 objPtr = foPtr.
ptr();
890 newPtrs.
set(nFunc, objPtr);
891 newIndices.
insert(key, nFunc);
902 digests_.transfer(newDigs);
Template class for intrusive linked lists.
bool read()
Read and set the function objects if their data have changed.
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.
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.
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 dictionary null
Null dictionary.
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.
T * ptr()
Return object pointer for reuse.
const dimensionedScalar & c
Speed of light in a vacuum.
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.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
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.
static int disableFunctionEntries
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.
static bool readFunctionObject(const string &funcCall, dictionary &functionsDict, const string &context, HashSet< word > &requiredFields, const word ®ion=word::null)
Read the specified functionObject configuration dictionary.
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.
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.
graph_traits< Graph >::vertices_size_type size_type
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.
virtual Ostream & write(const char)
Write character.
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.
void clear()
Clear the list of function objects.
void setSize(const label)
Reset size of List.
bool setTimeStep()
Override the time-step value.
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
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 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...
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.
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'.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
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.