setFields.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2022-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  setFields
29 
30 Group
31  grpPreProcessingUtilities
32 
33 Description
34  Set values on a selected set of cells/patch-faces via a dictionary.
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #include "argList.H"
39 #include "Time.H"
40 #include "fvMesh.H"
41 #include "faMesh.H"
42 #include "topoSetSource.H"
43 #include "cellSet.H"
44 #include "faceSet.H"
45 #include "volFields.H"
46 #include "areaFields.H"
47 #include "coupledFvPatch.H"
48 #include "coupledFaPatch.H"
49 
50 using namespace Foam;
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 //- Simple tuple of field type and name (read from stream)
55 class fieldDescription
56 {
57  word type_;
58  word name_;
59 
60 public:
61 
62  const word& type() const noexcept { return type_; }
63  const word& name() const noexcept { return name_; }
64 
65  explicit fieldDescription(Istream& is)
66  {
67  is >> type_;
68  is >> name_;
69 
70  // Eg, read as "volScalarFieldValue", but change to "volScalarField"
71  if (type_.ends_with("Value"))
72  {
73  type_.erase(type_.size()-5);
74  }
75  }
76 };
77 
78 
79 // Consume unused field information
80 template<class Type>
81 bool consumeUnusedType(const fieldDescription& fieldDesc, Istream& is)
82 {
85  //? typedef GeometricField<Type, faePatchField, areaMesh> fieldType3;
86  //? typedef GeometricField<Type, fvsPatchField, volMesh> fieldType4;
87 
88  if
89  (
90  fieldDesc.type() == fieldType1::typeName
91  || fieldDesc.type() == fieldType2::typeName
92  )
93  {
94  (void) pTraits<Type>(is);
95  return true;
96  }
97 
98  return false;
99 }
100 
101 
102 // Consume unused field information
103 static bool consumeUnused(const fieldDescription& fieldDesc, Istream& is)
104 {
105  return
106  (
107  consumeUnusedType<scalar>(fieldDesc, is)
108  || consumeUnusedType<vector>(fieldDesc, is)
109  || consumeUnusedType<sphericalTensor>(fieldDesc, is)
110  || consumeUnusedType<symmTensor>(fieldDesc, is)
111  || consumeUnusedType<tensor>(fieldDesc, is)
112  );
113 }
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 // Setting volume fields
119 template<class Type>
120 bool setCellFieldType
121 (
122  const fieldDescription& fieldDesc,
123  const fvMesh& mesh,
124  const labelList& selectedCells,
125  Istream& is
126 )
127 {
129 
130  if (fieldDesc.type() != fieldType::typeName)
131  {
132  return false;
133  }
134 
135  // Get value from stream
136  const Type fieldValue = pTraits<Type>(is);
137 
138 
139  // Check the current time directory
140  IOobject fieldHeader
141  (
142  fieldDesc.name(),
143  mesh.thisDb().time().timeName(),
144  mesh.thisDb(),
146  );
147 
148  bool found = fieldHeader.typeHeaderOk<fieldType>(true);
149 
150  if (!found)
151  {
152  // Fallback to "constant" directory
153  fieldHeader = IOobject
154  (
155  fieldDesc.name(),
156  mesh.thisDb().time().constant(),
157  mesh.thisDb(),
159  );
160  found = fieldHeader.typeHeaderOk<fieldType>(true);
161  }
162 
163  // Field exists
164  if (found)
165  {
166  Info<< " - set internal values of "
167  << fieldHeader.headerClassName()
168  << ": " << fieldDesc.name()
169  << " = " << fieldValue << endl;
170 
171  fieldType field(fieldHeader, mesh, false);
172 
173  if (isNull(selectedCells) || selectedCells.size() == field.size())
174  {
175  field.primitiveFieldRef() = fieldValue;
176  }
177  else
178  {
179  for (const label celli : selectedCells)
180  {
181  field[celli] = fieldValue;
182  }
183  }
184 
185  // Make boundary fields consistent - treat like zeroGradient
186  for (auto& pfld : field.boundaryFieldRef())
187  {
188  pfld = pfld.patchInternalField();
189  }
190 
191  // Handle any e.g. halo-swaps
192  field.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
193 
194  if (!field.write())
195  {
197  << "Failed writing field " << field.name() << endl;
198  }
199  }
200  else
201  {
202  Warning
203  << "Field " << fieldDesc.name() << " not found" << endl;
204  }
205 
206  return true;
207 }
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 // Setting finite-area face fields
213 template<class Type>
214 bool setAreaFieldType
215 (
216  const fieldDescription& fieldDesc,
217  const faMesh& mesh,
218  const labelList& selectedFaces,
219  Istream& is
220 )
221 {
223 
224  if (fieldDesc.type() != fieldType::typeName)
225  {
226  return false;
227  }
228 
229  // Get value from stream
230  const Type fieldValue = pTraits<Type>(is);
231 
232 
233  // Check the current time directory
234  IOobject fieldHeader
235  (
236  fieldDesc.name(),
237  mesh.thisDb().time().timeName(),
238  mesh.thisDb(),
240  );
241 
242  bool found = fieldHeader.typeHeaderOk<fieldType>(true);
243 
244  if (!found)
245  {
246  // Fallback to "constant" directory
247  fieldHeader = IOobject
248  (
249  fieldDesc.name(),
250  mesh.thisDb().time().constant(),
251  mesh.thisDb(),
253  );
254  found = fieldHeader.typeHeaderOk<fieldType>(true);
255  }
256 
257  // Field exists
258  if (found)
259  {
260  Info<< " - set internal values of "
261  << fieldHeader.headerClassName()
262  << ": " << fieldDesc.name()
263  << " = " << fieldValue << endl;
264 
265  fieldType field(fieldHeader, mesh);
266 
267  if (isNull(selectedFaces) || selectedFaces.size() == field.size())
268  {
269  field.primitiveFieldRef() = fieldValue;
270  }
271  else
272  {
273  for (const label facei : selectedFaces)
274  {
275  field[facei] = fieldValue;
276  }
277  }
278 
279  // Handle any e.g. halo-swaps
280  field.boundaryFieldRef().template evaluateCoupled<coupledFaPatch>();
281 
282  if (!field.write())
283  {
285  << "Failed writing field " << field.name() << endl;
286  }
287  }
288  else
289  {
290  Warning
291  << "Field " << fieldDesc.name() << " not found" << endl;
292  }
293 
294  return true;
295 }
296 
297 
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299 
300 // Setting volume boundary fields
301 template<class Type>
302 bool setFaceFieldType
303 (
304  const fieldDescription& fieldDesc,
305  const fvMesh& mesh,
306  const labelList& selectedFaces,
307  Istream& is
308 )
309 {
311 
312  if (fieldDesc.type() != fieldType::typeName)
313  {
314  return false;
315  }
316 
317  // Get value from stream
318  const Type fieldValue = pTraits<Type>(is);
319 
320 
321  // Check the current time directory
322  IOobject fieldHeader
323  (
324  fieldDesc.name(),
325  mesh.thisDb().time().timeName(),
326  mesh.thisDb(),
328  );
329 
330  bool found = fieldHeader.typeHeaderOk<fieldType>(true);
331 
332  if (!found)
333  {
334  // Fallback to "constant" directory
335  fieldHeader = IOobject
336  (
337  fieldDesc.name(),
338  mesh.thisDb().time().constant(),
339  mesh.thisDb(),
341  );
342  found = fieldHeader.typeHeaderOk<fieldType>(true);
343  }
344 
345  // Field exists
346  if (found)
347  {
348  Info<< " - set boundary values of "
349  << fieldHeader.headerClassName()
350  << ": " << fieldDesc.name()
351  << " = " << fieldValue << endl;
352 
353  fieldType field(fieldHeader, mesh);
354 
355  // Create flat list of selected faces and their value.
356  Field<Type> allBoundaryValues(mesh.nBoundaryFaces());
357  forAll(field.boundaryField(), patchi)
358  {
360  (
361  allBoundaryValues,
362  field.boundaryField()[patchi].size(),
363  field.boundaryField()[patchi].patch().start()
364  - mesh.nInternalFaces()
365  ) = field.boundaryField()[patchi];
366  }
367 
368  // Override
369  unsigned hasWarned = 0;
370  labelList nChanged
371  (
372  returnReduce(field.boundaryField().size(), maxOp<label>()),
373  Zero
374  );
375 
376  for (const label facei : selectedFaces)
377  {
378  const label bFacei = facei-mesh.nInternalFaces();
379 
380  if (bFacei < 0)
381  {
382  if (!(hasWarned & 1))
383  {
384  hasWarned |= 1;
386  << "Ignoring internal face " << facei
387  << ". Suppressing further warnings." << endl;
388  }
389  }
390  else if (bFacei >= mesh.nBoundaryFaces())
391  {
392  if (!(hasWarned & 2))
393  {
394  hasWarned |= 2;
396  << "Ignoring out-of-range face " << facei
397  << ". Suppressing further warnings." << endl;
398  }
399  }
400  else
401  {
402  const label patchi = mesh.boundaryMesh().patchID()[bFacei];
403 
404  allBoundaryValues[bFacei] = fieldValue;
405  ++nChanged[patchi];
406  }
407  }
408 
410 
411  auto& fieldBf = field.boundaryFieldRef();
412 
413  // Reassign.
414  forAll(field.boundaryField(), patchi)
415  {
416  if (nChanged[patchi] > 0)
417  {
418  Info<< " On patch "
419  << field.boundaryField()[patchi].patch().name()
420  << " set " << nChanged[patchi] << " values" << endl;
421 
422  fieldBf[patchi] == SubField<Type>
423  (
424  allBoundaryValues,
425  fieldBf[patchi].size(),
426  fieldBf[patchi].patch().start()
427  - mesh.nInternalFaces()
428  );
429  }
430  }
431 
432  // Handle any e.g. halo-swaps
433  field.boundaryFieldRef().template evaluateCoupled<coupledFvPatch>();
434 
435  if (!field.write())
436  {
438  << "Failed writing field " << field.name() << endl;
439  }
440  }
441  else
442  {
443  Warning
444  << "Field " << fieldDesc.name() << " not found" << endl;
445  }
446 
447  return true;
448 }
449 
450 
451 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
452 
453 // Dispatcher for setting volume fields
454 struct setCellField
455 {
456  autoPtr<setCellField> clone() const { return nullptr; } // placeholder
457 
458  static bool apply
459  (
460  const fieldDescription& fieldDesc,
461  const fvMesh& m,
462  const labelList& selectedCells,
463  Istream& is
464  )
465  {
466  return
467  (
468  setCellFieldType<scalar>(fieldDesc, m, selectedCells, is)
469  || setCellFieldType<vector>(fieldDesc, m, selectedCells, is)
470  || setCellFieldType<sphericalTensor>(fieldDesc, m, selectedCells, is)
471  || setCellFieldType<symmTensor>(fieldDesc, m, selectedCells, is)
472  || setCellFieldType<tensor>(fieldDesc, m, selectedCells, is)
473  );
474  }
475 
476  class iNew
477  {
478  const fvMesh& mesh_;
479  const labelList& selected_;
480 
481  public:
482 
483  iNew(const fvMesh& mesh, const labelList& selectedCells)
484  :
485  mesh_(mesh),
486  selected_(selectedCells)
487  {}
488 
489  autoPtr<setCellField> operator()(Istream& is) const
490  {
491  const fieldDescription fieldDesc(is);
492 
493  bool ok = setCellField::apply(fieldDesc, mesh_, selected_, is);
494 
495  if (!ok)
496  {
497  ok = consumeUnused(fieldDesc, is);
498 
499  if (ok)
500  {
501  // Not meant for us
502  Info<< "Skip " << fieldDesc.type()
503  << " for finite-volume" << nl;
504  }
505  else
506  {
508  << "Unsupported field type: "
509  << fieldDesc.type() << endl;
510  }
511  }
512 
513  return nullptr; // Irrelevant return value
514  }
515  };
516 };
517 
518 
519 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
520 
521 // Dispatcher for setting volume boundary fields
522 struct setFaceField
523 {
524  autoPtr<setFaceField> clone() const { return nullptr; } // placeholder
525 
526  static bool apply
527  (
528  const fieldDescription& fieldDesc,
529  const fvMesh& m,
530  const labelList& selectedFaces,
531  Istream& is
532  )
533  {
534  return
535  (
536  setFaceFieldType<scalar>(fieldDesc, m, selectedFaces, is)
537  || setFaceFieldType<vector>(fieldDesc, m, selectedFaces, is)
538  || setFaceFieldType<sphericalTensor>(fieldDesc, m, selectedFaces, is)
539  || setFaceFieldType<symmTensor>(fieldDesc, m, selectedFaces, is)
540  || setFaceFieldType<tensor>(fieldDesc, m, selectedFaces, is)
541  );
542  }
543 
544  class iNew
545  {
546  const fvMesh& mesh_;
547  const labelList& selected_;
548 
549  public:
550 
551  iNew(const fvMesh& mesh, const labelList& selectedFaces)
552  :
553  mesh_(mesh),
554  selected_(selectedFaces)
555  {}
556 
557  autoPtr<setFaceField> operator()(Istream& is) const
558  {
559  const fieldDescription fieldDesc(is);
560 
561  bool ok = setFaceField::apply(fieldDesc, mesh_, selected_, is);
562 
563  if (!ok)
564  {
565  ok = consumeUnused(fieldDesc, is);
566 
567  if (ok)
568  {
569  // Not meant for us
570  Info<< "Skip " << fieldDesc.type()
571  << " for finite-volume" << nl;
572  }
573  else
574  {
576  << "Unsupported field type: "
577  << fieldDesc.type() << endl;
578  }
579  }
580 
581  return nullptr; // Irrelevant return value
582  }
583  };
584 };
585 
586 
587 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
588 
589 // Dispatcher for setting area face fields
590 struct setAreaField
591 {
592  autoPtr<setAreaField> clone() const { return nullptr; } // placeholder
593 
594  static bool apply
595  (
596  const fieldDescription& fieldDesc,
597  const faMesh& m,
598  const labelList& selectedFaces,
599  Istream& is
600  )
601  {
602  return
603  (
604  setAreaFieldType<scalar>(fieldDesc, m, selectedFaces, is)
605  || setAreaFieldType<vector>(fieldDesc, m, selectedFaces, is)
606  || setAreaFieldType<sphericalTensor>(fieldDesc, m, selectedFaces, is)
607  || setAreaFieldType<symmTensor>(fieldDesc, m, selectedFaces, is)
608  || setAreaFieldType<tensor>(fieldDesc, m, selectedFaces, is)
609  );
610  }
611 
612  class iNew
613  {
614  const faMesh& mesh_;
615  const labelList& selected_;
616 
617  public:
618 
619  iNew(const faMesh& mesh, const labelList& selectedFaces)
620  :
621  mesh_(mesh),
622  selected_(selectedFaces)
623  {}
624 
625  autoPtr<setAreaField> operator()(Istream& is) const
626  {
627  const fieldDescription fieldDesc(is);
628 
629  bool ok = setAreaField::apply(fieldDesc, mesh_, selected_, is);
630 
631  if (!ok)
632  {
633  ok = consumeUnused(fieldDesc, is);
634 
635  if (ok)
636  {
637  // Not meant for us
638  Info<< "Skip " << fieldDesc.type()
639  << " for finite-volume" << nl;
640  }
641  else
642  {
644  << "Unsupported field type: "
645  << fieldDesc.type() << endl;
646  }
647  }
648 
649  return nullptr; // Irrelevant return value
650  }
651  };
652 };
653 
654 
655 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
656 
657 int main(int argc, char *argv[])
658 {
660  (
661  "Set values on a selected set of cells/patch-faces via a dictionary"
662  );
663 
664  argList::addOption("dict", "file", "Alternative setFieldsDict");
665 
667  (
668  "no-finite-area",
669  "Suppress handling of finite-area mesh/fields"
670  );
671 
672  #include "addRegionOption.H"
673  #include "setRootCase.H"
674  #include "createTime.H"
675  #include "createNamedMesh.H"
676 
677  autoPtr<faMesh> faMeshPtr;
678 
679  if (!args.found("no-finite-area"))
680  {
681  faMeshPtr = faMesh::TryNew(mesh);
682  }
683  if (faMeshPtr)
684  {
685  Info<< "Detected finite-area mesh" << nl;
686  }
687 
688  const word dictName("setFieldsDict");
689  #include "setSystemMeshDictionaryIO.H"
690 
691  Info<< "Reading " << dictIO.name() << nl << endl;
692 
693  IOdictionary setFieldsDict(dictIO);
694 
695 
696  // Note.
697  // The PtrList + iNew mechanism is used to trigger the callbacks
698  // and perform the desired actions. The contents of the PtrList
699  // itself are actually irrelevant.
700 
701 
702  // Default field values
703  {
704  const entry* eptr =
705  setFieldsDict.findEntry("defaultFieldValues", keyType::LITERAL);
706 
707  if (eptr)
708  {
709  ITstream& is = eptr->stream();
710 
711  Info<< "Setting volume field default values" << endl;
712 
713  PtrList<setCellField> defaultFieldValues
714  (
715  is,
716  setCellField::iNew(mesh, labelList::null())
717  );
718 
719  if (faMeshPtr)
720  {
721  const faMesh& areaMesh = faMeshPtr();
722  is.rewind();
723 
724  Info<< "Setting area field default values" << endl;
725 
726  PtrList<setAreaField> defaultFieldValues
727  (
728  is,
729  setAreaField::iNew(areaMesh, labelList::null())
730  );
731  }
732  Info<< endl;
733  }
734  }
735 
736 
737  Info<< "Setting field region values" << nl << endl;
738 
739  PtrList<entry> regions(setFieldsDict.lookup("regions"));
740 
741  for (const entry& region : regions)
742  {
743  autoPtr<topoSetSource> source =
744  topoSetSource::New(region.keyword(), mesh, region.dict());
745 
746  if (source().setType() == topoSetSource::CELLSET_SOURCE)
747  {
749  (
750  mesh,
751  "cellSet",
752  mesh.nCells()/10+1 // Reasonable size estimate.
753  );
754 
756 
757  labelList selectedCells(subset.sortedToc());
758 
759  Info<< " Selected "
760  << returnReduce(selectedCells.size(), sumOp<label>())
761  << '/'
763  << " cells" << nl;
764 
765  ITstream& is = region.dict().lookup("fieldValues");
766 
767  PtrList<setCellField> fieldValues
768  (
769  is,
770  setCellField::iNew(mesh, selectedCells)
771  );
772  }
773  else if (source().setType() == topoSetSource::FACESET_SOURCE)
774  {
776  (
777  mesh,
778  "faceSet",
779  mesh.nBoundaryFaces()/10+1
780  );
781 
783 
784  labelList selectedFaces(subset.sortedToc());
785 
786  Info<< " Selected " << selectedFaces.size()
787  << " faces" << nl;
788 
789  ITstream& is = region.dict().lookup("fieldValues");
790 
791  PtrList<setFaceField> fieldValues
792  (
793  is,
794  setFaceField::iNew(mesh, selectedFaces)
795  );
796 
797  if (faMeshPtr)
798  {
799  const faMesh& areaMesh = faMeshPtr();
800 
801  const labelUList& faceLabels = areaMesh.faceLabels();
802 
803  // Transcribe from mesh faces to finite-area addressing
804  labelList areaFaces(faceLabels.size());
805 
806  label nUsed = 0;
807  forAll(faceLabels, facei)
808  {
809  const label meshFacei = faceLabels[facei];
810 
811  if (subset.test(meshFacei))
812  {
813  areaFaces[nUsed] = facei;
814  ++nUsed;
815  }
816  }
817  areaFaces.resize(nUsed);
818 
819  Info<< " Selected "
820  << returnReduce(areaFaces.size(), sumOp<label>())
821  << '/'
823  << " area faces" << nl;
824 
825  is.rewind();
826 
827  PtrList<setAreaField> fieldValues
828  (
829  is,
830  setAreaField::iNew(areaMesh, areaFaces)
831  );
832  }
833  }
834  }
835 
836 
837  Info<< "\nEnd\n" << endl;
838 
839  return 0;
840 }
841 
842 
843 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:88
static void addNote(const string &note)
Add extra notes for the usage information.
Definition: argList.C:462
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
rDeltaTY field()
A list of face labels.
Definition: faceSet.H:47
void resize(const label len)
Adjust allocated size of list.
Definition: ListI.H:132
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:162
Create a new set and ADD elements to it.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:49
const word dictName("faMeshDefinition")
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
const labelList & patchID() const
Per boundary face label the patch index.
Required Variables.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition: argList.C:374
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
static const List< label > & null()
Return a null List.
Definition: ListI.H:102
SubField is a Field obtained as a section of another Field, without its own allocation. SubField is derived from a SubList rather than a List.
Definition: Field.H:63
labelList faceLabels(nFaceLabels)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Definition: fvMesh.H:378
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:414
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
Generic templated field type.
Definition: Field.H:62
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Definition: polyMesh.H:584
A class for handling words, derived from Foam::string.
Definition: word.H:63
const Time & time() const noexcept
Return time registry.
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition: argList.C:385
label nInternalFaces() const noexcept
Number of internal faces.
String literal.
Definition: keyType.H:82
virtual void rewind()
Rewind the stream so that it may be read again.
Definition: ITstream.C:530
const direction noexcept
Definition: Scalar.H:258
bool isNull(const T *ptr)
True if ptr is a pointer (of type T) to the nullObject.
Definition: nullObject.H:227
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
Definition: Time.C:770
const word & constant() const noexcept
Return constant name.
Definition: TimePathsI.H:89
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected topoSetSource.
messageStream Warning
Warning stream (stdout output on master, null elsewhere), with additional &#39;FOAM Warning&#39; header text...
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &set) const =0
Apply specified action to the topoSet.
#define WarningInFunction
Report a warning using Foam::Warning.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
A collection of cell labels.
Definition: cellSet.H:47
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
static autoPtr< faMesh > TryNew(const polyMesh &pMesh)
Read construction from polyMesh if all files are available.
Definition: faMeshNew.C:149
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:47
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOobject dictIO
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:171
bool found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:171
An input stream of tokens.
Definition: ITstream.H:48
Namespace for OpenFOAM.
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:133