fvMeshTools.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) 2012-2016 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 "fvMeshTools.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 // Adds patch if not yet there. Returns patchID.
37 (
38  fvMesh& mesh,
39  const polyPatch& patch,
40  const dictionary& patchFieldDict,
41  const word& defaultPatchFieldType,
42  const bool validBoundary
43 )
44 {
45  polyBoundaryMesh& polyPatches =
46  const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
47 
48  label patchi = polyPatches.findPatchID(patch.name());
49  if (patchi != -1)
50  {
51  // Already there
52  return patchi;
53  }
54 
55 
56  // Append at end unless there are processor patches
57  label insertPatchi = polyPatches.size();
58  label startFacei = mesh.nFaces();
59 
60  if (!isA<processorPolyPatch>(patch))
61  {
62  forAll(polyPatches, patchi)
63  {
64  const polyPatch& pp = polyPatches[patchi];
65 
66  if (isA<processorPolyPatch>(pp))
67  {
68  insertPatchi = patchi;
69  startFacei = pp.start();
70  break;
71  }
72  }
73  }
74 
75 
76  // Below is all quite a hack. Feel free to change once there is a better
77  // mechanism to insert and reorder patches.
78 
79  // Clear local fields and e.g. polyMesh parallelInfo.
80  mesh.clearOut();
81 
82  label sz = polyPatches.size();
83 
84  fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
85 
86  // Add polyPatch at the end
87  polyPatches.setSize(sz+1);
88  polyPatches.set
89  (
90  sz,
91  patch.clone
92  (
93  polyPatches,
94  insertPatchi, //index
95  0, //size
96  startFacei //start
97  )
98  );
99  fvPatches.setSize(sz+1);
100  fvPatches.set
101  (
102  sz,
104  (
105  polyPatches[sz], // point to newly added polyPatch
106  mesh.boundary()
107  )
108  );
109 
110  addPatchFields<volScalarField>
111  (
112  mesh,
113  patchFieldDict,
114  defaultPatchFieldType,
115  Zero
116  );
117  addPatchFields<volVectorField>
118  (
119  mesh,
120  patchFieldDict,
121  defaultPatchFieldType,
122  Zero
123  );
124  addPatchFields<volSphericalTensorField>
125  (
126  mesh,
127  patchFieldDict,
128  defaultPatchFieldType,
129  Zero
130  );
131  addPatchFields<volSymmTensorField>
132  (
133  mesh,
134  patchFieldDict,
135  defaultPatchFieldType,
136  Zero
137  );
138  addPatchFields<volTensorField>
139  (
140  mesh,
141  patchFieldDict,
142  defaultPatchFieldType,
143  Zero
144  );
145 
146  // Surface fields
147 
148  addPatchFields<surfaceScalarField>
149  (
150  mesh,
151  patchFieldDict,
152  defaultPatchFieldType,
153  Zero
154  );
155  addPatchFields<surfaceVectorField>
156  (
157  mesh,
158  patchFieldDict,
159  defaultPatchFieldType,
160  Zero
161  );
162  addPatchFields<surfaceSphericalTensorField>
163  (
164  mesh,
165  patchFieldDict,
166  defaultPatchFieldType,
167  Zero
168  );
169  addPatchFields<surfaceSymmTensorField>
170  (
171  mesh,
172  patchFieldDict,
173  defaultPatchFieldType,
174  Zero
175  );
176  addPatchFields<surfaceTensorField>
177  (
178  mesh,
179  patchFieldDict,
180  defaultPatchFieldType,
181  Zero
182  );
183 
184  // Create reordering list
185  // patches before insert position stay as is
186  labelList oldToNew(sz+1);
187  for (label i = 0; i < insertPatchi; i++)
188  {
189  oldToNew[i] = i;
190  }
191  // patches after insert position move one up
192  for (label i = insertPatchi; i < sz; i++)
193  {
194  oldToNew[i] = i+1;
195  }
196  // appended patch gets moved to insert position
197  oldToNew[sz] = insertPatchi;
198 
199  // Shuffle into place
200  polyPatches.reorder(oldToNew, validBoundary);
201  fvPatches.reorder(oldToNew);
202 
203  reorderPatchFields<volScalarField>(mesh, oldToNew);
204  reorderPatchFields<volVectorField>(mesh, oldToNew);
205  reorderPatchFields<volSphericalTensorField>(mesh, oldToNew);
206  reorderPatchFields<volSymmTensorField>(mesh, oldToNew);
207  reorderPatchFields<volTensorField>(mesh, oldToNew);
208  reorderPatchFields<surfaceScalarField>(mesh, oldToNew);
209  reorderPatchFields<surfaceVectorField>(mesh, oldToNew);
210  reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew);
211  reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew);
212  reorderPatchFields<surfaceTensorField>(mesh, oldToNew);
213 
214  return insertPatchi;
215 }
216 
217 
218 void Foam::fvMeshTools::setPatchFields
219 (
220  fvMesh& mesh,
221  const label patchi,
222  const dictionary& patchFieldDict
223 )
224 {
225  setPatchFields<volScalarField>(mesh, patchi, patchFieldDict);
226  setPatchFields<volVectorField>(mesh, patchi, patchFieldDict);
227  setPatchFields<volSphericalTensorField>(mesh, patchi, patchFieldDict);
228  setPatchFields<volSymmTensorField>(mesh, patchi, patchFieldDict);
229  setPatchFields<volTensorField>(mesh, patchi, patchFieldDict);
230  setPatchFields<surfaceScalarField>(mesh, patchi, patchFieldDict);
231  setPatchFields<surfaceVectorField>(mesh, patchi, patchFieldDict);
232  setPatchFields<surfaceSphericalTensorField>
233  (
234  mesh,
235  patchi,
236  patchFieldDict
237  );
238  setPatchFields<surfaceSymmTensorField>(mesh, patchi, patchFieldDict);
239  setPatchFields<surfaceTensorField>(mesh, patchi, patchFieldDict);
240 }
241 
242 
244 {
245  setPatchFields<volScalarField>(mesh, patchi, Zero);
246  setPatchFields<volVectorField>(mesh, patchi, Zero);
247  setPatchFields<volSphericalTensorField>
248  (
249  mesh,
250  patchi,
251  Zero
252  );
253  setPatchFields<volSymmTensorField>
254  (
255  mesh,
256  patchi,
257  Zero
258  );
259  setPatchFields<volTensorField>(mesh, patchi, Zero);
260  setPatchFields<surfaceScalarField>(mesh, patchi, Zero);
261  setPatchFields<surfaceVectorField>(mesh, patchi, Zero);
262  setPatchFields<surfaceSphericalTensorField>
263  (
264  mesh,
265  patchi,
266  Zero
267  );
268  setPatchFields<surfaceSymmTensorField>
269  (
270  mesh,
271  patchi,
272  Zero
273  );
274  setPatchFields<surfaceTensorField>(mesh, patchi, Zero);
275 }
276 
277 
278 // Deletes last patch
279 void Foam::fvMeshTools::trimPatches(fvMesh& mesh, const label nPatches)
280 {
281  // Clear local fields and e.g. polyMesh globalMeshData.
282  mesh.clearOut();
283 
284  polyBoundaryMesh& polyPatches =
285  const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
286  fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
287 
288  if (polyPatches.empty())
289  {
291  << "No patches in mesh"
292  << abort(FatalError);
293  }
294 
295  label nFaces = 0;
296  for (label patchi = nPatches; patchi < polyPatches.size(); patchi++)
297  {
298  nFaces += polyPatches[patchi].size();
299  }
300  reduce(nFaces, sumOp<label>());
301 
302  if (nFaces)
303  {
305  << "There are still " << nFaces
306  << " faces in " << polyPatches.size()-nPatches
307  << " patches to be deleted" << abort(FatalError);
308  }
309 
310  // Remove actual patches
311  polyPatches.setSize(nPatches);
312  fvPatches.setSize(nPatches);
313 
314  trimPatchFields<volScalarField>(mesh, nPatches);
315  trimPatchFields<volVectorField>(mesh, nPatches);
316  trimPatchFields<volSphericalTensorField>(mesh, nPatches);
317  trimPatchFields<volSymmTensorField>(mesh, nPatches);
318  trimPatchFields<volTensorField>(mesh, nPatches);
319 
320  trimPatchFields<surfaceScalarField>(mesh, nPatches);
321  trimPatchFields<surfaceVectorField>(mesh, nPatches);
322  trimPatchFields<surfaceSphericalTensorField>(mesh, nPatches);
323  trimPatchFields<surfaceSymmTensorField>(mesh, nPatches);
324  trimPatchFields<surfaceTensorField>(mesh, nPatches);
325 }
326 
327 
329 (
330  fvMesh& mesh,
331  const labelList& oldToNew,
332  const label nNewPatches,
333  const bool validBoundary
334 )
335 {
336  polyBoundaryMesh& polyPatches =
337  const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
338  fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary());
339 
340  // Shuffle into place
341  polyPatches.reorder(oldToNew, validBoundary);
342  fvPatches.reorder(oldToNew);
343 
344  reorderPatchFields<volScalarField>(mesh, oldToNew);
345  reorderPatchFields<volVectorField>(mesh, oldToNew);
346  reorderPatchFields<volSphericalTensorField>(mesh, oldToNew);
347  reorderPatchFields<volSymmTensorField>(mesh, oldToNew);
348  reorderPatchFields<volTensorField>(mesh, oldToNew);
349  reorderPatchFields<surfaceScalarField>(mesh, oldToNew);
350  reorderPatchFields<surfaceVectorField>(mesh, oldToNew);
351  reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew);
352  reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew);
353  reorderPatchFields<surfaceTensorField>(mesh, oldToNew);
354 
355  // Remove last.
356  trimPatches(mesh, nNewPatches);
357 }
358 
359 
361 (
362  fvMesh& mesh,
363  const bool validBoundary
364 )
365 {
366  const polyBoundaryMesh& pbm = mesh.boundaryMesh();
367 
368  labelList newToOld(pbm.size());
369  labelList oldToNew(pbm.size(), -1);
370  label newI = 0;
371 
372 
373  // Assumes all non-coupled boundaries are on all processors!
374  forAll(pbm, patchI)
375  {
376  const polyPatch& pp = pbm[patchI];
377 
378  if (!isA<processorPolyPatch>(pp))
379  {
380  label nFaces = pp.size();
381  if (validBoundary)
382  {
383  reduce(nFaces, sumOp<label>());
384  }
385 
386  if (nFaces > 0)
387  {
388  newToOld[newI] = patchI;
389  oldToNew[patchI] = newI++;
390  }
391  }
392  }
393 
394  // Same for processor patches (but need no reduction)
395  forAll(pbm, patchI)
396  {
397  const polyPatch& pp = pbm[patchI];
398 
399  if (isA<processorPolyPatch>(pp) && pp.size())
400  {
401  newToOld[newI] = patchI;
402  oldToNew[patchI] = newI++;
403  }
404  }
405 
406  newToOld.setSize(newI);
407 
408  // Move all deletable patches to the end
409  forAll(oldToNew, patchI)
410  {
411  if (oldToNew[patchI] == -1)
412  {
413  oldToNew[patchI] = newI++;
414  }
415  }
416 
417  reorderPatches(mesh, oldToNew, newToOld.size(), validBoundary);
418 
419  return newToOld;
420 }
421 
422 
424 (
425  const IOobject& io,
426  const bool masterOnlyReading
427 )
428 {
429  // Region name
430  // ~~~~~~~~~~~
431 
432  fileName meshSubDir;
433 
434  if (io.name() == polyMesh::defaultRegion)
435  {
436  meshSubDir = polyMesh::meshSubDir;
437  }
438  else
439  {
440  meshSubDir = io.name()/polyMesh::meshSubDir;
441  }
442 
443 
444  fileName facesInstance;
445  fileName pointsInstance;
446 
447  // Patch types
448  // ~~~~~~~~~~~
449  // Read and scatter master patches (without reading master mesh!)
450 
451  PtrList<entry> patchEntries;
452  if (Pstream::master())
453  {
454  const bool oldParRun = Pstream::parRun(false);
455  facesInstance = io.time().findInstance
456  (
457  meshSubDir,
458  "faces",
460  );
461  pointsInstance = io.time().findInstance
462  (
463  meshSubDir,
464  "points",
466  );
467  patchEntries = polyBoundaryMeshEntries
468  (
469  IOobject
470  (
471  "boundary",
472  facesInstance,
473  meshSubDir,
474  io.db(),
477  false
478  )
479  );
480  Pstream::parRun(oldParRun);
481 
482  // Send patches
483  for (const int slave : Pstream::subProcs())
484  {
486  toSlave << patchEntries;
487  }
488  }
489  else
490  {
491  // Receive patches
492  IPstream fromMaster
493  (
496  );
497  fromMaster >> patchEntries;
498  }
499 
500  Pstream::scatter(facesInstance);
501  Pstream::scatter(pointsInstance);
502 
503 
504  // Dummy meshes
505  // ~~~~~~~~~~~~
506 
507  // Check who has a mesh
508  const fileName meshDir = io.time().path()/facesInstance/meshSubDir;
509  bool haveMesh = isDir(meshDir);
510  if (masterOnlyReading && !Pstream::master())
511  {
512  haveMesh = false;
513  }
514 
515 
516  // Set up to read-if-present. Note: does not search for mesh so set
517  // instance explicitly
518  IOobject meshIO(io);
519  meshIO.instance() = facesInstance;
520  if (masterOnlyReading && !Pstream::master())
521  {
522  meshIO.readOpt(IOobject::NO_READ);
523  }
524  else
525  {
527  }
528 
529 
530  // Read mesh
531  // ~~~~~~~~~
532  // Now all processors use supplied points,faces etc
533  // Note: fvSolution, fvSchemes are also using the supplied IOobject so
534  // on slave will be NO_READ, on master READ_IF_PRESENT. This will
535  // conflict with e.g. timeStampMaster reading so switch off.
536  // Note: v2006 used the READ_IF_PRESENT flag in the meshIO.readOpt(). v2012
537  // (correctly) does no longer so below code explicitly addFvPatches
538  // using the separately read boundary file.
539 
540  const IOobject::fileCheckTypes oldCheckType =
543 
544 
545  //- Points
547  (
548  IOobject
549  (
550  "points",
551  pointsInstance, //meshIO.instance(),
552  meshSubDir,
553  meshIO.db(),
554  (haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
556  false
557  )
558  );
559 
560  //- Faces
561  faceCompactIOList faces
562  (
563  IOobject
564  (
565  "faces",
566  meshIO.instance(),
567  meshSubDir,
568  meshIO.db(),
569  (haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
571  false
572  )
573  );
574 
575  //- Face owner
576  labelIOList owner
577  (
578  IOobject
579  (
580  "owner",
581  meshIO.instance(),
582  meshSubDir,
583  meshIO.db(),
584  (haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
586  false
587  )
588  );
589 
590  //- Face neighbour
591  labelIOList neighbour
592  (
593  IOobject
594  (
595  "neighbour",
596  meshIO.instance(),
597  meshSubDir,
598  meshIO.db(),
599  (haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
601  false
602  )
603  );
604 
606  (
607  meshIO,
608  std::move(points),
609  std::move(faces),
610  std::move(owner),
611  std::move(neighbour)
612  );
613  fvMesh& mesh = *meshPtr;
614 
615  IOobject::fileModificationChecking = oldCheckType;
616 
617 
618 
619  // Add patches
620  // ~~~~~~~~~~~
621 
622 
623  bool havePatches = mesh.boundary().size();
624  reduce(havePatches, andOp<bool>());
625 
626  if (!havePatches)
627  {
628  // There are one or more processors without full complement of
629  // patches
630 
631  DynamicList<polyPatch*> newPatches;
632 
633  if (mesh.boundary().size() == patchEntries.size())
634  {
635  // Assumably we have correctly read the boundary and can clone.
636  // Note: for
637  // v2012 onwards this is probably never the case and this whole
638  // section can be removed.
639  forAll(mesh.boundary(), patchI)
640  {
641  newPatches.append
642  (
643  mesh.boundaryMesh()[patchI].clone(mesh.boundaryMesh()).ptr()
644  );
645  }
646  }
647  else
648  {
649  // Use patchEntries (read on master & scattered to slaves). This
650  // is probably always happening since boundary file is not read with
651  // READ_IF_PRESENT on recent versions.
652 
653  forAll(patchEntries, patchI)
654  {
655  const entry& e = patchEntries[patchI];
656  const word type(e.dict().get<word>("type"));
657 
658  if
659  (
660  type == processorPolyPatch::typeName
661  || type == processorCyclicPolyPatch::typeName
662  )
663  {}
664  else
665  {
666  dictionary patchDict(e.dict());
667 
668  if (mesh.nInternalFaces() == 0)
669  {
670  patchDict.set("nFaces", 0);
671  patchDict.set("startFace", 0);
672  }
673 
674  newPatches.append
675  (
677  (
678  patchEntries[patchI].keyword(),
679  patchDict,
680  newPatches.size(),
682  ).ptr()
683  );
684  }
685  }
686  }
688  mesh.addFvPatches(newPatches);
689  }
690 
691  //Pout<< "patches:" << endl;
692  //forAll(mesh.boundary(), patchI)
693  //{
694  // Pout<< " type" << mesh.boundary()[patchI].type()
695  // << " size:" << mesh.boundary()[patchI].size()
696  // << " start:" << mesh.boundary()[patchI].start() << endl;
697  //}
698  //Pout<< endl;
699 
700 
701  // Determine zones
702  // ~~~~~~~~~~~~~~~
703 
704  wordList pointZoneNames(mesh.pointZones().names());
705  Pstream::scatter(pointZoneNames);
706  wordList faceZoneNames(mesh.faceZones().names());
707  Pstream::scatter(faceZoneNames);
708  wordList cellZoneNames(mesh.cellZones().names());
709  Pstream::scatter(cellZoneNames);
710 
711  if (!haveMesh)
712  {
713  // Add the zones. Make sure to remove the old dummy ones first
714  mesh.pointZones().clear();
715  mesh.faceZones().clear();
716  mesh.cellZones().clear();
717 
718  List<pointZone*> pz(pointZoneNames.size());
719  forAll(pointZoneNames, i)
720  {
721  pz[i] = new pointZone
722  (
723  pointZoneNames[i],
724  i,
725  mesh.pointZones()
726  );
727  }
728  List<faceZone*> fz(faceZoneNames.size());
729  forAll(faceZoneNames, i)
730  {
731  fz[i] = new faceZone
732  (
733  faceZoneNames[i],
734  i,
735  mesh.faceZones()
736  );
737  }
738  List<cellZone*> cz(cellZoneNames.size());
739  forAll(cellZoneNames, i)
740  {
741  cz[i] = new cellZone
742  (
743  cellZoneNames[i],
744  i,
745  mesh.cellZones()
746  );
747  }
748 
749  if (pz.size() || fz.size() || cz.size())
750  {
751  mesh.addZones(pz, fz, cz);
752  }
753  }
754 
755  return meshPtr;
756 }
757 
758 
760 (
761  const objectRegistry& mesh,
762  const word& regionName,
763  const bool verbose
764 )
765 {
766  // Create dummy system/fv*
767  {
768  IOobject io
769  (
770  "fvSchemes",
771  mesh.time().system(),
772  regionName,
773  mesh,
776  false
777  );
778 
779  if (!io.typeHeaderOk<IOdictionary>(false))
780  {
781  if (verbose)
782  {
783  Info<< "Writing dummy " << regionName/io.name() << endl;
784  }
785  dictionary dummyDict;
786  dictionary divDict;
787  dummyDict.add("divSchemes", divDict);
788  dictionary gradDict;
789  dummyDict.add("gradSchemes", gradDict);
790  dictionary laplDict;
791  dummyDict.add("laplacianSchemes", laplDict);
792 
793  IOdictionary(io, dummyDict).regIOobject::write();
794  }
795  }
796  {
797  IOobject io
798  (
799  "fvSolution",
800  mesh.time().system(),
801  regionName,
802  mesh,
805  false
806  );
807 
808  if (!io.typeHeaderOk<IOdictionary>(false))
809  {
810  if (verbose)
811  {
812  Info<< "Writing dummy " << regionName/io.name() << endl;
813  }
814  dictionary dummyDict;
815  IOdictionary(io, dummyDict).regIOobject::write();
816  }
817  }
818 }
819 
820 
821 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::ZoneMesh::clear
void clear()
Clear the zones.
Definition: ZoneMesh.C:724
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
meshPtr
Foam::autoPtr< Foam::fvMesh > meshPtr(nullptr)
Foam::IOobject::fileCheckTypes
fileCheckTypes
Enumeration defining the file checking options.
Definition: IOobject.H:199
Foam::UPstream::masterNo
static constexpr int masterNo() noexcept
Process index of the master (always 0)
Definition: UPstream.H:451
Foam::fvMeshTools::zeroPatchFields
static void zeroPatchFields(fvMesh &mesh, const label patchi)
Change patchField to zero on registered fields.
Definition: fvMeshTools.C:243
Foam::IOobject::timeStamp
Definition: IOobject.H:201
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::IOField
A primitive field of type <T> with automated input and output.
Definition: foamVtkLagrangianWriter.H:61
Foam::polyBoundaryMeshEntries
Read and store dictionary entries for boundary patches.
Definition: polyBoundaryMeshEntries.H:53
Foam::fvMeshTools::createDummyFvMeshFiles
static void createDummyFvMeshFiles(const objectRegistry &parent, const word &regionName, const bool verbose=false)
Create additional fv* files.
Definition: fvMeshTools.C:760
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:318
Foam::IOobject::instance
const fileName & instance() const noexcept
Definition: IOobjectI.H:196
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::OPstream
Output inter-processor communications stream.
Definition: OPstream.H:53
Foam::IOobject::typeHeaderOk
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
Definition: IOobjectTemplates.C:39
Foam::pointZone
A subset of mesh points.
Definition: pointZone.H:65
Foam::fvMeshTools::removeEmptyPatches
static labelList removeEmptyPatches(fvMesh &, const bool validBoundary)
Remove zero sized patches. All but processor patches are.
Definition: fvMeshTools.C:361
Foam::polyMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:321
Foam::polyBoundaryMesh::reorder
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
Definition: polyBoundaryMesh.C:1214
Foam::IOobject::fileModificationChecking
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:303
Foam::UPstream::master
static bool master(const label communicator=worldComm)
Am I the master process.
Definition: UPstream.H:457
Foam::Pstream::scatter
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Definition: gatherScatter.C:150
Foam::fvMesh::removeFvBoundary
void removeFvBoundary()
Definition: fvMesh.C:635
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:444
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::PtrList::set
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: PtrList.H:138
Foam::dictionary::set
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Definition: dictionary.C:780
polyBoundaryMeshEntries.H
Foam::IOobject::time
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:493
processorCyclicPolyPatch.H
Foam::sumOp
Definition: ops.H:213
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::cellZone
A subset of mesh cells.
Definition: cellZone.H:62
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:57
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
nPatches
const label nPatches
Definition: printMeshSummary.H:30
Foam::UPstream::subProcs
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
Definition: UPstream.H:515
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::fvMeshTools::newMesh
static autoPtr< fvMesh > newMesh(const IOobject &io, const bool masterOnlyReading)
Read mesh or create dummy mesh (0 cells, >0 patches). Works in two.
Definition: fvMeshTools.C:424
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Definition: polyMesh.H:492
Foam::List::setSize
void setSize(const label n)
Alias for resize()
Definition: List.H:222
Foam::DynamicList::append
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
Definition: DynamicListI.H:511
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
Foam::PtrList::setSize
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:151
Foam::CompactIOList< face, label >
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
Definition: polyMesh.H:486
Foam::andOp
Definition: ops.H:233
Foam::PtrList< entry >
Foam::fvMeshTools::reorderPatches
static void reorderPatches(fvMesh &, const labelList &oldToNew, const label nPatches, const bool validBoundary)
Reorder and remove trailing patches. If validBoundary call is parallel.
Definition: fvMeshTools.C:329
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Definition: polyBoundaryMesh.C:765
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh::addFvPatches
void addFvPatches(PtrList< polyPatch > &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
Definition: fvMesh.C:605
Foam::PtrList::clone
PtrList< T > clone(Args &&... args) const
Make a copy by cloning each of the list elements.
Foam::polyPatch::New
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
Definition: polyPatchNew.C:35
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:361
Foam::Time::findInstance
word findInstance(const fileName &dir, const word &name=word::null, const IOobject::readOption rOpt=IOobject::MUST_READ, const word &stopInstance=word::null) const
Definition: Time.C:797
Foam::ZoneMesh::names
wordList names() const
A list of the zone names.
Definition: ZoneMesh.C:305
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:685
Foam::IOobject::name
const word & name() const noexcept
Return name.
Definition: IOobjectI.H:65
Foam::autoPtr< Foam::fvMesh >
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePathsI.H:102
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::Time::path
fileName path() const
Return path.
Definition: Time.H:358
fvMeshTools.H
Foam::UPstream::commsTypes::scheduled
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const noexcept
Number of internal faces.
Definition: primitiveMeshI.H:78
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Foam::List< label >
Foam::fvMeshTools::addPatch
static label addPatch(fvMesh &mesh, const polyPatch &patch, const dictionary &patchFieldDict, const word &defaultPatchFieldType, const bool validBoundary)
Add patch. Inserts patch before all processor patches.
Definition: fvMeshTools.C:37
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::IOList< label >
Foam::polyMesh::pointZones
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
Definition: polyMesh.H:480
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
Foam::dictionary::add
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:640
Foam::IPstream
Input inter-processor communications stream.
Definition: IPstream.H:53
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::polyMesh::addZones
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
Definition: polyMesh.C:999
Foam::fvMesh::clearOut
void clearOut()
Clear all geometry and addressing.
Definition: fvMesh.C:239
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::IOobject::db
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:487