75 global_(parentDict.topDict().global())
83 if (!ifs || !ifs.
good())
86 <<
"Included dictionary file " << fName
87 <<
" cannot be found for dictionary " << parentDict.
name()
116 <<
"Istream not OK for reading dictionary "
123 const Istream* filePtr0 = filePtr_;
146 <<
"Istream not OK after reading dictionary " <<
name()
174 word varName = keyword(1, keyword.size()-1);
238 <<
"Can't write entry " << iter().keyword()
239 <<
" for dictionary " <<
name()
253 dict.write(os,
true);
268 const wordRe unsetPattern(
"<.*>");
275 if (iter().isStream())
279 bool isUnset =
false;
284 if (its[i].isWord() && unsetPattern.
match(its[i].wordToken()))
313 iter().keyword() +
'/' + subUnsetArgs[i].
first(),
336 if (foFiles[
f].ext().empty())
362 const word& configName,
364 const word& configFilesDir,
374 /configFilesDir/
region/configName
406 if (!dictFile.empty())
439 const label lineNumber
445 string expandedArg(arg);
449 dict.remove(
"dummy_");
460 const label lineNumber
466 if (argEntry.
valid())
473 <<
"Cannot construct argument entry from string "
474 << entryStream.
str() <<
nl
475 <<
" on line " << lineNumber <<
" of dictionary " <<
dict.name()
483 const word& configType,
487 const word& configFilesDir,
489 const string& command
512 <<
"configuration file name not specified"
514 <<
"Available configured objects:"
521 <<
"Cannot find configuration file "
522 << funcType <<
nl <<
nl
523 <<
"Available configured objects:"
533 ISstream& fileStream = fileStreamPtr();
550 if (
const_cast<const wordRe&
>(
args[i].
first()).strip(
" \n") ==
"print")
568 if (namedArgs[i].
first() ==
"field")
575 namedArgs[i].
first() ==
"fields"
576 || namedArgs[i].
first() ==
"objects"
583 if (fieldArgs.
size() == 1)
585 funcDict.set(
"field", fieldArgs[0].
first());
588 if (fieldArgs.
size() >= 1)
590 funcDict.set(
"fields", fieldArgs);
591 funcDict.set(
"objects", fieldArgs);
599 namedArgs[i].
first() !=
"field"
600 && namedArgs[i].
first() !=
"fields"
601 && namedArgs[i].
first() !=
"objects"
602 && namedArgs[i].
first() !=
"funcName"
603 && namedArgs[i].
first() !=
"name"
626 funcDict.set(
"region",
region);
632 word entryName(funcType);
640 namedArgs[i].
first() ==
"funcName"
641 || namedArgs[i].
first() ==
"name"
650 entryName.
strip(
" \n");
664 entryName +=
args[i].first();
672 entryName += namedArgs[i].
first();
682 string::stripInvalid<word>(entryName);
688 bool hasUnsetError =
false;
693 unsetArgs[i].
first() !=
"fields"
694 && unsetArgs[i].
first() !=
"objects"
697 hasUnsetError =
true;
715 <<
"Essential value for keyword '" << unsetArgs[i].
first()
716 <<
"' not set" <<
nl;
720 <<
nl <<
"In " << configType <<
" entry:" <<
nl
721 <<
" " << argStringLine.
first().c_str() <<
nl;
726 <<
nl <<
"In command:" <<
nl
727 <<
" " << command.c_str() <<
endl;
730 if (argStringLine.
second() >= 0)
733 <<
nl <<
"In dictionary:" <<
nl
734 <<
" " << parentDict.
name().c_str()
735 <<
" starting at line " << argStringLine.
second() <<
nl;
739 <<
nl <<
"Including file:" <<
nl
740 <<
" " << path.c_str() <<
nl;
750 args[i].first().strip(
" \n");
755 namedArgs[i].second().strip(
" \n");
758 + namedArgs[i].
first() +
" = " + namedArgs[i].second();
762 unsetArgs[i].second().strip(
" \n");
765 + unsetArgs[i].
first() +
" = " + unsetArgs[i].second();
769 <<
nl <<
"The " << configType <<
" entry should be:" <<
nl
770 <<
" " << funcType <<
'(' <<
argList.c_str() <<
')'
777 funcArgsDict.
add(entryName, funcDict);
781 funcArgsDict.
write(os);
791 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.
virtual const fileName & name() const
Return the name of the stream.
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)....
bool good() const
Return true if next operation might succeed.
void putBack(const token &)
Put back token.
bool eof() const
Return true if end of input seen.
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.
virtual const fileName & name() const
Return the name of the stream.
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 inputMode to default (ie, merge)
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
static void set(const dictionary &dict)
Set the dictionary to be printed.
A class for handling character strings derived from std::string.
static const string null
An empty 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.
dictionary & configDict()
The central control dictionary.
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.
Istream & operator>>(Istream &, pointEdgeDist &)
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.
const fvMesh & region(const dictionary &dict)
Cast the give dictionary to the corresponding region fvMesh.
labelList second(const UList< labelPair > &p)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
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.
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.
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
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.
bool readConfigFile(const word &configType, const Tuple2< string, label > &argString, dictionary &parentDict, const fileName &configFilesPath, const word &configFilesDir, const word ®ion=word::null, const string &command=string::null)
Read the specified configuration file.
Foam::argList args(argc, argv)