functionObjectList.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-2020 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 "functionObjectList.H"
27 #include "Time.H"
28 #include "mapPolyMesh.H"
29 #include "argList.H"
31 #include "dictionaryEntry.H"
32 #include "stringOps.H"
33 #include "Tuple2.H"
34 #include "etcFiles.H"
35 #include "IOdictionary.H"
36 #include "wordAndDictionary.H"
37 
38 
39 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
40 
42 (
43  "caseDicts/postProcessing"
44 );
45 
46 
47 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
48 
49 Foam::functionObject* Foam::functionObjectList::remove
50 (
51  const word& key,
52  label& oldIndex
53 )
54 {
55  functionObject* ptr = 0;
56 
57  // Find index of existing functionObject
58  HashTable<label>::iterator fnd = indices_.find(key);
59 
60  if (fnd != indices_.end())
61  {
62  oldIndex = fnd();
63 
64  // Retrieve the pointer and remove it from the old list
65  ptr = this->set(oldIndex, 0).ptr();
66  indices_.erase(fnd);
67  }
68  else
69  {
70  oldIndex = -1;
71  }
72 
73  return ptr;
74 }
75 
76 
77 void Foam::functionObjectList::listDir
78 (
79  const fileName& dir,
80  HashSet<word>& foMap
81 )
82 {
83  // Search specified directory for functionObject configuration files
84  {
85  fileNameList foFiles(fileHandler().readDir(dir));
86  forAll(foFiles, f)
87  {
88  if (foFiles[f].ext().empty())
89  {
90  foMap.insert(foFiles[f]);
91  }
92  }
93  }
94 
95  // Recurse into sub-directories
96  {
98  forAll(foDirs, fd)
99  {
100  listDir(dir/foDirs[fd], foMap);
101  }
102  }
103 }
104 
105 
107 {
108  HashSet<word> foMap;
109 
111 
112  forAll(etcDirs, ed)
113  {
114  listDir(etcDirs[ed], foMap);
115  }
116 
117  Info<< nl
118  << "Available configured functionObjects:"
119  << foMap.sortedToc()
120  << nl;
121 }
122 
123 
125 (
126  const word& funcName,
127  const word& region
128 )
129 {
130  // First check if there is a functionObject dictionary file in the
131  // region system directory
132  {
133  const fileName dictFile
134  (
135  stringOps::expand("$FOAM_CASE")/"system"/region/funcName
136  );
137 
138  if (isFile(dictFile))
139  {
140  return dictFile;
141  }
142  }
143 
144  // Next, if the region is specified, check if there is a functionObject
145  // dictionary file in the global system directory
146  if (region != word::null)
147  {
148  const fileName dictFile
149  (
150  stringOps::expand("$FOAM_CASE")/"system"/funcName
151  );
152 
153  if (isFile(dictFile))
154  {
155  return dictFile;
156  }
157  }
158 
159  // Finally, check etc directories
160  {
162 
163  forAll(etcDirs, i)
164  {
165  const fileName dictFile(search(funcName, etcDirs[i]));
166 
167  if (!dictFile.empty())
168  {
169  return dictFile;
170  }
171  }
172  }
173 
174  return fileName::null;
175 }
176 
177 
178 void Foam::functionObjectList::checkUnsetEntries
179 (
180  const string& funcCall,
181  const dictionary& funcArgsDict,
182  const dictionary& funcDict,
183  const string& context
184 )
185 {
186  const wordRe unset("<.*>");
187  unset.compile();
188 
189  forAllConstIter(IDLList<entry>, funcArgsDict, iter)
190  {
191  if (iter().isStream())
192  {
193  ITstream& tokens = iter().stream();
194 
195  forAll(tokens, i)
196  {
197  if (tokens[i].isWord())
198  {
199  if (unset.match(tokens[i].wordToken()))
200  {
201  FatalIOErrorInFunction(funcDict)
202  << "Essential value for keyword '"
203  << iter().keyword()
204  << "' not set in function entry" << nl
205  << " " << funcCall.c_str() << nl
206  << " in " << context.c_str() << nl
207  << " Placeholder value is "
208  << tokens[i].wordToken()
209  << exit(FatalIOError);
210  }
211  }
212  }
213  }
214  else
215  {
216  checkUnsetEntries(funcCall, iter().dict(), funcDict, context);
217  }
218  }
219 }
220 
221 
223 (
224  const string& funcCall,
225  dictionary& functionsDict,
226  const string& context,
227  HashSet<word>& requiredFields,
228  const word& region
229 )
230 {
231  word funcName(funcCall);
232 
233  int argLevel = 0;
235 
236  List<Tuple2<word, string>> namedArgs;
237  bool namedArg = false;
238  word argName;
239 
241  word::size_type i = 0;
242 
243  for
244  (
245  word::const_iterator iter = funcCall.begin();
246  iter != funcCall.end();
247  ++iter
248  )
249  {
250  char c = *iter;
251 
252  if (c == '(')
253  {
254  if (argLevel == 0)
255  {
256  funcName = funcCall(start, i - start);
257  start = i+1;
258  }
259  ++argLevel;
260  }
261  else if (c == ',' || c == ')')
262  {
263  if (argLevel == 1)
264  {
265  if (namedArg)
266  {
267  namedArgs.append
268  (
270  (
271  argName,
272  funcCall(start, i - start)
273  )
274  );
275  namedArg = false;
276  }
277  else
278  {
279  args.append(wordRe(funcCall(start, i - start)));
280  }
281  start = i+1;
282  }
283 
284  if (c == ')')
285  {
286  if (argLevel == 1)
287  {
288  break;
289  }
290  --argLevel;
291  }
292  }
293  else if (c == '=')
294  {
295  argName = string::validate<word>(funcCall(start, i - start));
296  start = i+1;
297  namedArg = true;
298  }
299 
300  ++i;
301  }
302 
303  // Strip whitespace from the function name
304  string::stripInvalid<word>(funcName);
305 
306  // Search for the functionObject dictionary
307  fileName path = findDict(funcName, region);
308 
309  if (path == fileName::null)
310  {
312  << "Cannot find functionObject file " << funcName << endl;
313  return false;
314  }
315 
316  // Read the functionObject dictionary
317  // IFstream fileStream(path);
318  autoPtr<ISstream> fileStreamPtr(fileHandler().NewIFstream(path));
319  ISstream& fileStream = fileStreamPtr();
320 
321  // Delay processing the functionEntries
322  // until after the function argument entries have been added
324  dictionary funcsDict(funcName, functionsDict, fileStream);
326 
327  dictionary* funcDictPtr = &funcsDict;
328 
329  if (funcsDict.found(funcName) && funcsDict.isDict(funcName))
330  {
331  funcDictPtr = &funcsDict.subDict(funcName);
332  }
333 
334  dictionary& funcDict = *funcDictPtr;
335 
336  // Store the funcDict as read for error reporting context
337  const dictionary funcDict0(funcDict);
338 
339  // Insert the 'field' and/or 'fields' and 'objects' entries corresponding
340  // to both the arguments and the named arguments
342  forAll(args, i)
343  {
344  fieldArgs.append(wordAndDictionary(args[i], dictionary::null));
345  }
346  forAll(namedArgs, i)
347  {
348  if (namedArgs[i].first() == "field")
349  {
350  IStringStream iss(namedArgs[i].second());
351  fieldArgs.append(wordAndDictionary(iss));
352  }
353  if
354  (
355  namedArgs[i].first() == "fields"
356  || namedArgs[i].first() == "objects"
357  )
358  {
359  IStringStream iss(namedArgs[i].second());
360  fieldArgs.append(List<wordAndDictionary>(iss));
361  }
362  }
363  if (fieldArgs.size() == 1)
364  {
365  funcDict.set("field", fieldArgs[0].first());
366  funcDict.merge(fieldArgs[0].second());
367  }
368  if (fieldArgs.size() >= 1)
369  {
370  funcDict.set("fields", fieldArgs);
371  funcDict.set("objects", fieldArgs);
372  }
373 
374  // Insert non-field arguments
375  forAll(namedArgs, i)
376  {
377  if
378  (
379  namedArgs[i].first() != "field"
380  && namedArgs[i].first() != "fields"
381  && namedArgs[i].first() != "objects"
382  )
383  {
384  IStringStream entryStream
385  (
386  namedArgs[i].first() + ' ' + namedArgs[i].second() + ';'
387  );
388  funcDict.set(entry::New(entryStream).ptr());
389  }
390  }
391 
392  // Insert the region name if specified
393  if (region != word::null)
394  {
395  funcDict.set("region", region);
396  }
397 
398  const word funcCallKeyword = string::validate<word>(funcCall);
399  dictionary funcArgsDict;
400  funcArgsDict.add(funcCallKeyword, funcDict);
401 
402  // Re-parse the funcDict to execute the functionEntries
403  // now that the function argument entries have been added
404  {
405  OStringStream os;
406  funcArgsDict.write(os);
407  funcArgsDict = dictionary
408  (
409  funcName,
410  functionsDict,
411  IStringStream(os.str())()
412  );
413  }
414 
415  // Check for anything in the configuration that has not been set
416  checkUnsetEntries(funcCall, funcArgsDict, funcDict0, context);
417 
418  // Lookup the field, fields and objects entries from the now expanded
419  // funcDict and insert into the requiredFields
420  dictionary& expandedFuncDict = funcArgsDict.subDict(funcCallKeyword);
421  if (functionObject::debug)
422  {
424  << nl << incrIndent << indent
425  << funcCall << expandedFuncDict
426  << decrIndent << endl;
427  }
428  if (expandedFuncDict.found("field"))
429  {
430  requiredFields.insert(word(expandedFuncDict.lookup("field")));
431  }
432  if (expandedFuncDict.found("fields"))
433  {
434  List<wordAndDictionary> fields(expandedFuncDict.lookup("fields"));
435  forAll(fields, i)
436  {
437  requiredFields.insert(fields[i].first());
438  }
439  }
440  if (expandedFuncDict.found("objects"))
441  {
442  List<wordAndDictionary> objects(expandedFuncDict.lookup("objects"));
443  forAll(objects, i)
444  {
445  requiredFields.insert(objects[i].first());
446  }
447  }
448 
449  // Merge this functionObject dictionary into functionsDict
450  functionsDict.merge(funcArgsDict);
451  functionsDict.subDict(funcCallKeyword).name() = funcDict.name();
452 
453  return true;
454 }
455 
456 
457 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
458 
460 (
461  const Time& t,
462  const bool execution
463 )
464 :
466  digests_(),
467  indices_(),
468  time_(t),
469  parentDict_(t.controlDict()),
470  execution_(execution),
471  updated_(false)
472 {}
473 
474 
476 (
477  const Time& t,
478  const dictionary& parentDict,
479  const bool execution
480 )
481 :
483  digests_(),
484  indices_(),
485  time_(t),
486  parentDict_(parentDict),
487  execution_(execution),
488  updated_(false)
489 {}
490 
491 
493 (
494  const argList& args,
495  const Time& runTime,
496  dictionary& controlDict,
497  HashSet<word>& requiredFields
498 )
499 {
500  autoPtr<functionObjectList> functionsPtr;
501 
502  controlDict.add
503  (
504  dictionaryEntry("functions", controlDict, dictionary::null)
505  );
506 
507  dictionary& functionsDict = controlDict.subDict("functions");
508 
509  word region = word::null;
510 
511  // Set the region name if specified
512  if (args.optionFound("region"))
513  {
514  region = args["region"];
515  }
516 
517  if
518  (
519  args.optionFound("dict")
520  || args.optionFound("func")
521  || args.optionFound("funcs")
522  )
523  {
524  if (args.optionFound("dict"))
525  {
526  controlDict.merge
527  (
529  (
530  IOobject
531  (
532  args["dict"],
533  runTime,
535  )
536  )
537  );
538  }
539 
540  if (args.optionFound("func"))
541  {
543  (
544  args["func"],
545  functionsDict,
546  "command line " + args.commandLine(),
547  requiredFields,
548  region
549  );
550  }
551 
552  if (args.optionFound("funcs"))
553  {
554  wordList funcs(args.optionLookup("funcs")());
555 
556  forAll(funcs, i)
557  {
559  (
560  funcs[i],
561  functionsDict,
562  "command line " + args.commandLine(),
563  requiredFields,
564  region
565  );
566  }
567  }
568 
569  functionsPtr.reset(new functionObjectList(runTime, controlDict));
570  }
571  else
572  {
573  functionsPtr.reset(new functionObjectList(runTime));
574  }
575 
576  functionsPtr->read();
577 
578  return functionsPtr;
579 }
580 
581 
582 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
583 
585 {}
586 
587 
588 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
589 
591 {
593  digests_.clear();
594  indices_.clear();
595  updated_ = false;
596 }
597 
598 
600 {
601  forAll(*this, oi)
602  {
603  if (operator[](oi).name() == name)
604  {
605  return oi;
606  }
607  }
608 
609  return -1;
610 }
611 
612 
614 {
615  execution_ = true;
616 }
617 
618 
620 {
621  // For safety, also force a read() when execution is turned back on
622  updated_ = execution_ = false;
623 }
624 
625 
627 {
628  return execution_;
629 }
630 
631 
633 {
634  bool ok = read();
635 
636  if (execution_)
637  {
638  forAll(*this, oi)
639  {
640  if (operator[](oi).executeAtStart())
641  {
642  ok = operator[](oi).execute() && ok;
643  ok = operator[](oi).write() && ok;
644  }
645  }
646  }
647 
648  return ok;
649 }
650 
651 
653 {
654  bool ok = true;
655 
656  if (execution_)
657  {
658  if (!updated_)
659  {
660  read();
661  }
662 
663  forAll(*this, oi)
664  {
665  ok = operator[](oi).execute() && ok;
666  ok = operator[](oi).write() && ok;
667  }
668  }
669 
670  return ok;
671 }
672 
673 
675 {
676  bool ok = true;
677 
678  if (execution_)
679  {
680  if (!updated_)
681  {
682  read();
683  }
684 
685  forAll(*this, oi)
686  {
687  ok = operator[](oi).end() && ok;
688  }
689  }
690 
691  return ok;
692 }
693 
694 
696 {
697  bool set = true;
698 
699  if (execution_)
700  {
701  if (!updated_)
702  {
703  read();
704  }
705 
706  wordList names;
707 
708  forAll(*this, oi)
709  {
710  if (operator[](oi).setTimeStep())
711  {
712  names.append(operator[](oi).name());
713  set = true;
714  }
715  }
716 
717  if (names.size() > 1)
718  {
719  WarningInFunction << "Multiple function objects (" << names[0];
720  for (label i = 1; i < names.size(); ++ i)
721  {
722  WarningInFunction << ", " << names[i];
723  }
724  WarningInFunction << ") are setting the time step." << endl;
725  }
726  }
727 
728  return set;
729 }
730 
731 
733 {
734  scalar result = vGreat;
735 
736  if (execution_)
737  {
738  if (!updated_)
739  {
740  read();
741  }
742 
743  forAll(*this, oi)
744  {
745  result = min(result, operator[](oi).timeToNextWrite());
746  }
747  }
748 
749  return result;
750 }
751 
752 
754 {
755  bool ok = true;
756  updated_ = execution_;
757 
758  // Avoid reading/initializing if execution is off
759  if (!execution_)
760  {
761  return true;
762  }
763 
764  // Update existing and add new functionObjects
765  const entry* entryPtr = parentDict_.lookupEntryPtr
766  (
767  "functions",
768  false,
769  false
770  );
771 
772  if (entryPtr)
773  {
774  PtrList<functionObject> newPtrs;
775  List<SHA1Digest> newDigs;
776  HashTable<label> newIndices;
777 
778  label nFunc = 0;
779 
780  if (!entryPtr->isDict())
781  {
782  FatalIOErrorInFunction(parentDict_)
783  << "'functions' entry is not a dictionary"
784  << exit(FatalIOError);
785  }
786 
787  const dictionary& functionsDict = entryPtr->dict();
788 
789  libs.open
790  (
791  functionsDict,
792  "libs",
793  functionObject::dictionaryConstructorTablePtr_
794  );
795 
796  newPtrs.setSize(functionsDict.size());
797  newDigs.setSize(functionsDict.size());
798 
799  forAllConstIter(dictionary, functionsDict, iter)
800  {
801  const word& key = iter().keyword();
802 
803  if (!iter().isDict())
804  {
805  if (key != "libs")
806  {
807  IOWarningInFunction(parentDict_)
808  << "Entry " << key << " is not a dictionary" << endl;
809  }
810 
811  continue;
812  }
813 
814  const dictionary& dict = iter().dict();
815  bool enabled = dict.lookupOrDefault("enabled", true);
816 
817  newDigs[nFunc] = dict.digest();
818 
819  label oldIndex;
820  functionObject* objPtr = remove(key, oldIndex);
821 
822  if (objPtr)
823  {
824  if (enabled)
825  {
826  // Dictionary changed for an existing functionObject
827  if (newDigs[nFunc] != digests_[oldIndex])
828  {
829  ok = objPtr->read(dict) && ok;
830  }
831  }
832  else
833  {
834  // Delete the disabled functionObject
835  delete objPtr;
836  objPtr = nullptr;
837  continue;
838  }
839  }
840  else if (enabled)
841  {
843 
846  try
847  {
848  if
849  (
850  dict.found("writeControl")
851  || dict.found("outputControl")
852  )
853  {
854  foPtr.set
855  (
856  new functionObjects::timeControl(key, time_, dict)
857  );
858  }
859  else
860  {
861  foPtr = functionObject::New(key, time_, dict);
862  }
863  }
864  catch (Foam::IOerror& ioErr)
865  {
866  Info<< ioErr << nl << endl;
867  ::exit(1);
868  }
869  catch (Foam::error& err)
870  {
872  << "Caught FatalError " << err << nl << endl;
873  }
876 
877  if (foPtr.valid())
878  {
879  objPtr = foPtr.ptr();
880  }
881  else
882  {
883  ok = false;
884  }
885  }
886 
887  // Insert active functionObjects into the list
888  if (objPtr)
889  {
890  newPtrs.set(nFunc, objPtr);
891  newIndices.insert(key, nFunc);
892  nFunc++;
893  }
894  }
895 
896  newPtrs.setSize(nFunc);
897  newDigs.setSize(nFunc);
898 
899  // Updating the PtrList of functionObjects deletes any
900  // existing unused functionObjects
902  digests_.transfer(newDigs);
903  indices_.transfer(newIndices);
904  }
905  else
906  {
908  digests_.clear();
909  indices_.clear();
910  }
911 
912  return ok;
913 }
914 
915 
917 {
918  if (execution_)
919  {
920  forAll(*this, oi)
921  {
922  operator[](oi).updateMesh(mpm);
923  }
924  }
925 }
926 
927 
929 {
930  if (execution_)
931  {
932  forAll(*this, oi)
933  {
934  operator[](oi).movePoints(mesh);
935  }
936  }
937 }
938 
939 
940 // ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:50
bool read()
Read and set the function objects if their data have changed.
A HashTable with keys but without contents.
Definition: HashSet.H:59
dictionary dict
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:667
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
string expand(const string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping.
Definition: stringOps.C:69
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
A class for handling file names.
Definition: fileName.H:79
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
const entry * lookupEntryPtr(const word &, bool recursive, bool patternMatch) const
Find and return an entry data stream pointer if present.
Definition: dictionary.C:706
bool set(const label) const
Is element set.
Definition: PtrListI.H:65
functionObjectList(const Time &runTime, const bool execution=true)
Construct from Time and the execution setting.
SHA1Digest digest() const
Return the SHA1 digest of the dictionary contents.
Definition: dictionary.C:633
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
Definition: autoPtrI.H:114
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
Definition: HashTable.H:112
void off()
Switch the function objects off.
scalar timeToNextWrite()
Return the time to the next write.
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
A 2-tuple for storing two objects of different types.
Definition: HashTable.H:65
static void list()
Print a list of functionObject configuration files in.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
Definition: POSIX.C:555
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
static const dictionary null
Null dictionary.
Definition: dictionary.H:241
static const fileName null
An empty fileName.
Definition: fileName.H:97
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
Definition: entryIO.C:94
const T & operator[](const label) const
Return element const reference.
Definition: UPtrListI.H:96
bool empty() const
Return true if the UPtrList is empty (ie, size() is zero)
Definition: UPtrListI.H:36
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:114
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
void on()
Switch the function objects on.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Definition: HashTable.C:513
T * ptr()
Return object pointer for reuse.
Definition: autoPtrI.H:90
const dimensionedScalar & c
Speed of light in a vacuum.
Abstract base-class for Time/database functionObjects.
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:111
A keyword and a list of tokens is a &#39;dictionaryEntry&#39;.
Tuple of a word and dictionary, used to read in per-field options for function objects in the followi...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
bool start()
Called at the start of the time-loop.
dlLibraryTable libs
Table of loaded dynamic libraries.
bool compile() const
Compile the regular expression.
Definition: wordReI.H:161
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:888
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:1056
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
Definition: HashTable.C:371
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:103
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:934
Class to handle errors and exceptions in a simple, consistent stream-based manner.
Definition: error.H:66
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
Definition: HashTableI.H:80
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
Definition: HashTable.C:142
bool execute()
Called at each ++ or += of the time-loop.
static int disableFunctionEntries
Definition: entry.H:86
dynamicFvMesh & mesh
const fileName & name() const
Return the dictionary name.
Definition: dictionary.H:111
void throwExceptions()
Definition: error.H:122
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
static bool readFunctionObject(const string &funcCall, dictionary &functionsDict, const string &context, HashSet< word > &requiredFields, const word &region=word::null)
Read the specified functionObject configuration dictionary.
Functions to search &#39;etc&#39; directories for configuration files etc.
Extract command arguments and options from the supplied argc and argv parameters. ...
Definition: argList.H:102
void clear()
Clear all entries from table.
Definition: HashTable.C:468
void append(const T &)
Append an element at the end of the list.
Definition: ListI.H:178
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
static const word null
An empty word.
Definition: word.H:77
const fileOperation & fileHandler()
Get current file handler.
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.
Definition: POSIX.C:662
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
Definition: autoPtrI.H:83
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:29
A wordRe is a word, but can also have a regular expression for matching words.
Definition: wordRe.H:74
Report an I/O error.
Definition: error.H:196
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:131
virtual bool isDict() const
Return true if this entry is a dictionary.
Definition: entry.H:156
virtual bool read(const dictionary &)
Read and set the functionObject if its data have changed.
static const char nl
Definition: Ostream.H:260
objects
void set(T *)
Set pointer to that given.
Definition: autoPtrI.H:99
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
labelList f(nPoints)
virtual Ostream & write(const char)
Write character.
Definition: OSstream.C:32
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void clear()
Clear the list of function objects.
void setSize(const label)
Reset size of List.
Definition: List.C:281
bool setTimeStep()
Override the time-step value.
bool status() const
Return the execution status (on/off) of the function objects.
Generic input stream.
Definition: ISstream.H:51
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:331
Input from memory buffer stream.
Definition: IStringStream.H:49
List< Key > sortedToc() const
Return the table of contents as a sorted list.
Definition: HashTable.C:217
void transfer(PtrList< T > &)
Transfer the contents of the argument PtrList into this PtrList.
Definition: PtrList.C:189
static autoPtr< functionObject > New(const word &name, const Time &, const dictionary &)
Select from dictionary, based on its "type" entry.
string str() const
Return the string.
const dictionary & controlDict() const
Definition: Time.H:270
void set(entry *)
Assign a new entry, overwrite any existing entry.
Definition: dictionary.C:1194
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
Definition: PtrList.C:174
messageStream Info
bool merge(const dictionary &)
Merge entries from the given dictionary.
Definition: dictionary.C:1343
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
label findObjectID(const word &name) const
Find the ID of a given function object by name.
void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
static autoPtr< functionObjectList > New(const argList &args, const Time &runTime, dictionary &controlDict, HashSet< word > &requiredFields)
Construct and return a functionObjectList for an application.
const string & commandLine() const
Return the command line string.
Definition: argListI.H:30
friend class iterator
Declare friendship with the iterator.
Definition: HashTable.H:194
Foam::argList args(argc, argv)
void movePoints(const polyMesh &mesh)
Update for changes of mesh.
List< fileName > fileNameList
A List of fileNames.
Definition: fileNameList.H:50
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
static fileName functionObjectDictPath
Default relative path to the directory structure.
bool end()
Called when Time::run() determines that the time-loop exits.
Output to memory buffer stream.
Definition: OStringStream.H:49
bool match(const std::string &, bool literalMatch=false) const
Smart match as regular expression or as a string.
Definition: wordReI.H:202
Input token stream.
Definition: ITstream.H:49
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:65
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812
static fileName findDict(const word &funcName, const word &region=word::null)
Search for functionObject dictionary file for given region.
void dontThrowExceptions()
Definition: error.H:127
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())
IStringStream optionLookup(const word &opt) const
Return an IStringStream from the named option.
Definition: argListI.H:120
IOerror FatalIOError
#define InfoInFunction
Report an information message using Foam::Info.
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
Definition: etcFiles.C:32
T & first()
Return reference to the first element of the list.
Definition: UPtrListI.H:43