dictionaryIO.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "dictionary.H"
27 #include "IOobject.H"
28 #include "inputModeEntry.H"
29 #include "calcIncludeEntry.H"
30 #include "stringOps.H"
31 #include "etcFiles.H"
32 #include "wordAndDictionary.H"
33 #include "OSspecific.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
38 (
39  const fileName& name,
40  const dictionary& parentDict,
41  Istream& is
42 )
43 :
45  (
46  parentDict.name().size()
47  ? parentDict.name()/name
48  : name
49  ),
50  parent_(parentDict)
51 {
52  read(is);
53 }
54 
55 
56 Foam::dictionary::dictionary(Istream& is, const bool keepHeader)
57 :
58  dictionaryName(is.name()),
59  parent_(dictionary::null)
60 {
61  // Reset input mode as this is a "top-level" dictionary
63 
64  // Clear the cache of #calc include files
66 
67  read(is, keepHeader);
68 }
69 
70 
72 (
73  const fileName& fName,
74  const dictionary& parentDict
75 )
76 :
77  dictionary(fName),
78  global_(parentDict.topDict().global())
79 {
80  autoPtr<ISstream> ifsPtr
81  (
82  fileHandler().NewIFstream(fName)
83  );
84  ISstream& ifs = ifsPtr();
85 
86  if (!ifs || !ifs.good())
87  {
88  FatalIOErrorInFunction(parentDict)
89  << "Included dictionary file " << fName
90  << " cannot be found for dictionary " << parentDict.name()
91  << exit(FatalIOError);
92  }
93 
94  read(ifs);
95 }
96 
97 
98 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
99 
101 {
102  return autoPtr<dictionary>(new dictionary(is));
103 }
104 
105 
106 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
107 
108 bool Foam::dictionary::read(Istream& is, const bool keepHeader)
109 {
110  // Check for empty dictionary
111  if (is.eof())
112  {
113  return true;
114  }
115 
116  if (!is.good())
117  {
119  << "Istream not OK for reading dictionary "
120  << exit(FatalIOError);
121 
122  return false;
123  }
124 
125  token currToken(is);
126  if (currToken != token::BEGIN_BLOCK)
127  {
128  is.putBack(currToken);
129  }
130 
131  while (!is.eof() && entry::New(*this, is))
132  {}
133 
134  // normally remove the FoamFile header entry if it exists
135  if (!keepHeader)
136  {
138  }
139 
140  if (is.bad())
141  {
143  << "Istream not OK after reading dictionary " << name()
144  << endl;
145 
146  return false;
147  }
148 
149  return true;
150 }
151 
152 
154 {
155  if (&parent_ != &dictionary::null)
156  {
157  return parent_.global();
158  }
159  else
160  {
161  return false;
162  }
163 }
164 
165 
167 {
168  word varName = keyword(1, keyword.size()-1);
169 
170  // lookup the variable name in the given dictionary
171  const entry* ePtr = lookupEntryPtr(varName, true, true);
172 
173  // if defined insert its entries into this dictionary
174  if (ePtr != nullptr)
175  {
176  const dictionary& addDict = ePtr->dict();
177 
178  forAllConstIter(IDLList<entry>, addDict, iter)
179  {
180  add(iter());
181  }
182 
183  return true;
184  }
185 
186  return false;
187 }
188 
189 
190 
191 // * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
192 
194 {
195  // Reset input mode assuming this is a "top-level" dictionary
197 
198  // Clear the cache of #calc include files
200 
201  dict.clear();
202  dict.name() = is.name();
203  dict.read(is);
204 
205  return is;
206 }
207 
208 
209 // * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
210 
212 {
213  if (subDict)
214  {
215  os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
216  }
217 
218  forAllConstIter(IDLList<entry>, *this, iter)
219  {
220  const entry& e = *iter;
221 
222  // Write entry
223  os << e;
224 
225  // Add extra new line between entries for "top-level" dictionaries
226  if (!subDict && parent() == dictionary::null && (&e != last()))
227  {
228  os << nl;
229  }
230 
231  // Check stream before going to next entry.
232  if (!os.good())
233  {
235  << "Can't write entry " << iter().keyword()
236  << " for dictionary " << name()
237  << endl;
238  }
239  }
240 
241  if (subDict)
242  {
243  os << decrIndent << indent << token::END_BLOCK << endl;
244  }
245 }
246 
247 
249 {
250  dict.write(os, true);
251  return os;
252 }
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 namespace Foam
258 {
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
263 unsetConfigEntries(const dictionary& configDict)
264 {
265  const wordRe unsetPattern("<.*>");
266  unsetPattern.compile();
267 
268  List<Tuple2<word, string>> unsetArgs;
269 
270  forAllConstIter(IDLList<entry>, configDict, iter)
271  {
272  if (iter().isStream())
273  {
274  ITstream& its = iter().stream();
275  OStringStream oss;
276  bool isUnset = false;
277 
278  forAll(its, i)
279  {
280  oss << its[i];
281  if (its[i].isWord() && unsetPattern.match(its[i].wordToken()))
282  {
283  isUnset = true;
284  }
285  }
286 
287  if (isUnset)
288  {
289  unsetArgs.append
290  (
292  (
293  iter().keyword(),
294  oss.str()
295  )
296  );
297  }
298  }
299  else
300  {
301  List<Tuple2<word, string>> subUnsetArgs =
302  unsetConfigEntries(iter().dict());
303 
304  forAll(subUnsetArgs, i)
305  {
306  unsetArgs.append
307  (
309  (
310  iter().keyword() + '/' + subUnsetArgs[i].first(),
311  subUnsetArgs[i].second()
312  )
313  );
314  }
315  }
316  }
317 
318  return unsetArgs;
319 }
320 
321 
323 (
324  const fileName& dir,
325  HashSet<word>& foMap
326 )
327 {
328  // Search specified directory for configuration files
329  {
330  fileNameList foFiles(fileHandler().readDir(dir));
331  forAll(foFiles, f)
332  {
333  if (foFiles[f].ext().empty())
334  {
335  foMap.insert(foFiles[f]);
336  }
337  }
338  }
339 
340  // Recurse into sub-directories
341  {
343  forAll(foDirs, fd)
344  {
345  listConfigFiles(dir/foDirs[fd], foMap);
346  }
347  }
348 }
349 
350 
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
352 
353 } // End namespace Foam
354 
355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356 
358 (
359  const word& configName,
360  const fileName& configFilesPath,
361  const word& configFilesDir,
362  const word& region
363 )
364 {
365  // First check if there is a configuration file in the
366  // region configFilesDir directory
367  {
368  const fileName dictFile
369  (
370  stringOps::expandEnvVar("$FOAM_CASE")
371  /configFilesDir/region/configName
372  );
373 
374  if (isFile(dictFile))
375  {
376  return dictFile;
377  }
378  }
379 
380  // Next, if the region is specified, check if there is a configuration file
381  // in the global configFilesDir directory
382  if (region != word::null)
383  {
384  const fileName dictFile
385  (
386  stringOps::expandEnvVar("$FOAM_CASE")/configFilesDir/configName
387  );
388 
389  if (isFile(dictFile))
390  {
391  return dictFile;
392  }
393  }
394 
395  // Finally, check etc directories
396  {
397  const fileNameList etcDirs(findEtcDirs(configFilesPath));
398 
399  forAll(etcDirs, i)
400  {
401  const fileName dictFile(search(configName, etcDirs[i]));
402 
403  if (!dictFile.empty())
404  {
405  return dictFile;
406  }
407  }
408  }
409 
410  return fileName::null;
411 }
412 
413 
415 (
416  const fileName& configFilesPath
417 )
418 {
419  HashSet<word> foMap;
420 
421  fileNameList etcDirs(findEtcDirs(configFilesPath));
422 
423  forAll(etcDirs, ed)
424  {
425  listConfigFiles(etcDirs[ed], foMap);
426  }
427 
428  return foMap.sortedToc();
429 }
430 
431 
433 (
434  const word& configType,
435  const string& argString,
436  dictionary& parentDict,
437  const fileName& configFilesPath,
438  const word& configFilesDir,
439  const Pair<string>& contextTypeAndValue,
440  const word& region
441 )
442 {
443  word funcType;
445  List<Tuple2<word, string>> namedArgs;
446 
447  dictArgList(argString, funcType, args, namedArgs);
448 
449  // Search for the configuration file
450  fileName path = findConfigFile
451  (
452  funcType,
453  configFilesPath,
454  configFilesDir,
455  region
456  );
457 
458  if (path == fileName::null)
459  {
460  if (funcType == word::null)
461  {
462  FatalIOErrorInFunction(parentDict)
463  << "configuration file name not specified"
464  << nl << nl
465  << "Available configured objects:"
466  << listAllConfigFiles(configFilesPath)
467  << exit(FatalIOError);
468  }
469  else
470  {
471  FatalIOErrorInFunction(parentDict)
472  << "Cannot find configuration file "
473  << funcType << nl << nl
474  << "Available configured objects:"
475  << listAllConfigFiles(configFilesPath)
476  << exit(FatalIOError);
477  }
478 
479  return false;
480  }
481 
482  // Read the configuration file
483  autoPtr<ISstream> fileStreamPtr(fileHandler().NewIFstream(path));
484  ISstream& fileStream = fileStreamPtr();
485 
486  // Delay processing the functionEntries
487  // until after the argument entries have been added
489  dictionary funcsDict(fileName(funcType), parentDict, fileStream);
491 
492  dictionary* funcDictPtr = &funcsDict;
493 
494  if (funcsDict.found(funcType) && funcsDict.isDict(funcType))
495  {
496  funcDictPtr = &funcsDict.subDict(funcType);
497  }
498 
499  dictionary& funcDict = *funcDictPtr;
500 
501  // Store the funcDict as read for error reporting context
502  const dictionary funcDict0(funcDict);
503 
504  // Insert the 'field' and/or 'fields' and 'objects' entries corresponding
505  // to both the arguments and the named arguments
507  forAll(args, i)
508  {
510  }
511  forAll(namedArgs, i)
512  {
513  if (namedArgs[i].first() == "field")
514  {
515  IStringStream iss(namedArgs[i].second());
516  fieldArgs.append(wordAndDictionary(iss));
517  }
518  if
519  (
520  namedArgs[i].first() == "fields"
521  || namedArgs[i].first() == "objects"
522  )
523  {
524  IStringStream iss(namedArgs[i].second());
525  fieldArgs.append(List<wordAndDictionary>(iss));
526  }
527  }
528  if (fieldArgs.size() == 1)
529  {
530  funcDict.set("field", fieldArgs[0].first());
531  funcDict.merge(fieldArgs[0].second());
532  }
533  if (fieldArgs.size() >= 1)
534  {
535  funcDict.set("fields", fieldArgs);
536  funcDict.set("objects", fieldArgs);
537  }
538 
539  // Insert non-field arguments
540  forAll(namedArgs, i)
541  {
542  if
543  (
544  namedArgs[i].first() != "field"
545  && namedArgs[i].first() != "fields"
546  && namedArgs[i].first() != "objects"
547  && namedArgs[i].first() != "funcName"
548  && namedArgs[i].first() != "name"
549  )
550  {
551  const Pair<word> dAk(dictAndKeyword(namedArgs[i].first()));
552  dictionary& subDict(funcDict.scopedDict(dAk.first()));
553  IStringStream entryStream
554  (
555  dAk.second() + ' ' + namedArgs[i].second() + ';'
556  );
557  subDict.set(entry::New(entryStream).ptr());
558  }
559  }
560 
561  // Insert the region name if specified
562  if (region != word::null)
563  {
564  funcDict.set("region", region);
565  }
566 
567  // Set the name of the entry to that specified by the optional
568  // name argument otherwise automatically generate a unique name
569  // from the type and arguments
570  word entryName(string::validate<word>(argString));
571  forAll(namedArgs, i)
572  {
573  if
574  (
575  namedArgs[i].first() == "funcName"
576  || namedArgs[i].first() == "name"
577  )
578  {
579  entryName = namedArgs[i].second();
580  entryName.strip(" \n");
581  }
582  }
583 
584  // Check for anything in the configuration that has not been set
585  List<Tuple2<word, string>> unsetArgs = unsetConfigEntries(funcDict);
586  bool hasUnsetError = false;
587  forAll(unsetArgs, i)
588  {
589  if
590  (
591  unsetArgs[i].first() != "fields"
592  && unsetArgs[i].first() != "objects"
593  )
594  {
595  hasUnsetError = true;
596  }
597  }
598  if (!hasUnsetError)
599  {
600  forAll(unsetArgs, i)
601  {
602  funcDict.set(unsetArgs[i].first(), wordList());
603  }
604  }
605  else
606  {
607  FatalIOErrorInFunction(funcDict0)
608  << nl;
609 
610  forAll(unsetArgs, i)
611  {
612  FatalIOErrorInFunction(funcDict0)
613  << "Essential value for keyword '" << unsetArgs[i].first()
614  << "' not set" << nl;
615  }
616 
617  FatalIOErrorInFunction(funcDict0)
618  << nl << "In " << configType << " entry:" << nl
619  << " " << argString.c_str() << nl
620  << nl << "In " << contextTypeAndValue.first().c_str() << ":" << nl
621  << " " << contextTypeAndValue.second().c_str() << nl;
622 
623  word funcType;
625  List<Tuple2<word, string>> namedArgs;
626  dictArgList(argString, funcType, args, namedArgs);
627 
628  string argList;
629  forAll(args, i)
630  {
631  args[i].strip(" \n");
632  argList += (argList.size() ? ", " : "") + args[i];
633  }
634  forAll(namedArgs, i)
635  {
636  namedArgs[i].second().strip(" \n");
637  argList +=
638  (argList.size() ? ", " : "")
639  + namedArgs[i].first() + " = " + namedArgs[i].second();
640  }
641  forAll(unsetArgs, i)
642  {
643  unsetArgs[i].second().strip(" \n");
644  argList +=
645  (argList.size() ? ", " : "")
646  + unsetArgs[i].first() + " = " + unsetArgs[i].second();
647  }
648 
649  FatalIOErrorInFunction(funcDict0)
650  << nl << "The " << configType << " entry should be:" << nl
651  << " " << funcType << '(' << argList.c_str() << ')'
652  << exit(FatalIOError);
653  }
654 
655  // Re-parse the funcDict to execute the functionEntries
656  // now that the argument entries have been added
657  dictionary funcArgsDict;
658  funcArgsDict.add(entryName, funcDict);
659  {
660  OStringStream os;
661  funcArgsDict.write(os);
662  funcArgsDict = dictionary
663  (
664  funcType,
665  parentDict,
666  IStringStream(os.str())()
667  );
668  }
669 
670  // Merge this configuration dictionary into parentDict
671  parentDict.merge(funcArgsDict);
672  parentDict.subDict(entryName).name() = funcDict.name();
673 
674  return true;
675 }
676 
677 
678 // * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * //
679 
680 void Foam::writeEntry(Ostream& os, const dictionary& value)
681 {
682  os << value;
683 }
684 
685 
686 // ************************************************************************* //
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.
Definition: UList.H:434
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
A HashTable with keys but without contents.
Definition: HashSet.H:62
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:109
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:242
Template class for intrusive linked lists.
Definition: ILList.H:67
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
Definition: IOobject.H:104
virtual const fileName & name() const
Return the name of the stream.
Definition: IOstream.H:294
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:348
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:330
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:336
Generic input stream.
Definition: ISstream.H:55
Input from memory buffer stream.
Definition: IStringStream.H:52
Input token stream.
Definition: ITstream.H:53
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
void putBack(const token &)
Put back token.
Definition: Istream.C:30
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:178
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Output to memory buffer stream.
Definition: OStringStream.H:52
string str() const
Return the string.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
const Type & second() const
Return second.
Definition: Pair.H:110
const Type & first() const
Return first.
Definition: Pair.H:98
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:66
T * last()
Return the last entry.
Definition: UILList.H:121
T * first()
Return the first entry.
Definition: UILList.H:109
T & first()
Return the first element of the list.
Definition: UListI.H:114
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:103
label size() const
Return the number of arguments.
Definition: argListI.H:90
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
includedDictionary(const fileName &fName, const dictionary &parentDict)
Construct an included dictionary for the given parent.
Definition: dictionaryIO.C:72
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:320
virtual bool global() const
Return true if the dictionary global,.
Definition: dictionaryIO.C:153
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
Definition: dictionaryIO.C:108
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
Definition: dictionary.C:548
bool substituteKeyword(const word &keyword)
Substitute the given keyword prepended by '$' with the.
Definition: dictionaryIO.C:166
void set(entry *)
Assign a new entry, overwrite any existing entry.
Definition: dictionary.C:1152
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
Definition: dictionaryIO.C:211
bool remove(const word &)
Remove an entry specified by keyword.
Definition: dictionary.C:1177
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:797
const dictionary & parent() const
Return the parent dictionary.
Definition: dictionary.H:329
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:843
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:1014
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:509
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
Definition: dictionary.C:938
static const dictionary null
Null dictionary.
Definition: dictionary.H:258
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:100
bool merge(const dictionary &)
Merge entries from the given dictionary.
Definition: dictionary.C:1299
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:68
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
Definition: entryIO.C:91
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
static int disableFunctionEntries
Definition: entry.H:86
A class for handling file names.
Definition: fileName.H:82
static const fileName null
An empty fileName.
Definition: fileName.H:97
static void clear()
Reset the cache of #calc include file names.
static void clear()
Reset the inputMode to default (ie, merge)
void strip(const string &)
Strip characters from the start and end of the string.
Definition: string.C:265
A token holds items read from Istream.
Definition: token.H:73
@ BEGIN_BLOCK
Definition: token.H:113
@ END_BLOCK
Definition: token.H:114
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.
Definition: wordRe.H:77
bool compile() const
Compile the regular expression.
Definition: wordReI.H:161
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.
Definition: wordReI.H:202
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
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.
Definition: stringOps.C:241
Namespace for OpenFOAM.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
Definition: POSIX.C:555
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
List< word > wordList
A List of words.
Definition: fileName.H:54
const doubleScalar e
Definition: doubleScalar.H:106
fileName findConfigFile(const word &configName, const fileName &configFilesPath, const word &configFilesDir, const word &region=word::null)
Search for configuration file for given region.
Definition: dictionaryIO.C:358
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:241
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
void listConfigFiles(const fileName &dir, HashSet< word > &foMap)
Definition: dictionaryIO.C:323
bool readConfigFile(const word &configType, const string &argString, dictionary &parentDict, const fileName &configFilesPath, const word &configFilesDir, const Pair< string > &contextTypeAndValue, const word &region=word::null)
Read the specified configuration file.
Definition: dictionaryIO.C:433
void dictArgList(const string &argString, word &configName, wordReList &args, List< Tuple2< word, string >> &namedArgs)
Parse dictionary substitution argument list.
Definition: dictionary.C:1480
wordList listAllConfigFiles(const fileName &configFilesPath)
Return the list of configuration files in.
Definition: dictionaryIO.C:415
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:234
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
Definition: dictionary.C:1639
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
Istream & operator>>(Istream &, pistonPointEdgeData &)
Foam::List< Foam::Tuple2< Foam::word, Foam::string > > unsetConfigEntries(const dictionary &configDict)
Definition: dictionaryIO.C:263
IOerror FatalIOError
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
Definition: etcFiles.C:32
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:227
static const char nl
Definition: Ostream.H:266
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.
Definition: POSIX.C:662
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
labelList f(nPoints)
dictionary dict
Foam::argList args(argc, argv)