47 parentDict.
name().size()
81 global_(parentDict.topDict().global())
89 if (!ifs || !ifs.
good())
92 <<
"Included dictionary file " << fName
93 <<
" cannot be found for dictionary " << parentDict.
name()
122 <<
"Istream not OK for reading dictionary "
130 const Istream* filePtr0 = filePtr_;
154 <<
"Istream not OK after reading dictionary " <<
name()
183 word varName = keyword(1, keyword.size()-1);
250 <<
"Can't write entry " << iter().keyword()
251 <<
" for dictionary " <<
name()
265 dict.write(os,
true);
280 const wordRe unsetPattern(
"<.*>");
287 if (iter().isStream())
291 bool isUnset =
false;
296 if (its[i].isWord() && unsetPattern.
match(its[i].wordToken()))
325 iter().keyword() +
'/' + subUnsetArgs[i].
first(),
348 if (foFiles[
f].ext().empty())
374 const word& configName,
376 const word& configFilesDir,
386 /configFilesDir/region/configName
418 if (!dictFile.empty())
451 const label lineNumber
457 string expandedArg(arg);
461 dict.remove(
"dummy_");
472 const label lineNumber
478 if (argEntry.
valid())
485 <<
"Cannot construct argument entry from string "
486 << entryStream.
str() <<
nl
487 <<
" on line " << lineNumber <<
" of dictionary " <<
dict.name()
495 const word& configType,
499 const word& configFilesDir,
523 <<
"configuration file name not specified"
525 <<
"Available configured objects:"
532 <<
"Cannot find configuration file "
533 << funcType <<
nl <<
nl
534 <<
"Available configured objects:"
544 ISstream& fileStream = fileStreamPtr();
571 if (namedArgs[i].
first() ==
"field")
578 namedArgs[i].
first() ==
"fields"
579 || namedArgs[i].
first() ==
"objects"
586 if (fieldArgs.
size() == 1)
588 funcDict.set(
"field", fieldArgs[0].
first());
591 if (fieldArgs.
size() >= 1)
593 funcDict.set(
"fields", fieldArgs);
594 funcDict.set(
"objects", fieldArgs);
602 namedArgs[i].
first() !=
"field"
603 && namedArgs[i].
first() !=
"fields"
604 && namedArgs[i].
first() !=
"objects"
605 && namedArgs[i].
first() !=
"funcName"
606 && namedArgs[i].
first() !=
"name"
629 funcDict.set(
"region", region);
635 word entryName(funcType);
643 namedArgs[i].
first() ==
"funcName"
644 || namedArgs[i].
first() ==
"name"
653 entryName.
strip(
" \n");
667 entryName +=
args[i].first();
675 entryName += namedArgs[i].
first();
685 string::stripInvalid<word>(entryName);
691 bool hasUnsetError =
false;
696 unsetArgs[i].
first() !=
"fields"
697 && unsetArgs[i].
first() !=
"objects"
700 hasUnsetError =
true;
718 <<
"Essential value for keyword '" << unsetArgs[i].
first()
719 <<
"' not set" <<
nl;
723 <<
nl <<
"in " << configType <<
" entry:" <<
nl
724 << argStringLine.
first().c_str() <<
nl
725 <<
nl <<
"in dictionary " << parentDict.
name().c_str()
726 <<
" starting at line " << argStringLine.
second() <<
nl;
736 args[i].first().strip(
" \n");
741 namedArgs[i].second().strip(
" \n");
744 + namedArgs[i].
first() +
" = " + namedArgs[i].second();
748 unsetArgs[i].second().strip(
" \n");
751 + unsetArgs[i].
first() +
" = " + unsetArgs[i].second();
755 <<
nl <<
"The " << configType <<
" entry should be:" <<
nl
756 <<
" " << funcType <<
'(' <<
argList.c_str() <<
')'
763 funcArgsDict.
add(entryName, funcDict);
767 funcArgsDict.
write(os);
777 parentDict.
merge(funcArgsDict);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Template class for intrusive linked lists.
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
label lineNumber() const
Return current stream line number.
virtual const fileName & name() const
Return the name of the stream.
bool bad() const
Return true if stream is corrupted.
bool good() const
Return true if next operation might succeed.
bool eof() const
Return true if end of input seen.
Input from memory buffer stream.
string str() const
Return the string.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &)
Put back token.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Output to memory buffer stream.
string str() const
Return the string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Type & second() const
Return second.
const Type & first() const
Return first.
A 2-tuple for storing two objects of different types.
const Type2 & second() const
Return second.
const Type1 & first() const
Return first.
T * last()
Return the last entry.
T * first()
Return the first entry.
T & first()
Return the first element of the list.
Extract command arguments and options from the supplied argc and argv parameters.
label size() const
Return the number of arguments.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
T * ptr()
Return object pointer for reuse.
const fileName & name() const
Return the dictionary name.
includedDictionary(const fileName &fName, const dictionary &parentDict)
Construct an included dictionary for the given parent.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
dictionary()
Construct top-level dictionary null.
virtual bool global() const
Return true if the dictionary global,.
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
bool substituteKeyword(const word &keyword)
Substitute the given keyword prepended by '$' with the.
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
bool remove(const word &)
Remove an entry specified by keyword.
const dictionary & parent() const
Return the parent dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
static const dictionary null
Null dictionary.
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
bool merge(const dictionary &)
Merge entries from the given dictionary.
A keyword and a list of tokens is an 'entry'.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
static int disableFunctionEntries
A class for handling file names.
static const fileName null
An empty fileName.
static void clear()
Reset the cache of #calc include file names.
static void clear()
Reset the inputMode to default (ie, merge)
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
A class for handling character strings derived from std::string.
void strip(const string &)
Strip characters from the start and end of the string.
A token holds items read from Istream.
Tuple of a word and dictionary, used to read in per-field options for function objects in the followi...
A wordRe is a word, but can also have a regular expression for matching words.
bool compile() const
Compile the regular expression.
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.
A class for handling words, derived from string.
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Functions to search 'etc' directories for configuration files etc.
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
string expandEnvVar(const string &, const bool allowEmpty=false)
Expand all occurrences of environment variables and paths.
string & inplaceExpandEntry(string &s, const dictionary &dict, const bool allowEnvVars, const bool allowEmpty, const char sigil='$')
Inplace expand occurrences of variables according to the dictionary.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
fileName findConfigFile(const word &configName, const fileName &configFilesPath, const word &configFilesDir, const word ®ion=word::null)
Search for configuration file for given region.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void dictArgList(const Tuple2< string, label > &argString, word &configName, List< Tuple2< wordRe, label >> &args, List< Tuple3< word, string, label >> &namedArgs)
Parse dictionary substitution argument list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void listConfigFiles(const fileName &dir, HashSet< word > &foMap)
wordList listAllConfigFiles(const fileName &configFilesPath)
Return the list of configuration files in.
labelList second(const UList< labelPair > &p)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
bool readConfigFile(const word &configType, const Tuple2< string, label > &argString, dictionary &parentDict, const fileName &configFilesPath, const word &configFilesDir, const word ®ion=word::null)
Read the specified configuration file.
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
void addArgEntry(dictionary &dict, const word &keyword, const string &value, const label lineNumber)
Add the keyword value pair to dict.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Istream & operator>>(Istream &, pistonPointEdgeData &)
Foam::List< Foam::Tuple2< Foam::word, Foam::string > > unsetConfigEntries(const dictionary &configDict)
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
Ostream & indent(Ostream &os)
Indent stream.
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.
string expandArg(const string &arg, dictionary &dict, const label lineNumber)
Expand arg within the dict context and return.
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Foam::argList args(argc, argv)