changeDictionary.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2016-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  changeDictionary
29 
30 Group
31  grpPreProcessingUtilities
32 
33 Description
34  Utility to change dictionary entries, e.g. can be used to change the patch
35  type in the field and polyMesh/boundary files.
36 
37  Reads dictionaries (fields) and entries to change from a dictionary.
38  E.g. to make the \em movingWall a \em fixedValue for \em p but all other
39  \em Walls a zeroGradient boundary condition, the
40  \c system/changeDictionaryDict would contain the following:
41  \verbatim
42  p // field to change
43  {
44  boundaryField
45  {
46  ".*Wall" // entry to change
47  {
48  type zeroGradient;
49  }
50  movingWall // entry to change
51  {
52  type fixedValue;
53  value uniform 123.45;
54  }
55  }
56  }
57  \endverbatim
58  Replacement entries starting with '~' will remove the entry.
59 
60 Usage
61  \b changeDictionary [OPTION]
62 
63  Options:
64  - \par -subDict
65  Specify the subDict name of the replacements dictionary.
66 
67  - \par -literalRE
68  Do not interpret regular expressions or patchGroups; treat them as any
69  other keyword.
70 
71  - \par -enableFunctionEntries
72  Enable function entries (default: disabled)
73 
74  - \par -disablePatchGroups
75  Disable the default checking for keys being patchGroups
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #include "argList.H"
80 #include "IOobjectList.H"
81 #include "IOPtrList.H"
82 #include "volFields.H"
83 #include "stringListOps.H"
84 #include "timeSelector.H"
85 
86 using namespace Foam;
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 namespace Foam
91 {
93 }
94 
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 // Extract groupPatch info from boundary file info
99 HashTable<wordList> extractPatchGroups(const dictionary& boundaryDict)
100 {
101  HashTable<wordList> groupToPatch;
102 
103  for (const entry& dEntry : boundaryDict)
104  {
105  if (!dEntry.isDict())
106  {
107  continue;
108  }
109 
110  const word& patchName = dEntry.keyword();
111  const dictionary& patchDict = dEntry.dict();
112 
113  wordList groupNames;
114  patchDict.readIfPresent("inGroups", groupNames);
115 
116  for (const word& groupName : groupNames)
117  {
118  auto groupIter = groupToPatch.find(groupName);
119  if (groupIter.found())
120  {
121  (*groupIter).append(patchName);
122  }
123  else
124  {
125  groupToPatch.insert(groupName, wordList(one{}, patchName));
126  }
127  }
128  }
129 
130  return groupToPatch;
131 }
132 
133 
134 bool merge
135 (
136  const bool addNonExisting,
137  dictionary&,
138  const dictionary&,
139  const bool,
140  const HashTable<wordList>&
141 );
142 
143 
144 // Add thisEntry to dictionary thisDict.
145 bool addEntry
146 (
147  dictionary& thisDict,
148  entry& thisEntry,
149  const entry& mergeEntry,
150  const bool literalRE,
151  const HashTable<wordList>& shortcuts
152 )
153 {
154  bool changed = false;
155 
156  // Recursively merge sub-dictionaries
157  // TODO: merge without copying
158  if (thisEntry.isDict() && mergeEntry.isDict())
159  {
160  if
161  (
162  merge
163  (
164  true,
165  const_cast<dictionary&>(thisEntry.dict()),
166  mergeEntry.dict(),
167  literalRE,
168  shortcuts
169  )
170  )
171  {
172  changed = true;
173  }
174  }
175  else
176  {
177  // Should use in-place modification instead of adding
178  thisDict.add(mergeEntry.clone(thisDict).ptr(), true);
179  changed = true;
180  }
181 
182  return changed;
183 }
184 
185 
186 // List of indices into thisKeys
187 labelList findMatches
188 (
189  const HashTable<wordList>& shortcuts,
190  const wordList& shortcutNames,
191  const wordList& thisKeys,
192  const keyType& key
193 )
194 {
195  labelList matches;
196 
197  if (key.isPattern())
198  {
199  // Wildcard match
200  matches = findStrings(key, thisKeys);
201  }
202  else if (shortcuts.size())
203  {
204  // See if patchGroups expand to valid thisKeys
205  labelList indices = findStrings(key, shortcutNames);
206 
207  for (const label idx : indices)
208  {
209  const word& name = shortcutNames[idx];
210  const wordList& keys = shortcuts[name];
211  forAll(keys, j)
212  {
213  const label index = thisKeys.find(keys[j]);
214  if (index != -1)
215  {
216  matches.append(index);
217  }
218  }
219  }
220  }
221  return matches;
222 }
223 
224 
225 // Dictionary merging/editing.
226 // literalRE:
227 // - true: behave like dictionary::merge, i.e. add regexps just like
228 // any other key.
229 // - false : interpret wildcard as a rule for items to be matched.
230 bool merge
231 (
232  const bool addNonExisting,
233  dictionary& thisDict,
234  const dictionary& mergeDict,
235  const bool literalRE,
236  const HashTable<wordList>& shortcuts
237 )
238 {
239  const wordList shortcutNames(shortcuts.toc());
240 
241  bool changed = false;
242 
243  // Save current (non-wildcard) keys before adding items.
244  wordHashSet thisKeysSet;
245  {
246  for (const word& k : thisDict.keys(false))
247  {
248  thisKeysSet.insert(k);
249  }
250  }
251 
252  // Pass 1. All literal matches
253 
254  for (const entry& mergeEntry : mergeDict)
255  {
256  const keyType& key = mergeEntry.keyword();
257 
258  if (key[0] == '~')
259  {
260  const word eraseKey = key.substr(1);
261  if (thisDict.remove(eraseKey))
262  {
263  // Mark thisDict entry as having been match for wildcard
264  // handling later on.
265  thisKeysSet.erase(eraseKey);
266  }
267  changed = true;
268  }
269  else if (literalRE || !(key.isPattern() || shortcuts.found(key)))
270  {
271  entry* eptr = thisDict.findEntry(key, keyType::LITERAL);
272 
273  if (eptr)
274  {
275  // Mark thisDict entry as having been match for wildcard
276  // handling later on.
277  thisKeysSet.erase(eptr->keyword());
278 
279  if
280  (
281  addEntry
282  (
283  thisDict,
284  *eptr,
285  mergeEntry,
286  literalRE,
287  shortcuts
288  )
289  )
290  {
291  changed = true;
292  }
293  }
294  else
295  {
296  if (addNonExisting)
297  {
298  // Not found - just add
299  thisDict.add(mergeEntry.clone(thisDict).ptr());
300  changed = true;
301  }
302  else
303  {
304  IOWarningInFunction(mergeDict)
305  << "Ignoring non-existing entry " << key
306  << endl;
307  }
308  }
309  }
310  }
311 
312 
313  // Pass 2. Wildcard or shortcut matches (if any) on any non-match keys.
314 
315  if (!literalRE && thisKeysSet.size())
316  {
317  // Pick up remaining dictionary entries
318  wordList thisKeys(thisKeysSet.toc());
319 
320  for (const entry& mergeEntry : mergeDict)
321  {
322  const keyType& key = mergeEntry.keyword();
323 
324  if (key[0] == '~')
325  {
326  const word eraseKey = key.substr(1);
327 
328  // List of indices into thisKeys
329  labelList matches
330  (
331  findMatches
332  (
333  shortcuts,
334  shortcutNames,
335  thisKeys,
336  eraseKey
337  )
338  );
339 
340  // Remove all matches
341  for (const label matchi : matches)
342  {
343  const word& k = thisKeys[matchi];
344  thisKeysSet.erase(k);
345  }
346  changed = true;
347  }
348  else
349  {
350  // List of indices into thisKeys
351  labelList matches
352  (
353  findMatches
354  (
355  shortcuts,
356  shortcutNames,
357  thisKeys,
358  key
359  )
360  );
361 
362  // Add all matches
363  for (const label matchi : matches)
364  {
365  const word& k = thisKeys[matchi];
366 
367  entry* eptr = thisDict.findEntry(k, keyType::LITERAL);
368 
369  if
370  (
371  addEntry
372  (
373  thisDict,
374  *eptr,
375  mergeEntry,
376  literalRE,
377  HashTable<wordList>(0) // no shortcuts
378  // at deeper levels
379  )
380  )
381  {
382  changed = true;
383  }
384  }
385  }
386  }
387  }
388 
389  return changed;
390 }
391 
392 
393 
394 int main(int argc, char *argv[])
395 {
397  (
398  "Utility to change dictionary entries"
399  " (such as the patch type for fields and polyMesh/boundary files)."
400  );
401 
402  argList::addOption("dict", "file", "Alternative changeDictionaryDict");
403 
405  (
406  "subDict",
407  "name",
408  "Specify the subDict name of the replacements dictionary"
409  );
411  (
412  "instance",
413  "name",
414  "Override instance setting (default is the time name)"
415  );
416 
417  // Add explicit time option
419 
421  (
422  "literalRE",
423  "Treat regular expressions literally (i.e., as a keyword)"
424  );
426  (
427  "enableFunctionEntries",
428  "Enable expansion of dictionary directives - #include, #codeStream etc"
429  );
431  (
432  "disablePatchGroups",
433  "Disable matching keys to patch groups"
434  );
435 
436  #include "addRegionOption.H"
437 
438  #include "setRootCase.H"
439  #include "createTime.H"
440 
441  // Optionally override controlDict time with -time options
443  if (times.size() < 1)
444  {
446  << "No times selected." << exit(FatalError);
447  }
448  forAll(times, timei)
449  {
450  word instance;
451  if (args.readIfPresent("instance", instance))
452  {
453  if (times.size() > 1)
454  {
456  << "Multiple times selected with 'instance' option"
457  << exit(FatalError);
458  }
459  }
460  else
461  {
462  runTime.setTime(times[timei], timei);
463  instance = runTime.timeName();
464  }
465 
466  #include "createNamedMesh.H"
467 
468  const bool literalRE = args.found("literalRE");
469  if (literalRE)
470  {
471  Info<< "Not interpreting any regular expressions (RE)"
472  << " in the changeDictionaryDict." << endl
473  << "Instead they are handled as any other entry, i.e. added if"
474  << " not present." << endl;
475  }
476 
477  const bool enableEntries = args.found("enableFunctionEntries");
478  if (enableEntries)
479  {
480  Info<< "Allowing dictionary preprocessing (#include, #codeStream)."
481  << endl;
482  }
483 
484  const int oldFlag = entry::disableFunctionEntries;
485  if (!enableEntries)
486  {
487  // By default disable dictionary expansion for fields
489  }
490 
491 
492  const bool disablePatchGroups = args.found("disablePatchGroups");
493  if (disablePatchGroups)
494  {
495  Info<< "Not interpreting any keys in the changeDictionary"
496  << " as patchGroups"
497  << endl;
498  }
499 
500 
501  fileName regionPrefix;
503  {
504  regionPrefix = regionName;
505  }
506 
507 
508  // Make sure we do not use the master-only reading since we read
509  // fields (different per processor) as dictionaries.
511 
512 
513  // Get the replacement rules from a dictionary
514 
515  const word dictName("changeDictionaryDict");
516  #include "setSystemMeshDictionaryIO.H"
518 
519  const dictionary* replaceDictsPtr = &dict;
520 
521  if (args.found("subDict"))
522  {
523  replaceDictsPtr = &dict.subDict(args["subDict"]);
524  }
525 
526  const dictionary& replaceDicts = *replaceDictsPtr;
527 
528  Info<< "Read dictionary " << dict.name()
529  << " with replacements for dictionaries "
530  << replaceDicts.toc() << endl;
531 
532 
533 
534  // Always read boundary to get patch groups
535  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
536 
537  Info<< "Reading polyMesh/boundary file to extract patch names"
538  << endl;
539 
540  // Read PtrList of dictionary as dictionary.
541  const word oldTypeName = IOPtrList<entry>::typeName;
543  IOPtrList<entry> dictList
544  (
545  IOobject
546  (
547  "boundary",
549  (
550  regionPrefix/polyMesh::meshSubDir,
551  "boundary",
553  ),
555  mesh,
558  false
559  )
560  );
561  const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
562 
563  // Fake type back to what was in field
564  const_cast<word&>(dictList.type()) = dictList.headerClassName();
565 
566  // Temporary convert to dictionary
567  dictionary fieldDict;
568  for (const entry& e : dictList)
569  {
570  if (e.isDict())
571  {
572  fieldDict.add(e.keyword(), e.dict());
573  }
574  }
575 
576  if (dictList.size())
577  {
578  Info<< "Loaded dictionary " << dictList.name()
579  << " with entries " << fieldDict.toc() << endl;
580  }
581 
582  // Extract any patchGroups information (= shortcut for set of
583  // patches)
584  HashTable<wordList> patchGroups;
585  if (!disablePatchGroups)
586  {
587  patchGroups = extractPatchGroups(fieldDict);
588  if (patchGroups.size())
589  {
590  Info<< "Extracted patch groups:" << endl;
591  wordList groups(patchGroups.sortedToc());
592  forAll(groups, i)
593  {
594  Info<< " group " << groups[i] << " with patches "
595  << patchGroups[groups[i]] << endl;
596  }
597  }
598  }
599 
600 
601  // Every replacement is a dictionary name and a keyword in this
602 
603  for (const entry& replaceEntry : replaceDicts)
604  {
605  if (!replaceEntry.isDict())
606  {
607  // Could also warn
608  continue;
609  }
610 
611  const word& fieldName = replaceEntry.keyword();
612  const dictionary& replaceDict = replaceEntry.dict();
613 
614  Info<< "Replacing entries in dictionary " << fieldName << endl;
615 
616  // Handle 'boundary' specially:
617  // - is PtrList of dictionaries
618  // - is in polyMesh/
619  if (fieldName == "boundary")
620  {
621  Info<< "Special handling of " << fieldName
622  << " as polyMesh/boundary file." << endl;
623 
624  // Merge the replacements in. Do not add non-existing entries.
625  Info<< "Merging entries from " << replaceDict.toc() << endl;
626  merge(false, fieldDict, replaceDict, literalRE, patchGroups);
627 
628  Info<< "fieldDict:" << fieldDict << endl;
629 
630  // Convert back into dictList
631  wordList doneKeys(dictList.size());
632 
633  label nEntries = fieldDict.size();
634  nEntries = 0;
635 
636  forAll(dictList, i)
637  {
638  doneKeys[i] = dictList[i].keyword();
639 
640  const entry* ePtr = fieldDict.findEntry
641  (
642  doneKeys[i],
644  );
645  // Check that it hasn't been removed from fieldDict
646  if (ePtr)
647  {
648  dictList.set(nEntries++, ePtr->clone());
649  fieldDict.remove(doneKeys[i]);
650  }
651  }
652 
653  // Add remaining entries
654  for (const entry& e : fieldDict)
655  {
656  dictList.set(nEntries++, e.clone());
657  }
658  dictList.setSize(nEntries);
659 
660  Info<< "Writing modified " << fieldName << endl;
661  dictList.writeObject
662  (
664  true
665  );
666  }
667  else
668  {
669  // Read dictionary
670  // Note: disable class type checking so we can load field
671  Info<< "Loading dictionary " << fieldName << endl;
672  const word oldTypeName = IOdictionary::typeName;
673  const_cast<word&>(IOdictionary::typeName) = word::null;
674 
675  IOobject fieldHeader
676  (
677  fieldName,
678  instance,
679  mesh,
682  false
683  );
684 
685  if (fieldHeader.typeHeaderOk<IOdictionary>(false))
686  {
687  IOdictionary fieldDict(fieldHeader);
688 
689  const_cast<word&>(IOdictionary::typeName) = oldTypeName;
690 
691  // Fake type back to what was in field
692  const_cast<word&>(fieldDict.type()) =
693  fieldDict.headerClassName();
694 
695  Info<< "Loaded dictionary " << fieldName
696  << " with entries " << fieldDict.toc() << endl;
697 
698  // Merge the replacements in (allow adding)
699  Info<< "Merging entries from " << replaceDict.toc() << endl;
700  merge(true, fieldDict, replaceDict, literalRE, patchGroups);
701 
702  Info<< "Writing modified fieldDict " << fieldName << endl;
703  fieldDict.regIOobject::write();
704  }
705  else
706  {
708  << "Requested field to change " << fieldName
709  << " does not exist in " << fieldHeader.path() << endl;
710  }
711  }
712 
714  }
715  }
716 
717  Info<< "\nEnd\n" << endl;
718 
719  return 0;
720 }
721 
722 
723 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::HashTable::size
label size() const noexcept
The number of elements in table.
Definition: HashTableI.H:52
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::IOobject::timeStamp
Definition: IOobject.H:136
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IOPtrList
A PtrList of objects of type <T> with automated input and output.
Definition: IOPtrList.H:53
Foam::entry::keyword
const keyType & keyword() const
Return keyword.
Definition: entry.H:187
Foam::HashTable::toc
List< Key > toc() const
The table of contents (the keys) in unsorted order.
Definition: HashTable.C:121
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:318
Foam::keyType::isPattern
bool isPattern() const
The keyType is treated as a pattern, not as literal string.
Definition: keyTypeI.H:128
Foam::Time::writeFormat
IOstream::streamFormat writeFormat() const
The write stream format.
Definition: Time.H:387
Foam::polyMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:321
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::IOobject::fileModificationChecking
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:211
Foam::argList::addNote
static void addNote(const string &note)
Add extra notes for the usage information.
Definition: argList.C:426
dictName
const word dictName("blockMeshDict")
Foam::HashTable::insert
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Definition: HashTableI.H:180
Foam::one
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:61
Foam::List::append
void append(const T &val)
Append an element at the end of the list.
Definition: ListI.H:182
IOobjectList.H
Foam::defineTemplateTypeNameAndDebug
defineTemplateTypeNameAndDebug(faScalarMatrix, 0)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::HashSet< word >
Foam::argList::readIfPresent
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:296
setSystemMeshDictionaryIO.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:59
Foam::dictionary::keys
List< keyType > keys(bool patterns=false) const
Return the list of available keys or patterns.
Definition: dictionary.C:690
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:60
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::dictionary::name
const fileName & name() const
The dictionary name.
Definition: dictionary.H:446
Foam::entry::isDict
virtual bool isDict() const
Return true if this entry is a dictionary.
Definition: entry.H:222
IOPtrList.H
Foam::HashTable::erase
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
Definition: HashTable.C:392
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
argList.H
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:528
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:122
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
addRegionOption.H
Foam::timeSelector::selectIfPresent
static instantList selectIfPresent(Time &runTime, const argList &args)
Definition: timeSelector.C:272
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
createNamedMesh.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
dictIO
IOobject dictIO
Definition: setConstantMeshDictionaryIO.H:1
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::findStrings
labelList findStrings(const regExp &matcher, const UList< StringType > &input, const bool invert=false)
Return list indices for strings matching the regular expression.
Definition: stringListOps.H:76
Foam::entry::disableFunctionEntries
static int disableFunctionEntries
Enable or disable use of function entries and variable expansions.
Definition: entry.H:119
Foam::entry::dict
virtual const dictionary & dict() const =0
Return dictionary, if entry is a dictionary.
Foam::HashTable::sortedToc
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Definition: HashTable.C:136
Foam::HashTable::find
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
Definition: HashTableI.H:114
Foam::Time::findInstance
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Definition: Time.C:797
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::HashTable< wordList >
Foam::argList::addBoolOption
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition: argList.C:338
setRootCase.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::timeSelector::addOptions
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
Definition: timeSelector.C:108
Foam::dictionary::remove
bool remove(const word &keyword)
Remove an entry specified by keyword.
Definition: dictionarySearch.C:582
Foam::List< word >
Foam::Time::setTime
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:1003
Foam::dictionary::findEntry
entry * findEntry(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find for an entry (non-const access) with the given keyword.
Definition: dictionary.C:374
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::keyType::REGEX
Regular expression.
Definition: keyType.H:74
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Definition: HashSet.H:181
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
timeSelector.H
createTime.H
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:121
stringListOps.H
Operations on lists of strings.
Foam::dictionary::add
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:708
Foam::entry::clone
virtual autoPtr< entry > clone(const dictionary &parentDict) const =0
Construct on freestore as copy with reference to the.
Foam::dictionary::toc
wordList toc() const
Return the table of contents.
Definition: dictionary.C:670
Foam::keyType::LITERAL
String literal.
Definition: keyType.H:73
IOWarningInFunction
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Definition: messageStream.H:315
Foam::HashTable::found
bool found(const Key &key) const
Return true if hashed entry is found in table.
Definition: HashTableI.H:100
Foam::argList::addOption
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition: argList.C:349
args
Foam::argList args(argc, argv)
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:417
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:151