dictionary.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-2017 OpenFOAM Foundation
9  Copyright (C) 2015-2021 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 \*---------------------------------------------------------------------------*/
28 
29 #include "dictionary.H"
30 #include "error.H"
31 #include "JobInfo.H"
32 #include "primitiveEntry.H"
33 #include "dictionaryEntry.H"
34 #include "regExp.H"
35 #include "OSHA1stream.H"
36 #include "OSstream.H"
37 #include "argList.H"
38 #include "registerSwitch.H"
39 
40 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
41 
42 namespace Foam
43 {
44  defineTypeNameAndDebug(dictionary, 0);
45 }
46 
48 
50 
52 (
53  Foam::debug::infoSwitch("writeOptionalEntries", 0)
54 );
55 
56 
58 (
59  "writeOptionalEntries",
60  int,
62 );
63 
64 
65 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
66 
67 Foam::word Foam::dictionary::executableName()
68 {
69  return argList::envExecutable();
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 
76 :
77  name_(),
78  parent_(dictionary::null)
79 {}
80 
81 
83 :
84  name_(name),
85  parent_(dictionary::null)
86 {}
87 
88 
90 (
91  const dictionary& parentDict,
92  const dictionary& dict
93 )
94 :
95  parent_type(dict, *this),
96  name_(dict.name()),
97  parent_(parentDict)
98 {
99  for (entry& e : *this)
100  {
101  hashedEntries_.insert(e.keyword(), &e);
102 
103  if (e.keyword().isPattern())
104  {
105  patterns_.insert(&e);
106  regexps_.insert(autoPtr<regExp>::New(e.keyword()));
107  }
108  }
109 }
110 
111 
113 (
114  const dictionary& dict
115 )
116 :
117  parent_type(dict, *this),
118  name_(dict.name()),
119  parent_(dictionary::null)
120 {
121  for (entry& e : *this)
122  {
123  hashedEntries_.insert(e.keyword(), &e);
124 
125  if (e.keyword().isPattern())
126  {
127  patterns_.insert(&e);
128  regexps_.insert(autoPtr<regExp>::New(e.keyword()));
129  }
130  }
131 }
132 
133 
134 Foam::dictionary::dictionary(const dictionary* dict)
135 :
136  name_(),
137  parent_(dictionary::null)
138 {
139  if (dict)
140  {
141  operator=(*dict);
142  }
143 }
144 
145 
147 (
148  const dictionary& parentDict,
149  dictionary&& dict
150 )
151 :
152  name_(),
153  parent_(parentDict)
154 {
155  transfer(dict);
156  name() = fileName::concat(parentDict.name(), name(), '.');
157 }
158 
159 
161 (
162  dictionary&& dict
163 )
164 :
165  name_(),
166  parent_(dictionary::null)
167 {
168  transfer(dict);
169 }
170 
171 
173 {
174  return autoPtr<dictionary>::New(*this);
175 }
176 
177 
178 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
179 
181 {}
182 
183 
184 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
185 
186 Foam::fileName Foam::dictionary::relativeName(const bool caseTag) const
187 {
188  return argList::envRelativePath(name(), caseTag);
189 }
190 
191 
193 {
194  const dictionary& p = parent();
195 
196  if (&p != this && !p.name().empty())
197  {
198  return p.topDict();
199  }
200 
201  return *this;
202 }
203 
204 
205 Foam::label Foam::dictionary::startLineNumber() const
206 {
207  if (size())
208  {
209  return first()->startLineNumber();
210  }
211 
212  return -1;
213 }
214 
215 
216 Foam::label Foam::dictionary::endLineNumber() const
217 {
218  if (size())
219  {
220  return last()->endLineNumber();
221  }
222 
223  return -1;
224 }
225 
226 
228 {
229  OSHA1stream os;
230 
231  // Process entries
232  for (const entry& e : *this)
233  {
234  os << e;
235  }
236 
237  return os.digest();
238 }
239 
240 
242 {
243  // Serialize dictionary entries into a string
244  OStringStream os;
245 
246  // Process entries
247  for (const entry& e : *this)
248  {
249  os << e;
250  }
251 
252  // String re-parsed as a list of tokens
253  return ITstream::parse(os.str());
254 }
255 
256 
258 (
259  const ITstream& is,
260  const word& keyword
261 ) const
262 {
263  if (is.nRemainingTokens())
264  {
265  const label remaining = is.nRemainingTokens();
266 
267  // Similar to SafeFatalIOError
269  {
270  OSstream& err =
272  (
273  "", // functionName
274  "", // sourceFileName
275  0, // sourceFileLineNumber
276  relativeName(), // ioFileName == dictionary name
277  is.lineNumber() // ioStartLineNumber
278  );
279 
280  err << "Entry '" << keyword << "' has "
281  << remaining << " excess tokens in stream" << nl << nl
282  << " ";
283  is.writeList(err, 0);
284 
285  err << exit(FatalIOError);
286  }
287  else
288  {
289  std::cerr
290  << nl
291  << "--> FOAM FATAL IO ERROR:" << nl;
292 
293  std::cerr
294  << "Entry '" << keyword << "' has "
295  << remaining << " excess tokens in stream" << nl << nl;
296 
297  std::cerr
298  // ioFileName == dictionary name
299  << "file: " << relativeName()
300  << " at line " << is.lineNumber() << '.' << nl
301  << std::endl;
302 
303  std::exit(1);
304  }
305  }
306  else if (!is.size())
307  {
308  // Similar to SafeFatalIOError
310  {
312  (
313  "", // functionName
314  "", // sourceFileName
315  0, // sourceFileLineNumber
316  relativeName(), // ioFileName == dictionary name
317  is.lineNumber() // ioStartLineNumber
318  )
319  << "Entry '" << keyword
320  << "' had no tokens in stream" << nl << nl
321  << exit(FatalIOError);
322  }
323  else
324  {
325  std::cerr
326  << nl
327  << "--> FOAM FATAL IO ERROR:" << nl
328  << "Entry '" << keyword
329  << "' had no tokens in stream" << nl << nl;
330 
331  std::cerr
332  // ioFileName == dictionary name
333  << "file: " << relativeName()
334  << " at line " << is.lineNumber() << '.' << nl
335  << std::endl;
336 
337  std::exit(1);
338  }
339  }
340 }
341 
342 
343 void Foam::dictionary::raiseBadInput
344 (
345  const ITstream& is,
346  const word& keyword
347 ) const
348 {
349  // Can use FatalIOError instead of SafeFatalIOError
350  // since predicate checks are not used at the earliest stages
352  (
353  "", // functionName
354  "", // sourceFileName
355  0, // sourceFileLineNumber
356  relativeName(), // ioFileName == dictionary name
357  is.lineNumber(), // ioStartLineNumber
358  -1 // ioEndLineNumber
359  )
360  << "Entry '" << keyword << "' with invalid input" << nl
361  << exit(FatalIOError);
362 }
363 
364 
366 (
367  const word& keyword,
368  enum keyType::option matchOpt
369 ) const
370 {
371  const const_searcher finder(csearch(keyword, matchOpt));
372 
373  if (!finder.good())
374  {
376  << "Entry '" << keyword << "' not found in dictionary "
377  << relativeName() << nl
378  << exit(FatalIOError);
379  }
380 
381  return finder.ref();
382 }
383 
384 
386 (
387  const word& keyword,
388  enum keyType::option matchOpt
389 ) const
390 {
391  return lookupEntry(keyword, matchOpt).stream();
392 }
393 
394 
396 (
397  const word& keyword,
398  bool mergeEntry
399 )
400 {
401  if (keyword.size() < 2)
402  {
403  return false;
404  }
405 
406  // Drop leading '$' to get the var-name, already validated as word.
407  const word varName(keyword.substr(1), false);
408 
409  // Lookup the variable name in the given dictionary
410  const const_searcher finder(csearch(varName, keyType::REGEX_RECURSIVE));
411 
412  // If defined insert its entries into this dictionary
413  if (finder.good())
414  {
415  for (const entry& e : finder.dict())
416  {
417  add(e, mergeEntry);
418  }
419 
420  return true;
421  }
422 
423  return false;
424 }
425 
426 
428 (
429  const word& keyword,
430  bool mergeEntry
431 )
432 {
433  if (keyword.size() < 2)
434  {
435  return false;
436  }
437 
438  // Drop leading '$' to get the var-name, already validated as word.
439  const word varName(keyword.substr(1), false);
440 
441  // Lookup the variable name in the given dictionary
442  const auto finder(csearchScoped(varName, keyType::REGEX_RECURSIVE));
443 
444  // If defined insert its entries into this dictionary
445  if (finder.good())
446  {
447  for (const entry& e : finder.dict())
448  {
449  add(e, mergeEntry);
450  }
451 
452  return true;
453  }
454 
455  return false;
456 }
457 
458 
460 (
461  const word& keyword,
462  enum keyType::option matchOpt
463 ) const
464 {
465  const const_searcher finder(csearch(keyword, matchOpt));
466 
467  if (!finder.good())
468  {
470  << "Entry '" << keyword << "' not found in dictionary "
471  << relativeName() << nl
472  << exit(FatalIOError);
473  }
474 
475  return finder.dict();
476 }
477 
478 
480 (
481  const word& keyword,
482  enum keyType::option matchOpt
483 )
484 {
485  searcher finder(search(keyword, matchOpt));
486 
487  if (!finder.good())
488  {
490  << "Entry '" << keyword << "' not found in dictionary "
491  << relativeName() << nl
492  << exit(FatalIOError);
493  }
494 
495  return finder.dict();
496 }
497 
498 
500 (
501  const word& keyword,
502  enum keyType::option matchOpt
503 )
504 {
505  searcher finder(search(keyword, matchOpt));
506 
507  dictionary* ptr = finder.dictPtr();
508 
509  if (ptr)
510  {
511  // Found and a sub-dictionary
512  return *ptr;
513  }
514 
515  if (finder.good())
516  {
518  << "Entry '" << keyword
519  << "' is not a sub-dictionary in dictionary "
520  << relativeName() << nl
521  << exit(FatalIOError);
522  }
523 
524  ptr = this->set(keyword, dictionary())->dictPtr();
525 
526  if (!ptr)
527  {
529  << "Failed to insert sub-dictionary '" << keyword
530  << "' in dictionary "
531  << relativeName() << nl
532  << exit(FatalIOError);
533  }
534 
535  return *ptr;
536 }
537 
538 
540 (
541  const word& keyword,
542  enum keyType::option matchOpt,
543  const bool mandatory
544 ) const
545 {
546  const const_searcher finder(csearch(keyword, matchOpt));
547 
548  if (finder.isDict())
549  {
550  // Found and a sub-dictionary
551  return finder.dict();
552  }
553 
554  if (mandatory)
555  {
557  << "Entry '" << keyword
558  << "' is not a sub-dictionary in dictionary "
559  << relativeName() << nl
560  << exit(FatalIOError);
561  }
562 
563  if (finder.good())
564  {
565  IOWarningInFunction(*this)
566  << "Entry '" << keyword
567  << "' found but not a sub-dictionary in dictionary "
568  << relativeName() << endl;
569  }
570 
571  // The move constructor properly qualifies the dictionary name
572  return dictionary(*this, dictionary(fileName(keyword)));
573 }
574 
575 
577 (
578  const word& keyword,
579  enum keyType::option matchOpt
580 ) const
581 {
582  const const_searcher finder(csearch(keyword, matchOpt));
583 
584  if (finder.isDict())
585  {
586  // Found and a sub-dictionary
587  return finder.dict();
588  }
589 
590  if (finder.good())
591  {
592  IOWarningInFunction(*this)
593  << "Entry '" << keyword
594  << "' found but not a sub-dictionary in dictionary "
595  << relativeName() << endl;
596  }
597 
598  return *this;
599 }
600 
601 
603 {
604  wordList list(size());
605 
606  label n = 0;
607  for (const entry& e : *this)
608  {
609  list[n++] = e.keyword();
610  }
611 
612  return list;
613 }
614 
615 
617 {
618  return hashedEntries_.sortedToc();
619 }
620 
621 
623 {
624  List<keyType> list(size());
625 
626  label n = 0;
627  for (const entry& e : *this)
628  {
629  if (e.keyword().isPattern() ? patterns : !patterns)
630  {
631  list[n++] = e.keyword();
632  }
633  }
634  list.resize(n);
635 
636  return list;
637 }
638 
639 
640 Foam::entry* Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
641 {
642  if (!entryPtr)
643  {
644  return nullptr;
645  }
646 
647  auto iter = hashedEntries_.find(entryPtr->keyword());
648 
649  if (mergeEntry && iter.good())
650  {
651  // Merge dictionary with dictionary
652  if (iter()->isDict() && entryPtr->isDict())
653  {
654  iter()->dict().merge(entryPtr->dict());
655 
656  delete entryPtr;
657  return iter(); // pointer to existing dictionary
658  }
659 
660 
661  // Replace existing dictionary with entry or vice versa
662  parent_type::replace(iter(), entryPtr);
663  delete iter();
664  hashedEntries_.erase(iter);
665 
666  if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
667  {
668  entryPtr->name() =
669  fileName::concat(name(), entryPtr->keyword(), '.');
670 
671  if (entryPtr->keyword().isPattern())
672  {
673  patterns_.insert(entryPtr);
674  regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
675  }
676 
677  return entryPtr; // now an entry in the dictionary
678  }
679 
680 
681  IOWarningInFunction(*this)
682  << "Problem replacing entry "<< entryPtr->keyword()
683  << " in dictionary " << relativeName() << endl;
684 
685  parent_type::remove(entryPtr);
686 
687  delete entryPtr;
688  return nullptr;
689  }
690 
691 
692  if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
693  {
694  entryPtr->name() =
695  fileName::concat(name(), entryPtr->keyword(), '.');
696 
697  parent_type::append(entryPtr);
698 
699  if (entryPtr->keyword().isPattern())
700  {
701  patterns_.insert(entryPtr);
702  regexps_.insert(autoPtr<regExp>::New(entryPtr->keyword()));
703  }
704 
705  return entryPtr; // now an entry in the dictionary
706  }
707 
708 
709  IOWarningInFunction(*this)
710  << "Attempt to add entry " << entryPtr->keyword()
711  << " which already exists in dictionary "
712  << relativeName() << endl;
713 
714  delete entryPtr;
715  return nullptr;
716 }
717 
718 
719 Foam::entry* Foam::dictionary::add(const entry& e, bool mergeEntry)
720 {
721  return add(e.clone(*this).ptr(), mergeEntry);
722 }
723 
724 
726 (
727  const keyType& k,
728  const word& v,
729  bool overwrite
730 )
731 {
732  return add(new primitiveEntry(k, token(v)), overwrite);
733 }
734 
735 
737 (
738  const keyType& k,
739  const Foam::string& v,
740  bool overwrite
741 )
742 {
743  return add(new primitiveEntry(k, token(v)), overwrite);
744 }
745 
746 
748 (
749  const keyType& k,
750  const label v,
751  bool overwrite
752 )
753 {
754  return add(new primitiveEntry(k, token(v)), overwrite);
755 }
756 
757 
759 (
760  const keyType& k,
761  const scalar v,
762  bool overwrite
763 )
764 {
765  return add(new primitiveEntry(k, token(v)), overwrite);
766 }
767 
768 
770 (
771  const keyType& k,
772  const dictionary& v,
773  bool mergeEntry
774 )
775 {
776  return add(new dictionaryEntry(k, *this, v), mergeEntry);
777 }
778 
779 
781 {
782  if (!entryPtr)
783  {
784  return nullptr;
785  }
786 
787  // Find non-recursive with patterns
788  searcher finder(search(entryPtr->keyword(), keyType::REGEX));
789 
790  // Clear dictionary so merge acts like overwrite
791  if (finder.isDict())
792  {
793  finder.dict().clear();
794  }
795 
796  return add(entryPtr, true);
797 }
798 
799 
801 {
802  return set(e.clone(*this).ptr());
803 }
804 
805 
807 {
808  return set(new dictionaryEntry(k, *this, v));
809 }
810 
811 
813 {
814  if (this == &dict)
815  {
817  << "Attempted merge to self, for dictionary "
818  << relativeName() << nl
819  << abort(FatalIOError);
820  }
821 
822  bool changed = false;
823 
824  for (const entry& e : dict)
825  {
826  auto fnd = hashedEntries_.find(e.keyword());
827 
828  if (fnd.good())
829  {
830  // Recursively merge sub-dictionaries
831  // TODO: merge without copying
832  if (fnd()->isDict() && e.isDict())
833  {
834  if (fnd()->dict().merge(e.dict()))
835  {
836  changed = true;
837  }
838  }
839  else
840  {
841  add(e.clone(*this).ptr(), true);
842  changed = true;
843  }
844  }
845  else
846  {
847  // Not found - just add
848  add(e.clone(*this).ptr());
849  changed = true;
850  }
851  }
852 
853  return changed;
854 }
855 
856 
858 {
860  hashedEntries_.clear();
861  patterns_.clear();
862  regexps_.clear();
863 }
864 
865 
867 {
868  // Changing parents probably doesn't make much sense,
869  // but what about the names?
870  name() = dict.name();
871 
872  parent_type::transfer(dict);
873  hashedEntries_.transfer(dict.hashedEntries_);
874  patterns_.transfer(dict.patterns_);
875  regexps_.transfer(dict.regexps_);
876 }
877 
878 
879 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
880 
882 {
883  if (this == &rhs)
884  {
885  return; // Self-assignment is a no-op
886  }
887 
888  name() = rhs.name();
889  clear();
890 
891  // Create clones of the entries in the given dictionary
892  // resetting the parentDict to this dictionary
893 
894  for (const entry& e : rhs)
895  {
896  add(e.clone(*this).ptr());
897  }
898 }
899 
900 
901 void Foam::dictionary::operator+=(const dictionary& rhs)
902 {
903  if (this == &rhs)
904  {
906  << "Attempted addition to self, for dictionary "
907  << relativeName() << nl
908  << abort(FatalIOError);
909  }
910 
911  for (const entry& e : rhs)
912  {
913  add(e.clone(*this).ptr());
914  }
915 }
916 
917 
918 void Foam::dictionary::operator|=(const dictionary& rhs)
919 {
920  if (this == &rhs)
921  {
923  << "Attempted |= merging to self, for dictionary "
924  << relativeName() << nl
925  << abort(FatalIOError);
926  }
927 
928  for (const entry& e : rhs)
929  {
930  if (!found(e.keyword()))
931  {
932  add(e.clone(*this).ptr());
933  }
934  }
935 }
936 
937 
938 void Foam::dictionary::operator<<=(const dictionary& rhs)
939 {
940  if (this == &rhs)
941  {
943  << "Attempted addition to self, for dictionary "
944  << relativeName() << nl
945  << abort(FatalIOError);
946  }
947 
948  for (const entry& e : rhs)
949  {
950  set(e.clone(*this).ptr());
951  }
952 }
953 
954 
955 /* * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * */
956 
957 Foam::dictionary Foam::operator+
958 (
959  const dictionary& dict1,
960  const dictionary& dict2
961 )
962 {
963  dictionary result(dict1);
964  result += dict2;
965  return result;
966 }
967 
968 
969 Foam::dictionary Foam::operator|
970 (
971  const dictionary& dict1,
972  const dictionary& dict2
973 )
974 {
975  dictionary result(dict1);
976  result |= dict2;
977  return result;
978 }
979 
980 
981 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:63
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Foam::dictionaryEntry
A keyword and a list of tokens is a 'dictionaryEntry'.
Definition: dictionaryEntry.H:61
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Definition: BitOps.C:30
Foam::dictionary::name
const fileName & name() const noexcept
Definition: dictionaryI.H:41
Foam::primitiveEntry
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
Definition: primitiveEntry.H:59
primitiveEntry.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::keyType::isPattern
bool isPattern() const noexcept
Definition: keyTypeI.H:97
Foam::fileName
A class for handling file names.
Definition: fileName.H:71
Foam::dictionary::reportingOutput
static refPtr< OSstream > reportingOutput
Definition: dictionary.H:391
Foam::List::resize
void resize(const label len)
Definition: ListI.H:132
Foam::dictionary::checkITstream
void checkITstream(const ITstream &is, const word &keyword) const
Definition: dictionary.C:251
Foam::dictionary::dictionary
dictionary()
Definition: dictionary.C:68
Foam::entry::isDict
virtual bool isDict() const noexcept
Definition: entry.H:229
Foam::dictionary::operator|=
void operator|=(const dictionary &rhs)
Definition: dictionary.C:911
Foam::IOstream::lineNumber
label lineNumber() const noexcept
Definition: IOstream.H:314
Foam::entry::keyword
const keyType & keyword() const noexcept
Definition: entry.H:191
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Definition: Ostream.H:381
Foam::token
A token holds an item read from Istream.
Definition: token.H:64
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:72
Foam::dictionary::set
entry * set(entry *entryPtr)
Definition: dictionary.C:773
append
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Foam::dictionary::lookupEntry
const entry & lookupEntry(const word &keyword, enum keyType::option matchOpt) const
Definition: dictionary.C:359
Foam::dictionary::operator+=
void operator+=(const dictionary &rhs)
Definition: dictionary.C:894
Foam::dictionary::subDictOrAdd
dictionary & subDictOrAdd(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Definition: dictionary.C:493
Foam::dictionary::substituteKeyword
bool substituteKeyword(const word &keyword, bool mergeEntry=false)
Definition: dictionary.C:389
Foam::dictionary::transfer
void transfer(dictionary &dict)
Definition: dictionary.C:859
Foam::dictionary::null
static const dictionary null
Definition: dictionary.H:388
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:58
Foam::debug::infoSwitch
int infoSwitch(const char *name, const int deflt=0)
Definition: debug.C:227
Foam::dictionary::keys
List< keyType > keys(bool patterns=false) const
Definition: dictionary.C:615
Foam::dictionary::Searcher
Definition: dictionary.H:136
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:66
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::dictionary::operator<<=
void operator<<=(const dictionary &rhs)
Definition: dictionary.C:931
Foam::dictionary::merge
bool merge(const dictionary &dict)
Definition: dictionary.C:805
Foam::dictionary::entry
friend class entry
Definition: dictionary.H:275
error.H
Foam::ITstream
An input stream of tokens.
Definition: ITstream.H:48
Foam::dictionary::relativeName
fileName relativeName(const bool caseTag=false) const
Definition: dictionary.C:179
argList.H
Foam::dictionary::~dictionary
virtual ~dictionary()
Definition: dictionary.C:173
Foam::dictionary::startLineNumber
label startLineNumber() const
Definition: dictionary.C:198
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:453
Foam::dictionary::endLineNumber
label endLineNumber() const
Definition: dictionary.C:209
Foam::argList::envRelativePath
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
Definition: argList.C:549
Foam::OSstream
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:50
Foam::dictionary::Searcher::dictPtr
dict_pointer dictPtr() const noexcept
Definition: dictionary.H:233
Foam::dictionary::Searcher::dict
dict_reference dict() const
Definition: dictionary.H:240
Foam::dictionary::topDict
const dictionary & topDict() const
Definition: dictionary.C:185
Foam::OSHA1stream
An output stream for calculating SHA1 digests.
Definition: OSHA1stream.H:176
Foam::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:379
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::ILList
Template class for intrusive linked lists.
Definition: ILList.H:48
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:932
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Definition: atmBoundaryLayer.C:26
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Foam::entry::dict
virtual const dictionary & dict() const =0
Foam::dictionary::writeOptionalEntries
static int writeOptionalEntries
Definition: dictionary.H:385
dictionaryEntry.H
Foam::SHA1Digest
The SHA1 message digest.
Definition: SHA1Digest.H:56
Foam::dictionary::Searcher::good
bool good() const noexcept
Definition: dictionary.H:197
Foam::dictionary::subOrEmptyDict
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Definition: dictionary.C:533
Foam::entry::name
virtual const fileName & name() const =0
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::argList::envExecutable
static word envExecutable()
Definition: argList.C:536
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:49
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:424
Foam::JobInfo::constructed
static bool constructed
Definition: JobInfo.H:97
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:58
Foam::OStringStream
Definition: StringStream.H:229
Foam::dictionary::operator=
void operator=(const dictionary &rhs)
Definition: dictionary.C:874
k
label k
Definition: LISASMDCalcMethod2.H:41
Foam::constant::electromagnetic::e
const dimensionedScalar e
Definition: createFields.H:11
Foam::dictionary::clone
autoPtr< dictionary > clone() const
Definition: dictionary.C:165
Foam::keyType::REGEX
@ REGEX
Regular expression.
Definition: keyType.H:80
dictionary.H
Foam::search
fileName search(const word &file, const fileName &directory)
Definition: fileName.C:564
Foam::fileName::concat
static fileName concat(const std::string &s1, const std::string &s2, const char delim='/')
Definition: fileName.C:211
Foam::dictionary::substituteScopedKeyword
bool substituteScopedKeyword(const word &keyword, bool mergeEntry=false)
Definition: dictionary.C:421
Foam::dictionary::optionalSubDict
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:570
OSHA1stream.H
JobInfo.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
Definition: exprTraits.C:52
Foam::dictionary::add
entry * add(entry *entryPtr, bool mergeEntry=false)
Definition: dictionary.C:633
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Definition: error.H:494
registerSwitch.H
Foam::dictionary::tokens
tokenList tokens() const
Definition: dictionary.C:234
regExp.H
Foam::dictionary::toc
wordList toc() const
Definition: dictionary.C:595
Foam::dictionary::digest
SHA1Digest digest() const
Definition: dictionary.C:220
IOWarningInFunction
#define IOWarningInFunction(ios)
Definition: messageStream.H:371
Foam::ITstream::nRemainingTokens
label nRemainingTokens() const noexcept
Definition: ITstream.H:210
Foam::dictionary::Searcher::isDict
bool isDict() const noexcept
Definition: dictionary.H:227
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::dictionary::clear
void clear()
Definition: dictionary.C:850
Foam::dictionary::sortedToc
wordList sortedToc() const
Definition: dictionary.C:609
Foam::ITstream::parse
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Definition: ITstream.C:75
Foam::dictionary::Searcher::ref
reference ref() const
Definition: dictionary.H:221
registerInfoSwitch
registerInfoSwitch("writeOptionalEntries", int, Foam::dictionary::writeOptionalEntries)
Foam::keyType::option
option
Definition: keyType.H:76
Foam::refPtr< Foam::OSstream >
Foam::keyType::REGEX_RECURSIVE
@ REGEX_RECURSIVE
Definition: keyType.H:85
OSstream.H