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-2023 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 "inputSyntaxEntry.H"
29 #include "inputModeEntry.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 syntax as this is a "top-level" dictionary
63 
64  // Reset input mode as this is a "top-level" dictionary
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  return false;
156 }
157 
158 
160 {
161  word varName = keyword(1, keyword.size()-1);
162 
163  // lookup the variable name in the given dictionary
164  const entry* ePtr = lookupEntryPtr(varName, true, true);
165 
166  // if defined insert its entries into this dictionary
167  if (ePtr != nullptr)
168  {
169  const dictionary& addDict = ePtr->dict();
170 
171  forAllConstIter(IDLList<entry>, addDict, iter)
172  {
173  add(iter());
174  }
175 
176  return true;
177  }
178 
179  return false;
180 }
181 
182 
183 
184 // * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
185 
187 {
188  // Reset input syntax as this is a "top-level" dictionary
190 
191  // Reset input mode assuming this is a "top-level" dictionary
193 
194  dict.clear();
195  dict.name() = is.name();
196  dict.read(is);
197 
198  return is;
199 }
200 
201 
202 // * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
203 
205 {
206  if (subDict)
207  {
208  os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
209  }
210 
211  forAllConstIter(IDLList<entry>, *this, iter)
212  {
213  const entry& e = *iter;
214 
215  // Write entry
216  os << e;
217 
218  // Add extra new line between entries for "top-level" dictionaries
219  if (!subDict && parent() == dictionary::null && (&e != last()))
220  {
221  os << nl;
222  }
223 
224  // Check stream before going to next entry.
225  if (!os.good())
226  {
228  << "Can't write entry " << iter().keyword()
229  << " for dictionary " << name()
230  << endl;
231  }
232  }
233 
234  if (subDict)
235  {
236  os << decrIndent << indent << token::END_BLOCK << endl;
237  }
238 }
239 
240 
242 {
243  dict.write(os, true);
244  return os;
245 }
246 
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 namespace Foam
251 {
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
256 unsetConfigEntries(const dictionary& configDict)
257 {
258  const wordRe unsetPattern("<.*>");
259  unsetPattern.compile();
260 
261  List<Tuple2<word, string>> unsetArgs;
262 
263  forAllConstIter(IDLList<entry>, configDict, iter)
264  {
265  if (iter().isStream())
266  {
267  ITstream& its = iter().stream();
268  OStringStream oss;
269  bool isUnset = false;
270 
271  forAll(its, i)
272  {
273  oss << its[i];
274  if (its[i].isWord() && unsetPattern.match(its[i].wordToken()))
275  {
276  isUnset = true;
277  }
278  }
279 
280  if (isUnset)
281  {
282  unsetArgs.append
283  (
285  (
286  iter().keyword(),
287  oss.str()
288  )
289  );
290  }
291  }
292  else
293  {
294  List<Tuple2<word, string>> subUnsetArgs =
295  unsetConfigEntries(iter().dict());
296 
297  forAll(subUnsetArgs, i)
298  {
299  unsetArgs.append
300  (
302  (
303  iter().keyword() + '/' + subUnsetArgs[i].first(),
304  subUnsetArgs[i].second()
305  )
306  );
307  }
308  }
309  }
310 
311  return unsetArgs;
312 }
313 
314 
316 (
317  const fileName& dir,
318  HashSet<word>& foMap
319 )
320 {
321  // Search specified directory for configuration files
322  {
323  fileNameList foFiles(fileHandler().readDir(dir));
324  forAll(foFiles, f)
325  {
326  if (foFiles[f].ext().empty())
327  {
328  foMap.insert(foFiles[f]);
329  }
330  }
331  }
332 
333  // Recurse into sub-directories
334  {
336  forAll(foDirs, fd)
337  {
338  listConfigFiles(dir/foDirs[fd], foMap);
339  }
340  }
341 }
342 
343 
344 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
345 
346 } // End namespace Foam
347 
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
349 
351 (
352  const word& configName,
353  const fileName& configFilesPath,
354  const word& region
355 )
356 {
357  // First check if there is a configuration file in the
358  // region system directory
359  {
360  const fileName dictFile
361  (
362  stringOps::expand("$FOAM_CASE")/"system"/region/configName
363  );
364 
365  if (isFile(dictFile))
366  {
367  return dictFile;
368  }
369  }
370 
371  // Next, if the region is specified, check if there is a configuration file
372  // in the global system directory
373  if (region != word::null)
374  {
375  const fileName dictFile
376  (
377  stringOps::expand("$FOAM_CASE")/"system"/configName
378  );
379 
380  if (isFile(dictFile))
381  {
382  return dictFile;
383  }
384  }
385 
386  // Finally, check etc directories
387  {
388  const fileNameList etcDirs(findEtcDirs(configFilesPath));
389 
390  forAll(etcDirs, i)
391  {
392  const fileName dictFile(search(configName, etcDirs[i]));
393 
394  if (!dictFile.empty())
395  {
396  return dictFile;
397  }
398  }
399  }
400 
401  return fileName::null;
402 }
403 
404 
406 (
407  const fileName& configFilesPath
408 )
409 {
410  HashSet<word> foMap;
411 
412  fileNameList etcDirs(findEtcDirs(configFilesPath));
413 
414  forAll(etcDirs, ed)
415  {
416  listConfigFiles(etcDirs[ed], foMap);
417  }
418 
419  return foMap.sortedToc();
420 }
421 
422 
424 (
425  const word& configType,
426  const string& argString,
427  dictionary& parentDict,
428  const fileName& configFilesPath,
429  const Pair<string>& contextTypeAndValue,
430  const word& region
431 )
432 {
433  word funcType;
435  List<Tuple2<word, string>> namedArgs;
436 
437  dictArgList(argString, funcType, args, namedArgs);
438 
439  // Search for the configuration file
440  fileName path = findConfigFile(funcType, configFilesPath, region);
441 
442  if (path == fileName::null)
443  {
444  if (funcType == word::null)
445  {
446  FatalIOErrorInFunction(parentDict)
447  << "configuration file name not specified"
448  << nl << nl
449  << "Available configured objects:"
450  << listAllConfigFiles(configFilesPath)
451  << exit(FatalIOError);
452  }
453  else
454  {
455  FatalIOErrorInFunction(parentDict)
456  << "Cannot find configuration file "
457  << funcType << nl << nl
458  << "Available configured objects:"
459  << listAllConfigFiles(configFilesPath)
460  << exit(FatalIOError);
461  }
462 
463  return false;
464  }
465 
466  // Read the configuration file
467  autoPtr<ISstream> fileStreamPtr(fileHandler().NewIFstream(path));
468  ISstream& fileStream = fileStreamPtr();
469 
470  // Delay processing the functionEntries
471  // until after the argument entries have been added
473  dictionary funcsDict(fileName(funcType), parentDict, fileStream);
475 
476  dictionary* funcDictPtr = &funcsDict;
477 
478  if (funcsDict.found(funcType) && funcsDict.isDict(funcType))
479  {
480  funcDictPtr = &funcsDict.subDict(funcType);
481  }
482 
483  dictionary& funcDict = *funcDictPtr;
484 
485  // Store the funcDict as read for error reporting context
486  const dictionary funcDict0(funcDict);
487 
488  // Insert the 'field' and/or 'fields' and 'objects' entries corresponding
489  // to both the arguments and the named arguments
491  forAll(args, i)
492  {
494  }
495  forAll(namedArgs, i)
496  {
497  if (namedArgs[i].first() == "field")
498  {
499  IStringStream iss(namedArgs[i].second());
500  fieldArgs.append(wordAndDictionary(iss));
501  }
502  if
503  (
504  namedArgs[i].first() == "fields"
505  || namedArgs[i].first() == "objects"
506  )
507  {
508  IStringStream iss(namedArgs[i].second());
509  fieldArgs.append(List<wordAndDictionary>(iss));
510  }
511  }
512  if (fieldArgs.size() == 1)
513  {
514  funcDict.set("field", fieldArgs[0].first());
515  funcDict.merge(fieldArgs[0].second());
516  }
517  if (fieldArgs.size() >= 1)
518  {
519  funcDict.set("fields", fieldArgs);
520  funcDict.set("objects", fieldArgs);
521  }
522 
523  // Insert non-field arguments
524  forAll(namedArgs, i)
525  {
526  if
527  (
528  namedArgs[i].first() != "field"
529  && namedArgs[i].first() != "fields"
530  && namedArgs[i].first() != "objects"
531  && namedArgs[i].first() != "funcName"
532  && namedArgs[i].first() != "name"
533  )
534  {
535  const Pair<word> dAk(dictAndKeyword(namedArgs[i].first()));
536  dictionary& subDict(funcDict.scopedDict(dAk.first()));
537  IStringStream entryStream
538  (
539  dAk.second() + ' ' + namedArgs[i].second() + ';'
540  );
541  subDict.set(entry::New(entryStream).ptr());
542  }
543  }
544 
545  // Insert the region name if specified
546  if (region != word::null)
547  {
548  funcDict.set("region", region);
549  }
550 
551  // Set the name of the entry to that specified by the optional
552  // name argument otherwise automatically generate a unique name
553  // from the type and arguments
554  word entryName(string::validate<word>(argString));
555  forAll(namedArgs, i)
556  {
557  if
558  (
559  namedArgs[i].first() == "funcName"
560  || namedArgs[i].first() == "name"
561  )
562  {
563  entryName = namedArgs[i].second();
564  entryName.strip(" \n");
565  }
566  }
567 
568  // Check for anything in the configuration that has not been set
569  List<Tuple2<word, string>> unsetArgs = unsetConfigEntries(funcDict);
570  bool hasUnsetError = false;
571  forAll(unsetArgs, i)
572  {
573  if
574  (
575  unsetArgs[i].first() != "fields"
576  && unsetArgs[i].first() != "objects"
577  )
578  {
579  hasUnsetError = true;
580  }
581  }
582  if (!hasUnsetError)
583  {
584  forAll(unsetArgs, i)
585  {
586  funcDict.set(unsetArgs[i].first(), wordList());
587  }
588  }
589  else
590  {
591  FatalIOErrorInFunction(funcDict0)
592  << nl;
593 
594  forAll(unsetArgs, i)
595  {
596  FatalIOErrorInFunction(funcDict0)
597  << "Essential value for keyword '" << unsetArgs[i].first()
598  << "' not set" << nl;
599  }
600 
601  FatalIOErrorInFunction(funcDict0)
602  << nl << "In " << configType << " entry:" << nl
603  << " " << argString.c_str() << nl
604  << nl << "In " << contextTypeAndValue.first().c_str() << ":" << nl
605  << " " << contextTypeAndValue.second().c_str() << nl;
606 
607  word funcType;
609  List<Tuple2<word, string>> namedArgs;
610  dictArgList(argString, funcType, args, namedArgs);
611 
612  string argList;
613  forAll(args, i)
614  {
615  args[i].strip(" \n");
616  argList += (argList.size() ? ", " : "") + args[i];
617  }
618  forAll(namedArgs, i)
619  {
620  namedArgs[i].second().strip(" \n");
621  argList +=
622  (argList.size() ? ", " : "")
623  + namedArgs[i].first() + " = " + namedArgs[i].second();
624  }
625  forAll(unsetArgs, i)
626  {
627  unsetArgs[i].second().strip(" \n");
628  argList +=
629  (argList.size() ? ", " : "")
630  + unsetArgs[i].first() + " = " + unsetArgs[i].second();
631  }
632 
633  FatalIOErrorInFunction(funcDict0)
634  << nl << "The " << configType << " entry should be:" << nl
635  << " " << funcType << '(' << argList.c_str() << ')'
636  << exit(FatalIOError);
637  }
638 
639  // Re-parse the funcDict to execute the functionEntries
640  // now that the argument entries have been added
641  dictionary funcArgsDict;
642  funcArgsDict.add(entryName, funcDict);
643  {
644  OStringStream os;
645  funcArgsDict.write(os);
646  funcArgsDict = dictionary
647  (
648  funcType,
649  parentDict,
650  IStringStream(os.str())()
651  );
652  }
653 
654  // Merge this configuration dictionary into parentDict
655  parentDict.merge(funcArgsDict);
656  parentDict.subDict(entryName).name() = funcDict.name();
657 
658  return true;
659 }
660 
661 
662 // * * * * * * * * * * * * * * * IOstream Functions * * * * * * * * * * * * //
663 
664 void Foam::writeEntry(Ostream& os, const dictionary& value)
665 {
666  os << value;
667 }
668 
669 
670 // ************************************************************************* //
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:111
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:217
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:63
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:109
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:160
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:436
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:698
bool substituteKeyword(const word &keyword)
Substitute the given keyword prepended by '$' with the.
Definition: dictionaryIO.C:159
void set(entry *)
Assign a new entry, overwrite any existing entry.
Definition: dictionary.C:1307
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
Definition: dictionaryIO.C:204
bool remove(const word &)
Remove an entry specified by keyword.
Definition: dictionary.C:1332
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:952
const dictionary & parent() const
Return the parent dictionary.
Definition: dictionary.H:320
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:998
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:1169
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:659
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
Definition: dictionary.C:1093
static const dictionary null
Null dictionary.
Definition: dictionary.H:242
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:1454
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:92
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 inputMode to default (ie, merge)
static void clear()
Reset the inputSyntax to the default specified in etc/controlDict.
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:110
@ END_BLOCK
Definition: token.H:111
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:318
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 expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
Definition: stringOps.C:69
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:105
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
void listConfigFiles(const fileName &dir, HashSet< word > &foMap)
Definition: dictionaryIO.C:316
void dictArgList(const string &argString, word &configName, wordReList &args, List< Tuple2< word, string >> &namedArgs)
Parse dictionary substitution argument list.
Definition: dictionary.C:1653
wordList listAllConfigFiles(const fileName &configFilesPath)
Return the list of configuration files in.
Definition: dictionaryIO.C:406
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
bool readConfigFile(const word &configType, const string &argString, dictionary &parentDict, const fileName &configFilesPath, const Pair< string > &contextTypeAndValue, const word &region=word::null)
Read the specified configuration file.
Definition: dictionaryIO.C:424
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
Definition: dictionary.C:1812
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
fileName findConfigFile(const word &configName, const fileName &configFilesPath, const word &region=word::null)
Search for configuration file for given region.
Definition: dictionaryIO.C:351
Istream & operator>>(Istream &, directionInfo &)
Foam::List< Foam::Tuple2< Foam::word, Foam::string > > unsetConfigEntries(const dictionary &configDict)
Definition: dictionaryIO.C:256
IOerror FatalIOError
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
Definition: etcFiles.C:32
Ostream & operator<<(Ostream &, const ensightPart &)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
static const char nl
Definition: Ostream.H:260
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)