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