foamDictionary.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) 2016-2025 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 Application
25  foamDictionary
26 
27 Description
28  Interrogates and manipulates dictionaries.
29 
30  Supports parallel operation for decomposed dictionary files associated with
31  a case. These may be mesh or field files or any other decomposed
32  dictionaries.
33 
34 Usage
35  \b foamDictionary [OPTION] dictionary
36 
37  - \par -case <dir>
38  Select a case directory instead of the current working directory
39 
40  - \par -parallel
41  Specify case as a parallel job
42 
43  - \par -doc
44  Display the documentation in browser
45 
46  - \par -srcDoc
47  Display the source documentation in browser
48 
49  - \par -help
50  Print the usage
51 
52  - \par -entry <name>
53  Selects an entry
54 
55  - \par -keywords <name>
56  Prints the keywords (of the selected entry or of the top level if
57  no entry was selected
58 
59  - \par -rename <newName>
60  Renames the entry selected by \c -entry
61 
62  - \par -rename <newNames>
63  Renames a list of entries specified in the form:
64  "<entryName0>=<newName0>, <entryName1>=<newName1>..."
65 
66  - \par -add <value>
67  Adds the entry (should not exist yet)
68 
69  - \par -set <value>
70  Adds or replaces the entry selected by \c -entry
71 
72  - \par -set <substitutions>
73  Applies the list of substitutions specified in the form:
74  "<entry0>=<value0>, <entry1>=<value1>..."
75 
76  - \par -merge <value>
77  Merges the entry
78 
79  - \par -dict
80  Set, add or merge entry from a dictionary
81 
82  - \par -remove
83  Remove the selected entry
84 
85  - \par -diff <dictionary>
86  Write differences with respect to the specified dictionary
87  (or sub entry if -entry specified)
88 
89  - \par -expand
90  Read the specified dictionary file, expand the macros etc.
91  Writes the expanded dictionary to the output dictionary if specified
92  otherwise to standard output
93 
94  - \par -includes
95  List the \c \#include and \c \#includeIfPresent files to standard output
96 
97  - \par -output
98  Path name of the output dictionary, defaults to the input dictionary
99 
100  - \par -quiet
101  Operate without outputting to the terminal or raising errors. Just use
102  an exit code to indicate success or failure.
103 
104  Example usage:
105  - Change simulation to run for one timestep only:
106  \verbatim
107  foamDictionary system/controlDict -entry stopAt -set writeNow
108  \endverbatim
109 
110  - Change solver:
111  \verbatim
112  foamDictionary system/fvSolution -entry solvers/p/solver -set PCG
113  \endverbatim
114 
115  - Print bc type:
116  \verbatim
117  foamDictionary 0/U -entry boundaryField/movingWall/type
118  \endverbatim
119 
120  - Change bc parameter:
121  \verbatim
122  foamDictionary 0/U -entry boundaryField/movingWall/value \
123  -set "uniform (2 0 0)"
124  \endverbatim
125 
126  - Change bc parameter in parallel:
127  \verbatim
128  mpirun -np 4 foamDictionary 0.5/U \
129  -entry boundaryField/movingWall/value \
130  -set "uniform (2 0 0)" -parallel
131  \endverbatim
132 
133  - Change whole bc type:
134  \verbatim
135  foamDictionary 0/U -entry boundaryField/movingWall \
136  -set "{type uniformFixedValue; uniformValue (2 0 0);}"
137  \endverbatim
138 
139  - Write the differences with respect to a template dictionary:
140  \verbatim
141  foamDictionary 0/U -diff $FOAM_ETC/templates/closedVolume/0/U
142  \endverbatim
143 
144  - Write the differences in boundaryField with respect to a
145  template dictionary:
146  \verbatim
147  foamDictionary 0/U -diff $FOAM_ETC/templates/closedVolume/0/U \
148  -entry boundaryField
149  \endverbatim
150 
151  - Change patch type:
152  \verbatim
153  foamDictionary constant/polyMesh/boundary \
154  -entry entry0/fixedWalls/type -set patch
155  \endverbatim
156  This uses special parsing of Lists which stores these in the
157  dictionary with keyword 'entryDDD' where DDD is the position
158  in the dictionary (after ignoring the FoamFile entry).
159 
160  - Substitute multiple entries:
161  \verbatim
162  foamDictionary system/controlDict -set "startTime=2000, endTime=3000"
163  \endverbatim
164 
165 \*---------------------------------------------------------------------------*/
166 
167 #include "argList.H"
168 #include "Time.H"
169 #include "localIOdictionary.H"
170 #include "Pair.H"
171 #include "IFstream.H"
172 #include "OFstream.H"
173 #include "includeEntry.H"
174 #include "mergeDictionaries.H"
175 
176 using namespace Foam;
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 //- Read dictionary from file and return
181 // Sets stream to binary mode if specified in the optional header
182 IOstream::streamFormat readDict(dictionary& dict, const fileName& dictFileName)
183 {
185 
186  // Read the first entry and if it is FoamFile set the file format
187  {
188  IFstream dictFile(dictFileName);
189  if (!dictFile().good())
190  {
192  << "Cannot open file " << dictFileName
193  << exit(FatalError, 1);
194  }
195 
196  // Check if the first token in the file is "FoamFile"
197  // to avoid problems if the first entry is a variable or function
198  token firstToken;
199  dictFile.read(firstToken);
200  if (firstToken.isWord() && firstToken.wordToken() == IOobject::foamFile)
201  {
202  dictFile.putBack(firstToken);
203 
204  // Read the first entry from the dictionary
205  autoPtr<entry> firstEntry(entry::New(dictFile()));
206 
207  // If the first entry is the "FoamFile" header
208  // read and set the stream format
209  if
210  (
211  firstEntry->isDict()
212  && firstEntry->keyword() == IOobject::foamFile
213  )
214  {
215  dictFormat = IOstream::formatEnum
216  (
217  firstEntry->dict().lookup("format")
218  );
219  }
220  }
221  }
222 
223  IFstream dictFile(dictFileName, dictFormat);
224 
225  // Read and add the rest of the dictionary entries
226  // preserving the IOobject::foamFile header dictionary if present
227  dict.read(dictFile(), true);
228 
229  return dictFormat;
230 }
231 
232 
233 void remove(dictionary& dict, const dictionary& removeDict)
234 {
235  forAllConstIter(dictionary, removeDict, iter)
236  {
237  entry* entPtr = dict.lookupEntryPtr
238  (
239  iter().keyword(),
240  false,
241  false
242  );
243 
244  if (entPtr)
245  {
246  if (entPtr->isDict())
247  {
248  if (iter().isDict())
249  {
250  remove(entPtr->dict(), iter().dict());
251 
252  // Check if dictionary is empty
253  if (!entPtr->dict().size())
254  {
255  dict.remove(iter().keyword());
256  }
257  }
258  }
259  else if (!iter().isDict())
260  {
261  if (*entPtr == iter())
262  {
263  dict.remove(iter().keyword());
264  }
265  }
266  }
267  }
268 }
269 
270 
271 void rename(dictionary& dict, const string& newNames)
272 {
275  dictArgList({newNames, 0}, args, namedArgs);
276 
277  forAll(namedArgs, i)
278  {
279  const Pair<word> dAk(dictAndKeyword(namedArgs[i].first()));
280  dictionary& subDict(dict.scopedDict(dAk.first()));
281  subDict.changeKeyword(dAk.second(), word(namedArgs[i].second()));
282  }
283 }
284 
285 
286 void substitute(dictionary& dict, const string& substitutions)
287 {
290  dictArgList({substitutions, 0}, args, namedArgs);
291 
292  forAll(args, i)
293  {
294  const Pair<word> dAk(dictAndKeyword(args[i].first()));
295  dictionary& subDict(dict.scopedDict(dAk.first()));
296  IStringStream entryStream
297  (
298  dAk.second() + ';'
299  );
300  subDict.set(entry::New(entryStream).ptr());
301  }
302 
303  forAll(namedArgs, i)
304  {
305  const Pair<word> dAk(dictAndKeyword(namedArgs[i].first()));
306  dictionary& subDict(dict.scopedDict(dAk.first()));
307  IStringStream entryStream
308  (
309  dAk.second() + ' ' + namedArgs[i].second() + ';'
310  );
311  subDict.set(entry::New(entryStream).ptr());
312  }
313 }
314 
315 
316 int main(int argc, char *argv[])
317 {
318  writeInfoHeader = false;
319 
320  argList::addNote("manipulates dictionaries");
321 
322  argList::validArgs.append("dictionary file");
323 
324  argList::addBoolOption("keywords", "list keywords");
325  argList::addOption("entry", "name", "report/select the named entry");
327  (
328  "value",
329  "Print entry value"
330  );
332  (
333  "rename",
334  "name",
335  "Rename entry or list of entries"
336  );
338  (
339  "set",
340  "value",
341  "Set entry value, add new entry or apply list of substitutions"
342  );
344  (
345  "add",
346  "value",
347  "Add a new entry"
348  );
350  (
351  "merge",
352  "value",
353  "Merge entry"
354  );
356  (
357  "dict",
358  "Set, add or merge entry from a dictionary."
359  );
361  (
362  "remove",
363  "Remove the entry."
364  );
366  (
367  "diff",
368  "dict",
369  "Write differences with respect to the specified dictionary"
370  );
372  (
373  "includes",
374  "List the #include/#includeIfPresent files to standard output"
375  );
377  (
378  "expand",
379  "Read the specified dictionary file and expand the macros etc."
380  );
382  (
383  "writePrecision",
384  "label",
385  "Write with the specified precision"
386  );
388  (
389  "output",
390  "path name",
391  "Path name of the output dictionary"
392  );
394  (
395  "quiet",
396  "Operate without outputting to the terminal or raising errors"
397  );
398 
399  argList args(argc, argv);
400 
401  const bool listIncludes = args.optionFound("includes");
402 
403  if (listIncludes)
404  {
406  }
407 
408  // Do not expand functionEntries except during dictionary expansion
409  // with the -expand option
410  if (!args.optionFound("expand"))
411  {
413  }
414 
415  // Do not write info if the quiet option is set
416  const bool quiet = args.optionFound("quiet");
417  if (quiet) messageStream::level = 0;
418 
419  // Set write precision
420  if (args.optionFound("writePrecision"))
421  {
422  const label writePrecision = args.optionRead<label>("writePrecision");
423  IOstream::defaultPrecision(writePrecision);
424  Sout.precision(writePrecision);
426  }
427 
428  const fileName dictPath(args[1]);
429 
430  Time* runTimePtr = nullptr;
431  localIOdictionary* localDictPtr = nullptr;
432 
433  dictionary* dictPtr = nullptr;
435 
436  // When running in parallel read the dictionary as a case localIOdictionary
437  // supporting file handlers
438  if (Pstream::parRun())
439  {
440  if (!args.checkRootCase())
441  {
442  FatalError.exit();
443  }
444 
446 
447  const wordList dictPathComponents(dictPath.components());
448 
449  if (dictPathComponents.size() == 1)
450  {
452  << "File name " << dictPath
453  << " does not contain an instance path needed in parallel"
454  << exit(FatalError, 1);
455  }
456 
457  const word instance = dictPathComponents[0];
458  const fileName dictFileName
459  (
460  SubList<word>(dictPathComponents, dictPathComponents.size() - 1, 1)
461  );
462 
463  scalar time;
464  if (readScalar(instance.c_str(), time))
465  {
466  runTimePtr->setTime(time, 0);
467  }
468 
469  localDictPtr = new localIOdictionary
470  (
471  IOobject
472  (
473  dictFileName,
474  instance,
475  *runTimePtr,
478  false
479  )
480  );
481  }
482  else
483  {
484  dictPtr = new dictionary(dictPath);
485  dictFormat =
486  readDict
487  (
488  *dictPtr,
489  dictPath.isAbsolute()
490  ? dictPath
491  : args.path()/dictPath
492  );
493  }
494 
495  dictionary& dict = localDictPtr ? *localDictPtr : *dictPtr;
496 
497  bool changed = false;
498 
499  if (listIncludes)
500  {
501  return 0;
502  }
503  else if (args.optionFound("expand") && !args.optionFound("entry"))
504  {
505  if (!args.optionFound("output"))
506  {
508  <<"//\n// " << dictPath << "\n//\n";
509 
510  // Change the format to ASCII
512  {
514  (
515  "format",
517  true
518  );
519  }
520 
521  dict.dictionary::write(Info, false);
523 
524  return 0;
525  }
526  else
527  {
528  changed = true;
529  }
530  }
531 
532  word entryName;
533  fileName diffFileName;
534  if (args.optionReadIfPresent("entry", entryName))
535  {
536  const word scopedName(entryName);
537 
538  string newValue;
539 
540  if (args.optionReadIfPresent("rename", newValue))
541  {
542  // Extract dictionary name and keyword
543  const Pair<word> dAk(dictAndKeyword(scopedName));
544 
545  dictionary& subDict(dict.scopedDict(dAk.first()));
546 
547  subDict.changeKeyword(dAk.second(), word(newValue));
548 
549  changed = true;
550  }
551  else if
552  (
553  args.optionReadIfPresent("set", newValue)
554  || args.optionReadIfPresent("add", newValue)
555  || args.optionReadIfPresent("merge", newValue)
556  )
557  {
558  const bool overwrite = args.optionFound("set");
559  const bool merge = args.optionFound("merge");
560 
561  // Extract dictionary name and keyword
562  const Pair<word> dAk(dictAndKeyword(scopedName));
563 
564  dictionary& subDict(dict.scopedDict(dAk.first()));
565 
566  entry* ePtr = nullptr;
567 
568  if (args.optionFound("dict"))
569  {
570  const fileName fromDictFileName(newValue);
571  dictionary fromDict;
572  readDict(fromDict, fromDictFileName);
573 
574  const entry* fePtr
575  (
576  fromDict.lookupScopedEntryPtr
577  (
578  scopedName,
579  false,
580  true // Support wildcards
581  )
582  );
583 
584  if (!fePtr)
585  {
587  << "Cannot find entry " << entryName
588  << " in file " << fromDictFileName
589  << exit(FatalError, 1);
590  }
591 
592  ePtr = fePtr->clone().ptr();
593  }
594  else
595  {
596  IStringStream str(string(dAk.second()) + ' ' + newValue + ';');
597  ePtr = entry::New(str).ptr();
598  }
599 
600  if (overwrite)
601  {
602  Info << "New entry " << *ePtr << endl;
603  subDict.set(ePtr);
604  }
605  else
606  {
607  subDict.add(ePtr, merge);
608  }
609  changed = true;
610  }
611  else if (args.optionFound("remove"))
612  {
613  // Extract dictionary name and keyword
614  const Pair<word> dAk(dictAndKeyword(scopedName));
615 
616  dictionary& subDict(dict.scopedDict(dAk.first()));
617  subDict.remove(dAk.second());
618  changed = true;
619  }
620  else
621  {
622  if (args.optionReadIfPresent("diff", diffFileName))
623  {
624  dictionary diffDict;
625  readDict(diffDict, diffFileName);
626 
627  const Pair<word> dAk(dictAndKeyword(scopedName));
628 
629  dictionary& subDict(dict.scopedDict(dAk.first()));
630  const dictionary& subDict2(diffDict.scopedDict(dAk.first()));
631 
632  entry* ePtr =
633  subDict.lookupEntryPtr(dAk.second(), false, true);
634  const entry* e2Ptr =
635  subDict2.lookupEntryPtr(dAk.second(), false, true);
636 
637  if (ePtr && e2Ptr)
638  {
639  if (*ePtr == *e2Ptr)
640  {
641  subDict.remove(dAk.second());
642  }
643  else if (ePtr->isDict() && e2Ptr->isDict())
644  {
645  remove(ePtr->dict(), e2Ptr->dict());
646  }
647  }
648  }
649 
650  const entry* entPtr = dict.lookupScopedEntryPtr
651  (
652  scopedName,
653  false,
654  true // Support wildcards
655  );
656 
657  if (entPtr)
658  {
659  if (args.optionFound("keywords"))
660  {
661  const dictionary& dict = entPtr->dict();
663  {
664  Info<< iter().keyword() << endl;
665  }
666  }
667  else
668  {
669  if (args.optionFound("value"))
670  {
671  if (entPtr->isStream())
672  {
673  const tokenList& tokens = entPtr->stream();
674  forAll(tokens, i)
675  {
676  Info<< tokens[i];
677  if (i < tokens.size() - 1)
678  {
679  Info<< token::SPACE;
680  }
681  }
682  Info<< endl;
683  }
684  else if (entPtr->isDict())
685  {
686  Info<< entPtr->dict();
687  }
688  }
689  else
690  {
691  Info<< *entPtr;
692  }
693  }
694  }
695  else
696  {
698  << "Cannot find entry " << entryName
699  << exit(FatalIOError, 2);
700  }
701  }
702  }
703  else if (args.optionFound("rename"))
704  {
705  const string newNames(args.optionRead<string>("rename"));
706  rename(dict, newNames);
707  changed = true;
708  }
709  else if (args.optionFound("set"))
710  {
711  const string substitutions(args.optionRead<string>("set"));
712  substitute(dict, substitutions);
713  changed = true;
714  }
715  else if (args.optionFound("merge"))
716  {
717  dictionary fromDict;
718  if (args.optionFound("dict"))
719  {
720  const fileName fromDictFileName(args.optionRead<fileName>("merge"));
721  readDict(fromDict, fromDictFileName);
722  }
723  else
724  {
725  const string substitutions(args.optionRead<string>("merge"));
726  substitute(fromDict, substitutions);
727  }
728  mergeDictionaries(dict, fromDict, false);
729  changed = true;
730  }
731  else if (args.optionFound("keywords"))
732  {
734  {
735  Info<< iter().keyword() << endl;
736  }
737  }
738  else if (args.optionReadIfPresent("diff", diffFileName))
739  {
740  dictionary diffDict;
741  readDict(diffDict, diffFileName);
742 
743  remove(dict, diffDict);
744  dict.dictionary::write(Info, false);
745  }
746  else if (!args.optionFound("output"))
747  {
748  dict.dictionary::write(Info, false);
749  }
750 
751  if (changed)
752  {
753  if (localDictPtr)
754  {
755  localDictPtr->regIOobject::write();
756  }
757  else if (dictPtr)
758  {
759  // Set output dict name, defaults to the name of the input dict
760  const fileName outputDictPath
761  (
762  args.optionLookupOrDefault<fileName>("output", dictPath)
763  );
764 
765  OFstream os
766  (
767  outputDictPath.isAbsolute()
768  ? outputDictPath
769  : args.path()/outputDictPath,
770  dictFormat
771  );
773  if (dictPtr->found(IOobject::foamFile))
774  {
775  os << IOobject::foamFile;
776  dictPtr->subDict(IOobject::foamFile).write(os);
777  dictPtr->remove(IOobject::foamFile);
778  IOobject::writeDivider(os) << nl;
779  }
780  dictPtr->write(os, false);
782  }
783  }
784 
785  delete dictPtr;
786  delete localDictPtr;
787  delete runTimePtr;
788 
789  return 0;
790 }
791 
792 
793 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:476
Input from file stream.
Definition: IFstream.H:85
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
static Stream & writeBanner(Stream &os, bool noHint=false)
Write the standard OpenFOAM file/dictionary banner.
Definition: IOobjectI.H:45
static Stream & writeEndDivider(Stream &os)
Write the standard end file divider.
Definition: IOobjectI.H:103
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
Definition: IOobject.H:104
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
Definition: IOobjectI.H:93
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:87
static unsigned int defaultPrecision()
Return the default precision.
Definition: IOstream.H:473
static streamFormat formatEnum(const word &)
Return stream format of given format name.
Definition: IOstream.C:39
Input from memory buffer stream.
Definition: IStringStream.H:52
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
Output to file stream.
Definition: OFstream.H:87
virtual int precision() const
Get precision of output field.
Definition: OSstream.C:262
A List obtained as a section of another List.
Definition: SubList.H:56
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
Definition: Time.C:974
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:208
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:399
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:103
static void addOption(const word &opt, const string &param="", const string &usage="")
Add to an option to validOptions with usage information.
Definition: argList.C:128
static void addNote(const string &)
Add extra notes for the usage information.
Definition: argList.C:159
T optionRead(const word &opt) const
Read a value from the named option.
Definition: argListI.H:244
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Definition: argList.C:118
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:255
bool checkRootCase() const
Check root path and case path.
Definition: argList.C:1441
fileName path() const
Return the path to the caseName.
Definition: argListI.H:66
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Definition: argList.H:153
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
Definition: argListI.H:294
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
Definition: dictionaryIO.C:111
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
Definition: dictionary.C:578
void write(Ostream &, const bool subDict=true) const
Write dictionary, normally with sub-dictionary formatting.
Definition: dictionaryIO.C:226
const entry * lookupScopedEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present,.
Definition: dictionary.C:767
bool remove(const word &)
Remove an entry specified by keyword.
Definition: dictionary.C:1183
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:849
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:1020
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:539
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
Definition: dictionary.C:944
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:68
virtual bool isDict() const
Return true if this entry is a dictionary.
Definition: entry.H:178
virtual ITstream & stream() const =0
Return token stream if this entry is a primitive entry.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
Definition: entryIO.C:103
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
virtual autoPtr< entry > clone(const dictionary &parentDict) const =0
Construct on freestore as copy with reference to the.
virtual bool isStream() const
Return true if this entry is a stream.
Definition: entry.H:169
static int disableFunctionEntries
Definition: entry.H:102
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
Definition: error.C:125
A class for handling file names.
Definition: fileName.H:82
static bool log
Report which file is included to stdout.
Definition: includeEntry.H:119
localIOdictionary derived from IOdictionary with global set false to disable parallel master reading.
A token holds items read from Istream.
Definition: token.H:73
bool isWord() const
Definition: tokenI.H:298
const word & wordToken() const
Definition: tokenI.H:303
A class for handling words, derived from string.
Definition: word.H:62
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
int main(int argc, char *argv[])
Definition: financialFoam.C:44
static Time * runTimePtr
Definition: globalFoam.H:51
Function with which to merge one dictionary into another. Intended for user-facing dictionary merging...
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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.
Definition: dictionary.C:1495
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
bool writeInfoHeader
messageStream Info
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
Definition: dictionary.C:1684
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
Definition: doubleScalar.H:75
IOerror FatalIOError
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
error FatalError
bool mergeDictionaries(dictionary &tgtDict, const dictionary &srcDict, const bool wildcards=true, const HashTable< wordList, word > &shortcuts=HashTable< wordList, word >(0))
prefixOSstream Sout(cout, "Sout")
Definition: IOstreams.H:51
static const char nl
Definition: Ostream.H:267
dictionary dict
const bool overwrite
Definition: setNoOverwrite.H:1
Foam::argList args(argc, argv)