dictionary.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-2026 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 "dictionaryEntry.H"
28 #include "regExp.H"
29 #include "OSHA1stream.H"
30 #include "printDictionary.H"
31 
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 
34 Foam::fileName Foam::dictionary::pathName
35 (
36  const dictionary& parentDict,
37  const fileName& name
38 ) const
39 {
40  return
41  parentDict.currentName().size()
42  ? parentDict.parent().isNull()
43  ? fileName(parentDict.currentName() + '!' + name)
44  : parentDict.currentName()/name
45  : name;
46 }
47 
48 
49 const Foam::entry* Foam::dictionary::lookupScopedSubEntryPtr
50 (
51  const word& keyword,
52  bool recursive,
53  bool patternMatch
54 ) const
55 {
56  // Check for the dictionary boundary marker
57  const string::size_type emarkPos = keyword.find('!');
58 
59  if (emarkPos == string::npos || emarkPos == 0)
60  {
61  // Lookup in this dictionary
62 
63  string::size_type slashPos = keyword.find('/');
64 
65  if (slashPos == string::npos)
66  {
67  // Non-scoped lookup
68  return lookupEntryPtr(keyword, recursive, patternMatch);
69  }
70  else
71  {
72  // Extract the first word
73  word firstWord = keyword.substr(0, slashPos);
74  slashPos++;
75 
76  if (firstWord == ".")
77  {
78  return lookupScopedSubEntryPtr
79  (
80  keyword.substr(slashPos),
81  false,
82  patternMatch
83  );
84  }
85  else if (firstWord == "..")
86  {
87  // Go to parent
88  if (&parent_ == &dictionary::null)
89  {
91  << "No parent of current dictionary"
92  << " when searching for "
93  << keyword.substr(slashPos, keyword.size() - slashPos)
94  << exit(FatalIOError);
95  }
96 
97  return parent_.lookupScopedSubEntryPtr
98  (
99  keyword.substr(slashPos),
100  false,
101  patternMatch
102  );
103  }
104  else
105  {
106  const entry* entPtr = lookupScopedSubEntryPtr
107  (
108  firstWord,
109  recursive,
110  patternMatch
111  );
112 
113  if (entPtr && entPtr->isDict())
114  {
115  return entPtr->dict().lookupScopedSubEntryPtr
116  (
117  keyword.substr(slashPos, keyword.size() - slashPos),
118  false,
119  patternMatch
120  );
121  }
122  else
123  {
124  return nullptr;
125  }
126  }
127  }
128  }
129  else
130  {
131  // Lookup in the dictionary specified by file name
132  // created from the part of the keyword before the '!'
133 
134  fileName fName = keyword.substr(0, emarkPos);
135 
136  if (!fName.isAbsolute())
137  {
138  fName = topDict().name().path()/fName;
139  }
140 
141  if (fName == topDict().name())
142  {
144  << "Attempt to re-read current dictionary " << fName
145  << " for keyword "
146  << keyword
147  << exit(FatalIOError);
148  }
149 
150  const word localKeyword = keyword.substr
151  (
152  emarkPos + 1,
153  keyword.size() - emarkPos - 1
154  );
155 
156  includedDictionary dict(fName, *this);
157 
158  const Foam::entry* entryPtr = dict.lookupScopedEntryPtr
159  (
160  localKeyword,
161  recursive,
162  patternMatch
163  );
164 
165  if (!entryPtr)
166  {
168  << "keyword " << localKeyword
169  << " is undefined in dictionary "
170  << dict.name()
171  << exit(FatalIOError);
172  }
173 
174  return entryPtr->clone(*this).ptr();
175  }
176 }
177 
178 
179 bool Foam::dictionary::findInPatterns
180 (
181  const bool patternMatch,
182  const word& Keyword,
184  DLList<autoPtr<regExp>>::const_iterator& reLink
185 ) const
186 {
187  if (patternEntries_.size())
188  {
189  while (wcLink != patternEntries_.end())
190  {
191  if
192  (
193  patternMatch
194  ? reLink()->match(Keyword)
195  : wcLink()->keyword() == Keyword
196  )
197  {
198  return true;
199  }
200 
201  ++reLink;
202  ++wcLink;
203  }
204  }
205 
206  return false;
207 }
208 
209 
210 bool Foam::dictionary::haveDefaults(const dictionary& dict)
211 {
213 }
214 
215 
216 Foam::dictionary& Foam::dictionary::defaults(const dictionary& dict)
217 {
219 }
220 
221 
222 bool Foam::dictionary::findInPatterns
223 (
224  const bool patternMatch,
225  const word& Keyword,
226  DLList<entry*>::iterator& wcLink,
227  DLList<autoPtr<regExp>>::iterator& reLink
228 )
229 {
230  if (patternEntries_.size())
231  {
232  while (wcLink != patternEntries_.end())
233  {
234  if
235  (
236  patternMatch
237  ? reLink()->match(Keyword)
238  : wcLink()->keyword() == Keyword
239  )
240  {
241  return true;
242  }
243 
244  ++reLink;
245  ++wcLink;
246  }
247  }
248 
249  return false;
250 }
251 
252 
253 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
254 
256 :
257  parent_(dictionary::null),
258  filePtr_(nullptr)
259 {}
260 
261 
263 :
265  parent_(dictionary::null),
266  filePtr_(nullptr)
267 {}
268 
269 
271 (
272  const fileName& name,
273  const dictionary& parentDict
274 )
275 :
276  dictionaryName(pathName(parentDict, name)),
277  parent_(parentDict),
278  filePtr_(nullptr)
279 {}
280 
281 
283 (
284  const dictionary& parentDict,
285  const dictionary& dict
286 )
287 :
289  IDLList<entry>(dict, *this),
290  parent_(parentDict),
291  filePtr_(nullptr)
292 {
293  forAllIter(IDLList<entry>, *this, iter)
294  {
295  hashedEntries_.insert(iter().keyword(), &iter());
296 
297  if (iter().keyword().isPattern())
298  {
299  patternEntries_.insert(&iter());
300  patternRegexps_.insert
301  (
302  autoPtr<regExp>(new regExp(iter().keyword()))
303  );
304  }
305  }
306 }
307 
308 
310 :
311  dictionary(dictionary::null, dict)
312 {}
313 
314 
316 :
317  parent_(dictionary::null),
318  filePtr_(nullptr)
319 {
320  if (dictPtr)
321  {
322  operator=(*dictPtr);
323  }
324 }
325 
326 
328 {
329  return autoPtr<dictionary>(new dictionary(*this));
330 }
331 
332 
333 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
334 
336 {}
337 
338 
339 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
340 
342 {
343  const dictionary& p = parent();
344 
345  if (&p != this && !p.name().empty())
346  {
347  return p.topDict();
348  }
349  else
350  {
351  return *this;
352  }
353 }
354 
355 
357 {
358  const dictionary& p = parent();
359 
360  if (&p != this && !p.name().empty())
361  {
362  const word pKeyword = p.topDictKeyword();
363  const char pSeparator = '/';
364  return
365  pKeyword == word::null
366  ? dictName()
367  : word(pKeyword + pSeparator + dictName());
368  }
369  else
370  {
371  return word::null;
372  }
373 }
374 
375 
377 {
378  if (filePtr_)
379  {
380  const fileName& fName = filePtr_->name();
381 
382  // If this is a sub-dictionary of the current file then we want to
383  // retain the sub-dictionary part of the name, so return the name
384  // rather than the file name
385  if (name().find(fName.c_str(), 0, fName.size()) != string::npos)
386  {
387  return name();
388  }
389 
390  // Otherwise this is the top-level or the top-level of an included
391  // file, in which case we just want the name of the file
392  return fName;
393  }
394  else
395  {
396  return name();
397  }
398 }
399 
400 
402 {
403  if (size())
404  {
405  return first()->startLineNumber();
406  }
407  else
408  {
409  return -1;
410  }
411 }
412 
413 
415 {
416  if (filePtr_)
417  {
418  return filePtr_->lineNumber();
419  }
420  else
421  {
422  if (size())
423  {
424  return last()->endLineNumber();
425  }
426  else
427  {
428  return -1;
429  }
430  }
431 }
432 
433 
435 {
436  OSHA1stream os;
437 
438  // Process entries
439  forAllConstIter(IDLList<entry>, *this, iter)
440  {
441  os << *iter;
442  }
443 
444  return os.digest();
445 }
446 
447 
449 {
450  // Serialise dictionary into a string
451  OStringStream os;
452  write(os, false);
453  IStringStream is(os.str());
454 
455  // Parse string as tokens
456  DynamicList<token> tokens;
457  token t;
458  while (!is.eof() && !is.read(t).bad() && t.good())
459  {
460  tokens.append(t);
461  }
462 
463  return tokenList(move(tokens));
464 }
465 
466 
468 (
469  const word& keyword,
470  bool recursive,
471  bool patternMatch
472 ) const
473 {
474  if (hashedEntries_.found(keyword))
475  {
476  return true;
477  }
478  else
479  {
480  if (patternMatch && patternEntries_.size())
481  {
483  patternEntries_.begin();
485  patternRegexps_.begin();
486 
487  // Find in patterns using regular expressions only
488  if (findInPatterns(patternMatch, keyword, wcLink, reLink))
489  {
490  return true;
491  }
492  }
493 
494  if (recursive && &parent_ != &dictionary::null)
495  {
496  return parent_.found(keyword, recursive, patternMatch);
497  }
498  else
499  {
500  return false;
501  }
502  }
503 }
504 
505 
507 (
508  const word& keyword,
509  bool recursive,
510  bool patternMatch
511 ) const
512 {
513  HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
514 
515  if (iter == hashedEntries_.end())
516  {
517  if (patternMatch && patternEntries_.size())
518  {
520  patternEntries_.begin();
522  patternRegexps_.begin();
523 
524  // Find in patterns using regular expressions only
525  if (findInPatterns(patternMatch, keyword, wcLink, reLink))
526  {
527  return wcLink();
528  }
529  }
530 
531  if (recursive && &parent_ != &dictionary::null)
532  {
533  return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
534  }
535  else
536  {
537  return nullptr;
538  }
539  }
540 
541  return iter();
542 }
543 
544 
546 (
547  const word& keyword,
548  bool recursive,
549  bool patternMatch
550 )
551 {
552  HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
553 
554  if (iter == hashedEntries_.end())
555  {
556  if (patternMatch && patternEntries_.size())
557  {
558  DLList<entry*>::iterator wcLink =
559  patternEntries_.begin();
561  patternRegexps_.begin();
562 
563  // Find in patterns using regular expressions only
564  if (findInPatterns(patternMatch, keyword, wcLink, reLink))
565  {
566  return wcLink();
567  }
568  }
569 
570  if (recursive && &parent_ != &dictionary::null)
571  {
572  return const_cast<dictionary&>(parent_).lookupEntryPtr
573  (
574  keyword,
575  recursive,
576  patternMatch
577  );
578  }
579  else
580  {
581  return nullptr;
582  }
583  }
584 
585  return iter();
586 }
587 
588 
590 (
591  const wordList& keywords,
592  bool recursive,
593  bool patternMatch
594 ) const
595 {
596  const entry* result = nullptr;
597 
598  forAll(keywords, keywordi)
599  {
600  const entry* entryPtr =
601  lookupEntryPtr(keywords[keywordi], recursive, patternMatch);
602 
603  if (entryPtr)
604  {
605  if (result)
606  {
607  IOWarningInFunction((*this))
608  << "Duplicate backwards compatible keywords \""
609  << result->keyword() << "\" and \"" << entryPtr->keyword()
610  << "\" are defined in dictionary " << name() << endl
611  << "The preferred keyword for this entry is \""
612  << keywords[0] << "\"" << endl;
613  }
614  else
615  {
616  result = entryPtr;
617  }
618  }
619  }
620 
621  return result;
622 }
623 
624 
626 (
627  const word& keyword,
628  bool recursive,
629  bool patternMatch
630 ) const
631 {
632  const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
633 
634  if (entryPtr == nullptr)
635  {
637  << "keyword " << keyword << " is undefined in dictionary "
638  << name()
639  << exit(FatalIOError);
640  }
641 
642  return *entryPtr;
643 }
644 
645 
647 (
648  const wordList& keywords,
649  bool recursive,
650  bool patternMatch
651 ) const
652 {
653  const entry* entryPtr =
654  lookupEntryPtrBackwardsCompatible(keywords, recursive, patternMatch);
655 
656  if (entryPtr == nullptr)
657  {
658  // Generate error message using the first keyword
659  return lookupEntry(keywords[0], recursive, patternMatch);
660  }
661  else
662  {
663  return *entryPtr;
664  }
665 }
666 
667 
669 (
670  const word& keyword,
671  bool recursive,
672  bool patternMatch
673 ) const
674 {
675  return lookupEntry(keyword, recursive, patternMatch).stream();
676 }
677 
678 
680 (
681  const wordList& keywords,
682  bool recursive,
683  bool patternMatch
684 ) const
685 {
686  return lookupEntryBackwardsCompatible
687  (
688  keywords,
689  recursive,
690  patternMatch
691  ).stream();
692 }
693 
694 
696 (
697  const word& keyword,
698  bool recursive,
699  bool patternMatch
700 ) const
701 {
702  // '!' indicates the top-level directory
703  if (keyword[0] == '!')
704  {
705  // Go up to top level
706  const dictionary* dictPtr = this;
707  while (&dictPtr->parent_ != &dictionary::null)
708  {
709  dictPtr = &dictPtr->parent_;
710  }
711 
712  // At top. Recurse to find entries
713  return dictPtr->lookupScopedSubEntryPtr
714  (
715  keyword.substr(1, keyword.size() - 1),
716  false,
717  patternMatch
718  );
719  }
720  else
721  {
722  return lookupScopedSubEntryPtr
723  (
724  keyword,
725  recursive,
726  patternMatch
727  );
728  }
729 }
730 
731 
732 bool Foam::dictionary::isDict(const word& keyword) const
733 {
734  // Find non-recursive with patterns
735  const entry* entryPtr = lookupEntryPtr(keyword, false, true);
736 
737  if (entryPtr)
738  {
739  return entryPtr->isDict();
740  }
741  else
742  {
743  return false;
744  }
745 }
746 
747 
749 {
750  const entry* entryPtr = lookupEntryPtr(keyword, false, true);
751 
752  if (entryPtr)
753  {
754  return &entryPtr->dict();
755  }
756  else
757  {
758  return nullptr;
759  }
760 }
761 
762 
764 {
765  entry* entryPtr = lookupEntryPtr(keyword, false, true);
766 
767  if (entryPtr)
768  {
769  return &entryPtr->dict();
770  }
771  else
772  {
773  return nullptr;
774  }
775 }
776 
777 
778 const Foam::dictionary& Foam::dictionary::subDict(const word& keyword) const
779 {
780  const entry* entryPtr = lookupEntryPtr(keyword, false, true);
781 
782  if (entryPtr == nullptr)
783  {
785  << "keyword " << keyword << " is undefined in dictionary "
786  << name()
787  << exit(FatalIOError);
788  }
789  return entryPtr->dict();
790 }
791 
792 
794 {
795  entry* entryPtr = lookupEntryPtr(keyword, false, true);
796 
797  if (entryPtr == nullptr)
798  {
800  << "keyword " << keyword << " is undefined in dictionary "
801  << name()
802  << exit(FatalIOError);
803  }
804  return entryPtr->dict();
805 }
806 
807 
809 (
810  const wordList& keywords
811 ) const
812 {
813  const entry* entryPtr =
814  lookupEntryPtrBackwardsCompatible(keywords, false, true);
815 
816  if (entryPtr == nullptr)
817  {
818  // Generate error message using the first keyword
819  return subDict(keywords[0]);
820  }
821  else
822  {
823  return entryPtr->dict();
824  }
825 }
826 
827 
829 (
830  const word& keyword,
831  const bool mustRead
832 ) const
833 {
834  const entry* entryPtr = lookupEntryPtr(keyword, false, true);
835 
836  if (entryPtr == nullptr)
837  {
838  if (mustRead)
839  {
841  << "keyword " << keyword << " is undefined in dictionary "
842  << name()
843  << exit(FatalIOError);
844  }
845 
846  return null;
847  }
848  else
849  {
850  return entryPtr->dict();
851  }
852 }
853 
854 
856 (
857  const word& keyword
858 ) const
859 {
860  const entry* entryPtr = lookupEntryPtr(keyword, false, true);
861 
862  if (entryPtr)
863  {
864  return entryPtr->dict();
865  }
866  else
867  {
868  return *this;
869  }
870 }
871 
872 
874 (
875  const word& typeName
876 ) const
877 {
878  const entry* entryPtr = lookupEntryPtr(typeName, false, true);
879 
880  if (!entryPtr)
881  {
882  entryPtr = lookupEntryPtr(typeName + "Coeffs", false, true);
883  }
884 
885  if (entryPtr && entryPtr->isDict())
886  {
887  return entryPtr->dict();
888  }
889  else
890  {
891  // Generate error message using the typeName keyword
892  return subDict(typeName);
893  }
894 }
895 
896 
898 (
899  const word& typeName
900 ) const
901 {
902  const entry* entryPtr = lookupEntryPtr(typeName, false, true);
903 
904  if (!entryPtr)
905  {
906  entryPtr = lookupEntryPtr(typeName + "Coeffs", false, true);
907  }
908 
909  if (entryPtr && entryPtr->isDict())
910  {
911  return entryPtr->dict();
912  }
913  else
914  {
915  return null;
916  }
917 }
918 
919 
921 (
922  const word& typeName
923 ) const
924 {
925  const entry* entryPtr = lookupEntryPtr(typeName, false, true);
926 
927  if (!entryPtr)
928  {
929  entryPtr = lookupEntryPtr(typeName + "Coeffs", false, true);
930  }
931 
932  if (entryPtr && entryPtr->isDict())
933  {
934  return entryPtr->dict();
935  }
936  else
937  {
938  return *this;
939  }
940 }
941 
942 
944 {
945  if (keyword == "")
946  {
947  return *this;
948  }
949  else
950  {
951  const entry* entPtr = lookupScopedEntryPtr
952  (
953  keyword,
954  false,
955  false
956  );
957  if (!entPtr || !entPtr->isDict())
958  {
960  << "keyword " << keyword
961  << " is undefined in dictionary "
962  << name() << " or is not a dictionary"
963  << endl
964  << "Valid keywords are " << keys()
965  << abort(FatalIOError);
966  }
967  return entPtr->dict();
968  }
969 }
970 
971 
973 {
974  return const_cast<dictionary&>
975  (
976  const_cast<const dictionary*>(this)->scopedDict(keyword)
977  );
978 }
979 
980 
982 {
983  wordList keys(size());
984 
985  label nKeys = 0;
986  forAllConstIter(IDLList<entry>, *this, iter)
987  {
988  keys[nKeys++] = iter().keyword();
989  }
990 
991  return keys;
992 }
993 
994 
996 {
997  return hashedEntries_.sortedToc();
998 }
999 
1000 
1002 {
1003  List<keyType> keys(size());
1004 
1005  label nKeys = 0;
1006  forAllConstIter(IDLList<entry>, *this, iter)
1007  {
1008  if (iter().keyword().isPattern() ? patterns : !patterns)
1009  {
1010  keys[nKeys++] = iter().keyword();
1011  }
1012  }
1013  keys.setSize(nKeys);
1014 
1015  return keys;
1016 }
1017 
1018 
1019 bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
1020 {
1021  HashTable<entry*>::iterator iter = hashedEntries_.find
1022  (
1023  entryPtr->keyword()
1024  );
1025 
1026  if (mergeEntry && iter != hashedEntries_.end())
1027  {
1028  // Merge dictionary with dictionary
1029  if (iter()->isDict() && entryPtr->isDict())
1030  {
1031  iter()->dict().merge(entryPtr->dict());
1032  delete entryPtr;
1033 
1034  return true;
1035  }
1036  else
1037  {
1038  // Replace existing dictionary with entry or vice versa
1039  IDLList<entry>::replace(iter(), entryPtr);
1040  delete iter();
1041  hashedEntries_.erase(iter);
1042 
1043  if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
1044  {
1045  entryPtr->name() = pathName(*this, entryPtr->keyword());
1046 
1047  if (entryPtr->keyword().isPattern())
1048  {
1049  patternEntries_.insert(entryPtr);
1050  patternRegexps_.insert
1051  (
1052  autoPtr<regExp>(new regExp(entryPtr->keyword()))
1053  );
1054  }
1055 
1056  return true;
1057  }
1058  else
1059  {
1060  IOWarningInFunction((*this))
1061  << "problem replacing entry "<< entryPtr->keyword()
1062  << " in dictionary " << name() << endl;
1063 
1064  IDLList<entry>::remove(entryPtr);
1065  delete entryPtr;
1066  return false;
1067  }
1068  }
1069  }
1070 
1071  if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
1072  {
1073  entryPtr->name() = pathName(*this, entryPtr->keyword());
1074  IDLList<entry>::append(entryPtr);
1075 
1076  if (entryPtr->keyword().isPattern())
1077  {
1078  patternEntries_.insert(entryPtr);
1079  patternRegexps_.insert
1080  (
1081  autoPtr<regExp>(new regExp(entryPtr->keyword()))
1082  );
1083  }
1084 
1085  return true;
1086  }
1087  else
1088  {
1089  // If function entries are disabled allow duplicate entries
1091  {
1092  entryPtr->name() = pathName(*this, entryPtr->keyword());
1093  IDLList<entry>::append(entryPtr);
1094 
1095  return true;
1096  }
1097  else
1098  {
1099  IOWarningInFunction((*this))
1100  << "attempt to add entry "<< entryPtr->keyword()
1101  << " which already exists in dictionary " << name()
1102  << endl;
1103 
1104  delete entryPtr;
1105  return false;
1106  }
1107  }
1108 }
1109 
1110 
1111 void Foam::dictionary::add(const entry& e, bool mergeEntry)
1112 {
1113  add(e.clone(*this).ptr(), mergeEntry);
1114 }
1115 
1116 
1117 void Foam::dictionary::add(const keyType& k, const word& w, bool overwrite)
1118 {
1119  add(new primitiveEntry(k, token(w)), overwrite);
1120 }
1121 
1122 
1124 (
1125  const keyType& k,
1126  const Foam::string& s,
1127  bool overwrite
1128 )
1129 {
1130  add(new primitiveEntry(k, token(s)), overwrite);
1131 }
1132 
1133 
1134 void Foam::dictionary::add(const keyType& k, const label l, bool overwrite)
1135 {
1136  add(new primitiveEntry(k, token(l)), overwrite);
1137 }
1138 
1139 
1140 void Foam::dictionary::add(const keyType& k, const scalar s, bool overwrite)
1141 {
1142  add(new primitiveEntry(k, token(s)), overwrite);
1143 }
1144 
1145 
1147 (
1148  const keyType& k,
1149  const dictionary& d,
1150  bool mergeEntry
1151 )
1152 {
1153  add(new dictionaryEntry(k, *this, d), mergeEntry);
1154 }
1155 
1156 
1157 void Foam::dictionary::set(entry* entryPtr)
1158 {
1159  entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true);
1160 
1161  // Clear dictionary so merge acts like overwrite
1162  if (existingPtr && existingPtr->isDict())
1163  {
1164  existingPtr->dict().clear();
1165  }
1166  add(entryPtr, true);
1167 }
1168 
1169 
1170 void Foam::dictionary::set(const entry& e)
1171 {
1172  set(e.clone(*this).ptr());
1173 }
1174 
1175 
1176 void Foam::dictionary::set(const keyType& k, const dictionary& d)
1177 {
1178  set(new dictionaryEntry(k, *this, d));
1179 }
1180 
1181 
1182 bool Foam::dictionary::remove(const word& Keyword)
1183 {
1184  HashTable<entry*>::iterator iter = hashedEntries_.find(Keyword);
1185 
1186  if (iter != hashedEntries_.end())
1187  {
1188  // Delete from patterns first
1189  DLList<entry*>::iterator wcLink =
1190  patternEntries_.begin();
1192  patternRegexps_.begin();
1193 
1194  // Find in pattern using exact match only
1195  if (findInPatterns(false, Keyword, wcLink, reLink))
1196  {
1197  patternEntries_.remove(wcLink);
1198  patternRegexps_.remove(reLink);
1199  }
1200 
1201  IDLList<entry>::remove(iter());
1202  delete iter();
1203  hashedEntries_.erase(iter);
1204 
1205  return true;
1206  }
1207  else
1208  {
1209  return false;
1210  }
1211 }
1212 
1213 
1214 void Foam::dictionary::remove(const wordList& Keywords)
1215 {
1216  forAll(Keywords, i)
1217  {
1218  remove(Keywords[i]);
1219  }
1220 }
1221 
1222 
1224 (
1225  const keyType& oldKeyword,
1226  const keyType& newKeyword,
1227  bool forceOverwrite
1228 )
1229 {
1230  // No change
1231  if (oldKeyword == newKeyword)
1232  {
1233  return false;
1234  }
1235 
1236  HashTable<entry*>::iterator iter = hashedEntries_.find(oldKeyword);
1237 
1238  // oldKeyword not found - do nothing
1239  if (iter == hashedEntries_.end())
1240  {
1241  return false;
1242  }
1243 
1244  if (iter()->keyword().isPattern())
1245  {
1246  FatalIOErrorInFunction(*this)
1247  << "Old keyword "<< oldKeyword
1248  << " is a pattern."
1249  << "Pattern replacement not yet implemented."
1250  << exit(FatalIOError);
1251  }
1252 
1253 
1254  HashTable<entry*>::iterator iter2 = hashedEntries_.find(newKeyword);
1255 
1256  // newKeyword already exists
1257  if (iter2 != hashedEntries_.end())
1258  {
1259  if (forceOverwrite)
1260  {
1261  if (iter2()->keyword().isPattern())
1262  {
1263  // Delete from patterns first
1264  DLList<entry*>::iterator wcLink =
1265  patternEntries_.begin();
1267  patternRegexps_.begin();
1268 
1269  // Find in patterns using exact match only
1270  if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
1271  {
1272  patternEntries_.remove(wcLink);
1273  patternRegexps_.remove(reLink);
1274  }
1275  }
1276 
1277  IDLList<entry>::replace(iter2(), iter());
1278  delete iter2();
1279  hashedEntries_.erase(iter2);
1280 
1281  }
1282  else
1283  {
1285  (
1286  *this
1287  ) << "cannot rename keyword "<< oldKeyword
1288  << " to existing keyword " << newKeyword
1289  << " in dictionary " << name() << endl;
1290  return false;
1291  }
1292  }
1293 
1294  // Change name and HashTable, but leave DL-List untouched
1295  iter()->keyword() = newKeyword;
1296  iter()->name() = name() + '/' + string::validate<word>(newKeyword);
1297  hashedEntries_.erase(oldKeyword);
1298  hashedEntries_.insert(newKeyword, iter());
1299 
1300  if (newKeyword.isPattern())
1301  {
1302  patternEntries_.insert(iter());
1303  patternRegexps_.insert
1304  (
1305  autoPtr<regExp>(new regExp(newKeyword))
1306  );
1307  }
1308 
1309  return true;
1310 }
1311 
1312 
1314 {
1315  // Check for assignment to self
1316  if (this == &dict)
1317  {
1318  FatalIOErrorInFunction(*this)
1319  << "attempted merge to self for dictionary " << name()
1320  << abort(FatalIOError);
1321  }
1322 
1323  bool changed = false;
1324 
1326  {
1327  HashTable<entry*>::iterator fnd = hashedEntries_.find(iter().keyword());
1328 
1329  if (fnd != hashedEntries_.end())
1330  {
1331  // Recursively merge sub-dictionaries
1332  // TODO: merge without copying
1333  if (fnd()->isDict() && iter().isDict())
1334  {
1335  if (fnd()->dict().merge(iter().dict()))
1336  {
1337  changed = true;
1338  }
1339  }
1340  else
1341  {
1342  add(iter().clone(*this).ptr(), true);
1343  changed = true;
1344  }
1345  }
1346  else
1347  {
1348  // Not found - just add
1349  add(iter().clone(*this).ptr());
1350  changed = true;
1351  }
1352  }
1353 
1354  return changed;
1355 }
1356 
1357 
1359 {
1361  hashedEntries_.clear();
1362  patternEntries_.clear();
1363  patternRegexps_.clear();
1364 }
1365 
1366 
1368 {
1369  // Changing parents probably doesn't make much sense,
1370  // but what about the names?
1371  name() = dict.name();
1372 
1374  hashedEntries_.transfer(dict.hashedEntries_);
1375  patternEntries_.transfer(dict.patternEntries_);
1376  patternRegexps_.transfer(dict.patternRegexps_);
1377 }
1378 
1379 
1380 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
1381 
1383 {
1384  return lookup(keyword);
1385 }
1386 
1387 
1389 {
1390  // Check for assignment to self
1391  if (this == &rhs)
1392  {
1393  FatalIOErrorInFunction(*this)
1394  << "attempted assignment to self for dictionary " << name()
1395  << abort(FatalIOError);
1396  }
1397 
1398  name() = rhs.name();
1399  clear();
1400 
1401  // Create clones of the entries in the given dictionary
1402  // resetting the parentDict to this dictionary
1403 
1404  forAllConstIter(IDLList<entry>, rhs, iter)
1405  {
1406  add(iter().clone(*this).ptr());
1407  }
1408 }
1409 
1410 
1412 {
1413  // Check for assignment to self
1414  if (this == &rhs)
1415  {
1416  FatalIOErrorInFunction(*this)
1417  << "attempted addition assignment to self for dictionary " << name()
1418  << abort(FatalIOError);
1419  }
1420 
1421  forAllConstIter(IDLList<entry>, rhs, iter)
1422  {
1423  add(iter().clone(*this).ptr());
1424  }
1425 }
1426 
1427 
1429 {
1430  // Check for assignment to self
1431  if (this == &rhs)
1432  {
1433  FatalIOErrorInFunction(*this)
1434  << "attempted assignment to self for dictionary " << name()
1435  << abort(FatalIOError);
1436  }
1437 
1438  forAllConstIter(IDLList<entry>, rhs, iter)
1439  {
1440  if (!found(iter().keyword()))
1441  {
1442  add(iter().clone(*this).ptr());
1443  }
1444  }
1445 }
1446 
1447 
1449 {
1450  // Check for assignment to self
1451  if (this == &rhs)
1452  {
1453  FatalIOErrorInFunction(*this)
1454  << "attempted assignment to self for dictionary " << name()
1455  << abort(FatalIOError);
1456  }
1457 
1458  forAllConstIter(IDLList<entry>, rhs, iter)
1459  {
1460  set(iter().clone(*this).ptr());
1461  }
1462 }
1463 
1464 
1465 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
1466 
1467 Foam::dictionary Foam::operator+
1468 (
1469  const dictionary& dict1,
1470  const dictionary& dict2
1471 )
1472 {
1473  dictionary sum(dict1);
1474  sum += dict2;
1475  return sum;
1476 }
1477 
1478 
1479 Foam::dictionary Foam::operator|
1480 (
1481  const dictionary& dict1,
1482  const dictionary& dict2
1483 )
1484 {
1485  dictionary sum(dict1);
1486  sum |= dict2;
1487  return sum;
1488 }
1489 
1490 
1491 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
1492 
1494 (
1495  const Tuple2<string, label>& argStringLine,
1496  word& funcName,
1498  List<Tuple3<word, string, label>>& namedArgs
1499 )
1500 {
1501  const string& argString = argStringLine.first();
1502  label lineNumber = argStringLine.second();
1503 
1504  funcName = argString;
1505 
1506  int argLevel = 0;
1507  bool namedArg = false;
1508  word argName;
1509 
1510  word::size_type start = 0;
1511  word::size_type i = 0;
1512 
1513  for
1514  (
1515  word::const_iterator iter = argString.begin();
1516  iter != argString.end();
1517  ++iter
1518  )
1519  {
1520  char c = *iter;
1521 
1522  if (c == '\n')
1523  {
1524  lineNumber++;
1525  }
1526  else if (c == '(')
1527  {
1528  if (argLevel == 0)
1529  {
1530  funcName = argString(start, i - start);
1531  start = i + 1;
1532  }
1533  ++argLevel;
1534  }
1535  else if (c == ',' || c == ')')
1536  {
1537  if (argLevel == 1)
1538  {
1539  if (namedArg)
1540  {
1541  namedArgs.append
1542  (
1544  (
1545  argName,
1546  argString(start, i - start),
1547  lineNumber
1548  )
1549  );
1550  namedArg = false;
1551  }
1552  else
1553  {
1554  args.append
1555  (
1557  (
1558  wordRe(argString(start, i - start)),
1559  lineNumber
1560  )
1561  );
1562  }
1563  start = i + 1;
1564  }
1565 
1566  if (c == ')')
1567  {
1568  if (argLevel == 1)
1569  {
1570  break;
1571  }
1572  --argLevel;
1573  }
1574  }
1575  else if (c == '=')
1576  {
1577  argName = argString(start, i - start);
1578  string::stripInvalid<variable>(argName);
1579  start = i + 1;
1580  namedArg = true;
1581  }
1582 
1583  i++;
1584  }
1585 
1586  // Strip whitespace from the function name
1587  string::stripInvalid<word>(funcName);
1588 }
1589 
1590 
1592 (
1593  const Tuple2<string, label>& argStringLine,
1595  List<Tuple3<word, string, label>>& namedArgs
1596 )
1597 {
1598  const string& argString = argStringLine.first();
1599  label lineNumber = argStringLine.second();
1600 
1601  int argLevel = 0;
1602  bool namedArg = false;
1603  word argName;
1604 
1605  word::size_type start = 0;
1606  word::size_type i = 0;
1607 
1608  for
1609  (
1610  word::const_iterator iter = argString.begin();
1611  iter != argString.end();
1612  ++iter
1613  )
1614  {
1615  char c = *iter;
1616 
1617  if (c == '\n')
1618  {
1619  lineNumber++;
1620  }
1621  else if (c == '(')
1622  {
1623  ++argLevel;
1624  }
1625  else if (c == ',' || std::next(iter) == argString.end())
1626  {
1627  if (std::next(iter) == argString.end())
1628  {
1629  if (c == ')')
1630  {
1631  --argLevel;
1632  }
1633 
1634  ++i;
1635  }
1636 
1637  if (argLevel == 0)
1638  {
1639  if (namedArg)
1640  {
1641  namedArgs.append
1642  (
1644  (
1645  argName,
1646  argString(start, i - start),
1647  lineNumber
1648  )
1649  );
1650  namedArg = false;
1651  }
1652  else
1653  {
1654  args.append
1655  (
1657  (
1658  wordRe(argString(start, i - start)),
1659  lineNumber
1660  )
1661  );
1662  }
1663  start = i+1;
1664  }
1665  }
1666  else if (c == '=')
1667  {
1668  argName = argString(start, i - start);
1669  string::stripInvalid<variable>(argName);
1670  start = i+1;
1671  namedArg = true;
1672  }
1673  else if (c == ')')
1674  {
1675  --argLevel;
1676  }
1677 
1678  ++i;
1679  }
1680 }
1681 
1682 
1684 {
1685  const string::size_type i = scopedName.find_last_of("/!");
1686 
1687  if (i != string::npos)
1688  {
1689  return Pair<word>
1690  (
1691  scopedName.substr(0, i),
1692  scopedName.substr(i + 1, string::npos)
1693  );
1694  }
1695  else
1696  {
1697  return Pair<word>("", scopedName);
1698  }
1699 }
1700 
1701 
1702 // ************************************************************************* //
label k
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:474
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:492
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
An STL-conforming const_iterator.
Definition: HashTable.H:494
An STL-conforming iterator.
Definition: HashTable.H:443
Template class for intrusive linked lists.
Definition: ILList.H:67
void transfer(ILList< LListBase, T > &)
Transfer the contents of the argument into this List.
Definition: ILList.C:134
void clear()
Clear the contents of the list.
Definition: ILList.C:121
const word & name() const
Return name.
Definition: IOobject.H:307
bool bad() const
Return true if stream is corrupted.
Definition: IOstream.H:351
virtual Istream & read(token &)
Return next token from stream.
Definition: ISstream.C:133
Input from memory buffer stream.
Definition: IStringStream.H:52
Input token stream.
Definition: ITstream.H:56
bool eof() const
Return true if end of input seen.
Definition: Istream.H:107
An STL-conforming const_iterator.
Definition: LList.H:300
An STL-conforming iterator.
Definition: LList.H:249
Template class for non-intrusive linked lists.
Definition: LList.H:76
friend class iterator
Definition: LList.H:82
friend class const_iterator
Definition: LList.H:85
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 setSize(const label)
Reset size of List.
Definition: List.C:281
A Foam::OSstream for calculating SHA-1 digests.
Definition: OSHA1stream.H:152
SHA1Digest digest()
Return the SHA-1 digest for the data processed until now.
Definition: OSHA1stream.H:194
Output to memory buffer stream.
Definition: OStringStream.H:52
string str() const
Return the string.
The SHA1 message digest.
Definition: SHA1Digest.H:63
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:66
const Type2 & second() const
Return second.
Definition: Tuple2.H:131
const Type1 & first() const
Return first.
Definition: Tuple2.H:119
A 3-tuple for storing three objects of different types.
Definition: Tuple3.H:60
An STL-conforming const_iterator.
Definition: UILList.H:237
An STL-conforming iterator.
Definition: UILList.H:188
T * remove(T *p)
Remove and return element.
Definition: UILList.H:142
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 keyword and a list of tokens is a 'dictionaryEntry'.
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & topDict() const
Return the top of the tree.
Definition: dictionary.C:341
ITstream & operator[](const word &) const
Find and return entry.
Definition: dictionary.C:1382
dictionary()
Construct top-level dictionary null.
Definition: dictionary.C:255
autoPtr< dictionary > clone() const
Construct and return clone.
Definition: dictionary.C:327
void operator<<=(const dictionary &)
Unconditionally include entries from the given dictionary.
Definition: dictionary.C:1448
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
Definition: dictionary.C:1367
const dictionary & subDictBackwardsCompatible(const wordList &) const
Find and return a sub-dictionary, trying a list of keywords in.
Definition: dictionary.C:809
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
Definition: dictionary.C:507
const dictionary & subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary.
Definition: dictionary.C:829
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
bool changeKeyword(const keyType &oldKeyword, const keyType &newKeyword, bool forceOverwrite=false)
Change the keyword for an entry,.
Definition: dictionary.C:1224
const dictionary & typeDict(const word &typeName) const
Find and return a type sub-dictionary.
Definition: dictionary.C:874
tokenList tokens() const
Return the dictionary as a list of tokens.
Definition: dictionary.C:448
const fileName & currentName() const
Return the dictionary name, or the name of the file if the.
Definition: dictionary.C:376
const entry & lookupEntry(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present otherwise error.
Definition: dictionary.C:626
List< keyType > keys(bool patterns=false) const
Return the list of available keys or patterns.
Definition: dictionary.C:1001
void operator+=(const dictionary &)
Include entries from the given dictionary.
Definition: dictionary.C:1411
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:856
const entry * lookupScopedEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present,.
Definition: dictionary.C:696
word topDictKeyword() const
Return the scoped keyword with which this dictionary can be.
Definition: dictionary.C:356
bool remove(const word &)
Remove an entry specified by keyword.
Definition: dictionary.C:1182
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:732
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
const entry & lookupEntryBackwardsCompatible(const wordList &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present, trying a list.
Definition: dictionary.C:647
virtual label endLineNumber() const
Return line number of last token in dictionary.
Definition: dictionary.C:414
wordList sortedToc() const
Return the sorted table of contents.
Definition: dictionary.C:995
const dictionary & typeOrEmptyDict(const word &typeName) const
Find and return a type sub-dictionary.
Definition: dictionary.C:898
const entry * lookupEntryPtrBackwardsCompatible(const wordList &, bool recursive, bool patternMatch) const
Find and return an entry data stream if present, trying a list.
Definition: dictionary.C:590
void operator|=(const dictionary &)
Conditionally include entries from the given dictionary.
Definition: dictionary.C:1428
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:1019
void clear()
Clear the dictionary.
Definition: dictionary.C:1358
virtual ~dictionary()
Destructor.
Definition: dictionary.C:335
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
Definition: dictionary.C:680
const dictionary * subDictPtr(const word &) const
Find and return a sub-dictionary pointer if present.
Definition: dictionary.C:748
void operator=(const dictionary &)
Definition: dictionary.C:1388
wordList toc() const
Return the table of contents.
Definition: dictionary.C:981
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:468
const dictionary & scopedDict(const word &) const
Find and return a sub-dictionary by scoped lookup.
Definition: dictionary.C:943
virtual label startLineNumber() const
Return line number of first token in dictionary.
Definition: dictionary.C:401
static const dictionary null
Null dictionary.
Definition: dictionary.H:261
bool merge(const dictionary &)
Merge entries from the given dictionary.
Definition: dictionary.C:1313
const dictionary & optionalTypeDict(const word &typeName) const
Find and return an optional type sub-dictionary.
Definition: dictionary.C:921
SHA1Digest digest() const
Return the SHA1 digest of the dictionary contents.
Definition: dictionary.C:434
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
const keyType & keyword() const
Return keyword.
Definition: entry.H:136
virtual const fileName & name() const =0
Return the dictionary name.
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.
static int disableFunctionEntries
Definition: entry.H:102
A class for handling file names.
Definition: fileName.H:82
word name() const
Return file name (part beyond last /)
Definition: fileName.C:195
A class for handling keywords in dictionaries.
Definition: keyType.H:69
bool isPattern() const
Should be treated as a match rather than a literal string.
Definition: keyTypeI.H:97
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
static bool haveDefaults(const dictionary &dict)
Return if a dictionary exists to add defaults to for a given.
static dictionary & defaults(const dictionary &dict)
Return the dictionary to add defaults to for a given dictionary.
Wrapper around POSIX extended regular expressions.
Definition: regExp.H:62
A class for handling character strings derived from std::string.
Definition: string.H:79
A token holds items read from Istream.
Definition: token.H:74
bool good() const
Definition: tokenI.H:309
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:77
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tUEqn clear()
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
const doubleScalar e
Definition: doubleScalar.H:106
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:1494
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
void add(GeometricField< typename typeOfSum< Type1, Type2 >::type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type1, GeoMesh, PrimitiveField2 > &gf1, const GeometricField< Type2, GeoMesh, PrimitiveField3 > &gf2)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
errorManip< error > abort(error &err)
Definition: errorManip.H:131
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
Definition: dictionary.C:1683
T clone(const T &t)
Definition: List.H:55
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
IOerror FatalIOError
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
LList< DLListBase, T > DLList
Definition: DLList.H:43
List< token > tokenList
List of tokens, used for a IOdictionary entry.
Definition: tokenList.H:42
dictionary dict
const bool overwrite
Definition: setNoOverwrite.H:1
Foam::argList args(argc, argv)
volScalarField & p