renumberMesh.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) 2016-2020 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  renumberMesh
29 
30 Group
31  grpMeshManipulationUtilities
32 
33 Description
34  Renumbers the cell list in order to reduce the bandwidth, reading and
35  renumbering all fields from all the time directories.
36 
37  By default uses bandCompression (CuthillMcKee) but will
38  read system/renumberMeshDict if -dict option is present
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #include "argList.H"
43 #include "IOobjectList.H"
44 #include "fvMesh.H"
45 #include "polyTopoChange.H"
46 #include "ReadFields.H"
47 #include "volFields.H"
48 #include "surfaceFields.H"
49 #include "SortableList.H"
50 #include "decompositionMethod.H"
51 #include "renumberMethod.H"
53 #include "CuthillMcKeeRenumber.H"
54 #include "fvMeshSubset.H"
55 #include "cellSet.H"
56 #include "faceSet.H"
57 #include "pointSet.H"
58 #include "processorMeshes.H"
59 #include "hexRef8Data.H"
60 
61 #ifdef HAVE_ZOLTAN
62  #include "zoltanRenumber.H"
63 #endif
64 
65 
66 using namespace Foam;
67 
68 
69 // Create named field from labelList for post-processing
70 tmp<volScalarField> createScalarField
71 (
72  const fvMesh& mesh,
73  const word& name,
74  const labelList& elems
75 )
76 {
78  (
79  new volScalarField
80  (
81  IOobject
82  (
83  name,
84  mesh.time().timeName(),
85  mesh,
88  false
89  ),
90  mesh,
92  zeroGradientFvPatchScalarField::typeName
93  )
94  );
95  volScalarField& fld = tfld.ref();
96 
97  forAll(fld, celli)
98  {
99  fld[celli] = elems[celli];
100  }
101 
102  return tfld;
103 }
104 
105 
106 // Calculate band of matrix
107 label getBand(const labelList& owner, const labelList& neighbour)
108 {
109  label band = 0;
110 
111  forAll(neighbour, facei)
112  {
113  label diff = neighbour[facei] - owner[facei];
114 
115  if (diff > band)
116  {
117  band = diff;
118  }
119  }
120  return band;
121 }
122 
123 
124 // Calculate band of matrix
125 void getBand
126 (
127  const bool calculateIntersect,
128  const label nCells,
129  const labelList& owner,
130  const labelList& neighbour,
131  label& bandwidth,
132  scalar& profile, // scalar to avoid overflow
133  scalar& sumSqrIntersect // scalar to avoid overflow
134 )
135 {
136  labelList cellBandwidth(nCells, Zero);
137  scalarField nIntersect(nCells, Zero);
138 
139  forAll(neighbour, facei)
140  {
141  label own = owner[facei];
142  label nei = neighbour[facei];
143 
144  // Note: mag not necessary for correct (upper-triangular) ordering.
145  label diff = nei-own;
146  cellBandwidth[nei] = max(cellBandwidth[nei], diff);
147  }
148 
149  bandwidth = max(cellBandwidth);
150 
151  // Do not use field algebra because of conversion label to scalar
152  profile = 0.0;
153  forAll(cellBandwidth, celli)
154  {
155  profile += 1.0*cellBandwidth[celli];
156  }
157 
158  sumSqrIntersect = 0.0;
159  if (calculateIntersect)
160  {
161  forAll(nIntersect, celli)
162  {
163  for (label colI = celli-cellBandwidth[celli]; colI <= celli; colI++)
164  {
165  nIntersect[colI] += 1.0;
166  }
167  }
168 
169  sumSqrIntersect = sum(Foam::sqr(nIntersect));
170  }
171 }
172 
173 
174 // Determine upper-triangular face order
175 labelList getFaceOrder
176 (
177  const primitiveMesh& mesh,
178  const labelList& cellOrder // New to old cell
179 )
180 {
181  labelList reverseCellOrder(invert(cellOrder.size(), cellOrder));
182 
183  labelList oldToNewFace(mesh.nFaces(), -1);
184 
185  label newFacei = 0;
186 
187  labelList nbr;
188  labelList order;
189 
190  forAll(cellOrder, newCelli)
191  {
192  label oldCelli = cellOrder[newCelli];
193 
194  const cell& cFaces = mesh.cells()[oldCelli];
195 
196  // Neighbouring cells
197  nbr.setSize(cFaces.size());
198 
199  forAll(cFaces, i)
200  {
201  label facei = cFaces[i];
202 
203  if (mesh.isInternalFace(facei))
204  {
205  // Internal face. Get cell on other side.
206  label nbrCelli = reverseCellOrder[mesh.faceNeighbour()[facei]];
207  if (nbrCelli == newCelli)
208  {
209  nbrCelli = reverseCellOrder[mesh.faceOwner()[facei]];
210  }
211 
212  if (newCelli < nbrCelli)
213  {
214  // Celli is master
215  nbr[i] = nbrCelli;
216  }
217  else
218  {
219  // nbrCell is master. Let it handle this face.
220  nbr[i] = -1;
221  }
222  }
223  else
224  {
225  // External face. Do later.
226  nbr[i] = -1;
227  }
228  }
229 
230  sortedOrder(nbr, order);
231 
232  for (const label index : order)
233  {
234  if (nbr[index] != -1)
235  {
236  oldToNewFace[cFaces[index]] = newFacei++;
237  }
238  }
239  }
240 
241  // Leave patch faces intact.
242  for (label facei = newFacei; facei < mesh.nFaces(); facei++)
243  {
244  oldToNewFace[facei] = facei;
245  }
246 
247 
248  // Check done all faces.
249  forAll(oldToNewFace, facei)
250  {
251  if (oldToNewFace[facei] == -1)
252  {
254  << "Did not determine new position" << " for face " << facei
255  << abort(FatalError);
256  }
257  }
258 
259  return invert(mesh.nFaces(), oldToNewFace);
260 }
261 
262 
263 // Determine face order such that inside region faces are sorted
264 // upper-triangular but inbetween region faces are handled like boundary faces.
265 labelList getRegionFaceOrder
266 (
267  const primitiveMesh& mesh,
268  const labelList& cellOrder, // New to old cell
269  const labelList& cellToRegion // Old cell to region
270 )
271 {
272  labelList reverseCellOrder(invert(cellOrder.size(), cellOrder));
273 
274  labelList oldToNewFace(mesh.nFaces(), -1);
275 
276  label newFacei = 0;
277 
278  label prevRegion = -1;
279 
280  forAll(cellOrder, newCelli)
281  {
282  label oldCelli = cellOrder[newCelli];
283 
284  if (cellToRegion[oldCelli] != prevRegion)
285  {
286  prevRegion = cellToRegion[oldCelli];
287  }
288 
289  const cell& cFaces = mesh.cells()[oldCelli];
290 
291  SortableList<label> nbr(cFaces.size());
292 
293  forAll(cFaces, i)
294  {
295  label facei = cFaces[i];
296 
297  if (mesh.isInternalFace(facei))
298  {
299  // Internal face. Get cell on other side.
300  label nbrCelli = reverseCellOrder[mesh.faceNeighbour()[facei]];
301  if (nbrCelli == newCelli)
302  {
303  nbrCelli = reverseCellOrder[mesh.faceOwner()[facei]];
304  }
305 
306  if (cellToRegion[oldCelli] != cellToRegion[cellOrder[nbrCelli]])
307  {
308  // Treat like external face. Do later.
309  nbr[i] = -1;
310  }
311  else if (newCelli < nbrCelli)
312  {
313  // Celli is master
314  nbr[i] = nbrCelli;
315  }
316  else
317  {
318  // nbrCell is master. Let it handle this face.
319  nbr[i] = -1;
320  }
321  }
322  else
323  {
324  // External face. Do later.
325  nbr[i] = -1;
326  }
327  }
328 
329  nbr.sort();
330 
331  forAll(nbr, i)
332  {
333  if (nbr[i] != -1)
334  {
335  oldToNewFace[cFaces[nbr.indices()[i]]] = newFacei++;
336  }
337  }
338  }
339 
340  // Do region interfaces
341  label nRegions = max(cellToRegion)+1;
342  {
343  // Sort in increasing region
345 
346  for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
347  {
348  label ownRegion = cellToRegion[mesh.faceOwner()[facei]];
349  label neiRegion = cellToRegion[mesh.faceNeighbour()[facei]];
350 
351  if (ownRegion != neiRegion)
352  {
353  sortKey[facei] =
354  min(ownRegion, neiRegion)*nRegions
355  +max(ownRegion, neiRegion);
356  }
357  }
358  sortKey.sort();
359 
360  // Extract.
361  label prevKey = -1;
362  forAll(sortKey, i)
363  {
364  label key = sortKey[i];
365 
366  if (key == labelMax)
367  {
368  break;
369  }
370 
371  if (prevKey != key)
372  {
373  prevKey = key;
374  }
375 
376  oldToNewFace[sortKey.indices()[i]] = newFacei++;
377  }
378  }
379 
380  // Leave patch faces intact.
381  for (label facei = newFacei; facei < mesh.nFaces(); facei++)
382  {
383  oldToNewFace[facei] = facei;
384  }
385 
386 
387  // Check done all faces.
388  forAll(oldToNewFace, facei)
389  {
390  if (oldToNewFace[facei] == -1)
391  {
393  << "Did not determine new position"
394  << " for face " << facei
395  << abort(FatalError);
396  }
397  }
398 
399  return invert(mesh.nFaces(), oldToNewFace);
400 }
401 
402 
403 // cellOrder: old cell for every new cell
404 // faceOrder: old face for every new face. Ordering of boundary faces not
405 // changed.
406 autoPtr<mapPolyMesh> reorderMesh
407 (
408  polyMesh& mesh,
409  const labelList& cellOrder,
410  const labelList& faceOrder
411 )
412 {
413  labelList reverseCellOrder(invert(cellOrder.size(), cellOrder));
414  labelList reverseFaceOrder(invert(faceOrder.size(), faceOrder));
415 
416  faceList newFaces(reorder(reverseFaceOrder, mesh.faces()));
417  labelList newOwner
418  (
419  renumber
420  (
421  reverseCellOrder,
422  reorder(reverseFaceOrder, mesh.faceOwner())
423  )
424  );
425  labelList newNeighbour
426  (
427  renumber
428  (
429  reverseCellOrder,
430  reorder(reverseFaceOrder, mesh.faceNeighbour())
431  )
432  );
433 
434  // Check if any faces need swapping.
435  labelHashSet flipFaceFlux(newOwner.size());
436  forAll(newNeighbour, facei)
437  {
438  label own = newOwner[facei];
439  label nei = newNeighbour[facei];
440 
441  if (nei < own)
442  {
443  newFaces[facei].flip();
444  Swap(newOwner[facei], newNeighbour[facei]);
445  flipFaceFlux.insert(facei);
446  }
447  }
448 
450  labelList patchSizes(patches.size());
451  labelList patchStarts(patches.size());
452  labelList oldPatchNMeshPoints(patches.size());
453  labelListList patchPointMap(patches.size());
454 
455  forAll(patches, patchi)
456  {
457  patchSizes[patchi] = patches[patchi].size();
458  patchStarts[patchi] = patches[patchi].start();
459  oldPatchNMeshPoints[patchi] = patches[patchi].nPoints();
460  patchPointMap[patchi] = identity(patches[patchi].nPoints());
461  }
462 
464  (
465  autoPtr<pointField>(), // <- null: leaves points untouched
466  autoPtr<faceList>::New(std::move(newFaces)),
467  autoPtr<labelList>::New(std::move(newOwner)),
468  autoPtr<labelList>::New(std::move(newNeighbour)),
469  patchSizes,
470  patchStarts,
471  true
472  );
473 
474 
475  // Re-do the faceZones
476  {
477  faceZoneMesh& faceZones = mesh.faceZones();
478  faceZones.clearAddressing();
479  forAll(faceZones, zoneI)
480  {
481  faceZone& fZone = faceZones[zoneI];
482  labelList newAddressing(fZone.size());
483  boolList newFlipMap(fZone.size());
484  forAll(fZone, i)
485  {
486  label oldFacei = fZone[i];
487  newAddressing[i] = reverseFaceOrder[oldFacei];
488  if (flipFaceFlux.found(newAddressing[i]))
489  {
490  newFlipMap[i] = !fZone.flipMap()[i];
491  }
492  else
493  {
494  newFlipMap[i] = fZone.flipMap()[i];
495  }
496  }
497  labelList newToOld(sortedOrder(newAddressing));
498  fZone.resetAddressing
499  (
500  labelUIndList(newAddressing, newToOld)(),
501  boolUIndList(newFlipMap, newToOld)()
502  );
503  }
504  }
505  // Re-do the cellZones
506  {
507  cellZoneMesh& cellZones = mesh.cellZones();
508  cellZones.clearAddressing();
509  forAll(cellZones, zoneI)
510  {
511  cellZones[zoneI] = labelUIndList
512  (
513  reverseCellOrder,
514  cellZones[zoneI]
515  )();
516  Foam::sort(cellZones[zoneI]);
517  }
518  }
519 
520 
522  (
523  mesh, // const polyMesh& mesh,
524  mesh.nPoints(), // nOldPoints,
525  mesh.nFaces(), // nOldFaces,
526  mesh.nCells(), // nOldCells,
527  identity(mesh.nPoints()), // pointMap,
528  List<objectMap>(), // pointsFromPoints,
529  faceOrder, // faceMap,
530  List<objectMap>(), // facesFromPoints,
531  List<objectMap>(), // facesFromEdges,
532  List<objectMap>(), // facesFromFaces,
533  cellOrder, // cellMap,
534  List<objectMap>(), // cellsFromPoints,
535  List<objectMap>(), // cellsFromEdges,
536  List<objectMap>(), // cellsFromFaces,
537  List<objectMap>(), // cellsFromCells,
538  identity(mesh.nPoints()), // reversePointMap,
539  reverseFaceOrder, // reverseFaceMap,
540  reverseCellOrder, // reverseCellMap,
541  flipFaceFlux, // flipFaceFlux,
542  patchPointMap, // patchPointMap,
543  labelListList(), // pointZoneMap,
544  labelListList(), // faceZonePointMap,
545  labelListList(), // faceZoneFaceMap,
546  labelListList(), // cellZoneMap,
547  pointField(), // preMotionPoints,
548  patchStarts, // oldPatchStarts,
549  oldPatchNMeshPoints, // oldPatchNMeshPoints
550  autoPtr<scalarField>() // oldCellVolumes
551  );
552 }
553 
554 
555 // Return new to old cell numbering
556 labelList regionRenumber
557 (
558  const renumberMethod& method,
559  const fvMesh& mesh,
560  const labelList& cellToRegion
561 )
562 {
563  Info<< "Determining cell order:" << endl;
564 
565  labelList cellOrder(cellToRegion.size());
566 
567  label nRegions = max(cellToRegion)+1;
568 
569  labelListList regionToCells(invertOneToMany(nRegions, cellToRegion));
570 
571  label celli = 0;
572 
573  forAll(regionToCells, regioni)
574  {
575  Info<< " region " << regioni << " starts at " << celli << endl;
576 
577  // Make sure no parallel comms
578  const bool oldParRun = UPstream::parRun();
579  UPstream::parRun() = false;
580 
581  // Per region do a reordering.
582  fvMeshSubset subsetter(mesh, regioni, cellToRegion);
583 
584  const fvMesh& subMesh = subsetter.subMesh();
585 
586  labelList subCellOrder = method.renumber
587  (
588  subMesh,
589  subMesh.cellCentres()
590  );
591 
592  // Restore state
593  UPstream::parRun() = oldParRun;
594 
595  const labelList& cellMap = subsetter.cellMap();
596 
597  forAll(subCellOrder, i)
598  {
599  cellOrder[celli++] = cellMap[subCellOrder[i]];
600  }
601  }
602  Info<< endl;
603 
604  return cellOrder;
605 }
606 
607 
608 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
609 
610 int main(int argc, char *argv[])
611 {
613  (
614  "Renumber mesh cells to reduce the bandwidth"
615  );
616 
617  #include "addRegionOption.H"
618  #include "addOverwriteOption.H"
619  #include "addTimeOptions.H"
620 
621  argList::addOption("dict", "file", "Alternative renumberMeshDict");
622 
624  (
625  "frontWidth",
626  "Calculate the rms of the front-width"
627  );
628 
629  argList::noFunctionObjects(); // Never use function objects
630 
631  #include "setRootCase.H"
632  #include "createTime.H"
633 
634 
635  // Force linker to include zoltan symbols. This section is only needed since
636  // Zoltan is a static library
637  #ifdef HAVE_ZOLTAN
638  Info<< "renumberMesh built with zoltan support." << nl << endl;
639  (void)zoltanRenumber::typeName;
640  #endif
641 
642 
643  // Get times list
644  instantList Times = runTime.times();
645 
646  // Set startTime and endTime depending on -time and -latestTime options
647  #include "checkTimeOptions.H"
648 
650 
651  #include "createNamedMesh.H"
652 
653  const word oldInstance = mesh.pointsInstance();
654 
655  const bool readDict = args.found("dict");
656  const bool doFrontWidth = args.found("frontWidth");
657  const bool overwrite = args.found("overwrite");
658 
659  label band;
660  scalar profile;
661  scalar sumSqrIntersect;
662  getBand
663  (
664  doFrontWidth,
665  mesh.nCells(),
666  mesh.faceOwner(),
668  band,
669  profile,
670  sumSqrIntersect
671  );
672 
673  reduce(band, maxOp<label>());
674  reduce(profile, sumOp<scalar>());
675  scalar rmsFrontwidth = Foam::sqrt
676  (
678  (
679  sumSqrIntersect,
680  sumOp<scalar>()
682  );
683 
684  Info<< "Mesh size: " << mesh.globalData().nTotalCells() << nl
685  << "Before renumbering :" << nl
686  << " band : " << band << nl
687  << " profile : " << profile << nl;
688 
689  if (doFrontWidth)
690  {
691  Info<< " rms frontwidth : " << rmsFrontwidth << nl;
692  }
693 
694  Info<< endl;
695 
696  bool sortCoupledFaceCells = false;
697  bool writeMaps = false;
698  bool orderPoints = false;
699  label blockSize = 0;
700 
701  // Construct renumberMethod
702  autoPtr<IOdictionary> renumberDictPtr;
703  autoPtr<renumberMethod> renumberPtr;
704 
705  if (readDict)
706  {
707  const word dictName("renumberMeshDict");
708  #include "setSystemMeshDictionaryIO.H"
709 
710  Info<< "Renumber according to " << dictIO.name() << nl << endl;
711 
712  renumberDictPtr.reset(new IOdictionary(dictIO));
713  const IOdictionary& renumberDict = renumberDictPtr();
714 
715  renumberPtr = renumberMethod::New(renumberDict);
716 
717  sortCoupledFaceCells = renumberDict.getOrDefault
718  (
719  "sortCoupledFaceCells",
720  false
721  );
722  if (sortCoupledFaceCells)
723  {
724  Info<< "Sorting cells on coupled boundaries to be last." << nl
725  << endl;
726  }
727 
728  blockSize = renumberDict.getOrDefault("blockSize", 0);
729  if (blockSize > 0)
730  {
731  Info<< "Ordering cells into regions of size " << blockSize
732  << " (using decomposition);"
733  << " ordering faces into region-internal and region-external."
734  << nl << endl;
735 
736  if (blockSize < 0 || blockSize >= mesh.nCells())
737  {
739  << "Block size " << blockSize
740  << " should be positive integer"
741  << " and less than the number of cells in the mesh."
742  << exit(FatalError);
743  }
744  }
745 
746  orderPoints = renumberDict.getOrDefault("orderPoints", false);
747  if (orderPoints)
748  {
749  Info<< "Ordering points into internal and boundary points." << nl
750  << endl;
751  }
752 
753  renumberDict.readEntry("writeMaps", writeMaps);
754  if (writeMaps)
755  {
756  Info<< "Writing renumber maps (new to old) to polyMesh." << nl
757  << endl;
758  }
759  }
760  else
761  {
762  Info<< "Using default renumberMethod." << nl << endl;
763  dictionary renumberDict;
764  renumberPtr.reset(new CuthillMcKeeRenumber(renumberDict));
765  }
766 
767  Info<< "Selecting renumberMethod " << renumberPtr().type() << nl << endl;
768 
769 
770 
771  // Read parallel reconstruct maps
772  labelIOList cellProcAddressing
773  (
774  IOobject
775  (
776  "cellProcAddressing",
779  mesh,
782  ),
783  labelList(0)
784  );
785 
787  (
788  IOobject
789  (
790  "faceProcAddressing",
793  mesh,
796  ),
797  labelList(0)
798  );
799  labelIOList pointProcAddressing
800  (
801  IOobject
802  (
803  "pointProcAddressing",
806  mesh,
809  ),
810  labelList(0)
811  );
812  labelIOList boundaryProcAddressing
813  (
814  IOobject
815  (
816  "boundaryProcAddressing",
819  mesh,
822  ),
823  labelList(0)
824  );
825 
826 
827  // Read objects in time directory
828  IOobjectList objects(mesh, runTime.timeName());
829 
830 
831  // Read vol fields.
832 
834  ReadFields(mesh, objects, vsFlds);
835 
837  ReadFields(mesh, objects, vvFlds);
838 
840  ReadFields(mesh, objects, vstFlds);
841 
842  PtrList<volSymmTensorField> vsymtFlds;
843  ReadFields(mesh, objects, vsymtFlds);
844 
846  ReadFields(mesh, objects, vtFlds);
847 
848 
849  // Read surface fields.
850 
852  ReadFields(mesh, objects, ssFlds);
853 
855  ReadFields(mesh, objects, svFlds);
856 
858  ReadFields(mesh, objects, sstFlds);
859 
861  ReadFields(mesh, objects, ssymtFlds);
862 
864  ReadFields(mesh, objects, stFlds);
865 
866 
867  // Read point fields.
868 
870  ReadFields(pointMesh::New(mesh), objects, psFlds);
871 
873  ReadFields(pointMesh::New(mesh), objects, pvFlds);
874 
876  ReadFields(pointMesh::New(mesh), objects, pstFlds);
877 
879  ReadFields(pointMesh::New(mesh), objects, psymtFlds);
880 
882  ReadFields(pointMesh::New(mesh), objects, ptFlds);
883 
884 
885  // Read sets
886  PtrList<cellSet> cellSets;
887  PtrList<faceSet> faceSets;
888  PtrList<pointSet> pointSets;
889  {
890  // Read sets
891  IOobjectList objects(mesh, mesh.facesInstance(), "polyMesh/sets");
892  ReadFields(objects, cellSets);
893  ReadFields(objects, faceSets);
894  ReadFields(objects, pointSets);
895  }
896 
897 
898  Info<< endl;
899 
900  // From renumbering:
901  // - from new cell/face back to original cell/face
902  labelList cellOrder;
903  labelList faceOrder;
904 
905  if (blockSize > 0)
906  {
907  // Renumbering in two phases. Should be done in one so mapping of
908  // fields is done correctly!
909 
910  label nBlocks = mesh.nCells()/blockSize;
911  Info<< "nBlocks = " << nBlocks << endl;
912 
913  // Read decompositionMethod dictionary
914  dictionary decomposeDict(renumberDictPtr().subDict("blockCoeffs"));
915  decomposeDict.set("numberOfSubdomains", nBlocks);
916 
917  bool oldParRun = UPstream::parRun();
918  UPstream::parRun() = false;
919 
921  (
922  decomposeDict
923  );
924 
925  labelList cellToRegion
926  (
927  decomposePtr().decompose
928  (
929  mesh,
930  mesh.cellCentres()
931  )
932  );
933 
934  // Restore state
935  UPstream::parRun() = oldParRun;
936 
937  // For debugging: write out region
938  createScalarField
939  (
940  mesh,
941  "cellDist",
942  cellToRegion
943  )().write();
944 
945  Info<< nl << "Written decomposition as volScalarField to "
946  << "cellDist for use in postprocessing."
947  << nl << endl;
948 
949 
950  cellOrder = regionRenumber(renumberPtr(), mesh, cellToRegion);
951 
952  // Determine new to old face order with new cell numbering
953  faceOrder = getRegionFaceOrder
954  (
955  mesh,
956  cellOrder,
957  cellToRegion
958  );
959  }
960  else
961  {
962  // Determines sorted back to original cell ordering
963  cellOrder = renumberPtr().renumber
964  (
965  mesh,
966  mesh.cellCentres()
967  );
968 
969  if (sortCoupledFaceCells)
970  {
971  // Change order so all coupled patch faceCells are at the end.
972  const polyBoundaryMesh& pbm = mesh.boundaryMesh();
973 
974  // Collect all boundary cells on coupled patches
975  label nBndCells = 0;
976  forAll(pbm, patchi)
977  {
978  if (pbm[patchi].coupled())
979  {
980  nBndCells += pbm[patchi].size();
981  }
982  }
983 
984  labelList reverseCellOrder = invert(mesh.nCells(), cellOrder);
985 
986  labelList bndCells(nBndCells);
987  labelList bndCellMap(nBndCells);
988  nBndCells = 0;
989  forAll(pbm, patchi)
990  {
991  if (pbm[patchi].coupled())
992  {
993  const labelUList& faceCells = pbm[patchi].faceCells();
994  forAll(faceCells, i)
995  {
996  label celli = faceCells[i];
997 
998  if (reverseCellOrder[celli] != -1)
999  {
1000  bndCells[nBndCells] = celli;
1001  bndCellMap[nBndCells++] = reverseCellOrder[celli];
1002  reverseCellOrder[celli] = -1;
1003  }
1004  }
1005  }
1006  }
1007  bndCells.setSize(nBndCells);
1008  bndCellMap.setSize(nBndCells);
1009 
1010  // Sort
1011  labelList order(sortedOrder(bndCellMap));
1012 
1013  // Redo newReverseCellOrder
1014  labelList newReverseCellOrder(mesh.nCells(), -1);
1015 
1016  label sortedI = mesh.nCells();
1017  forAllReverse(order, i)
1018  {
1019  label origCelli = bndCells[order[i]];
1020  newReverseCellOrder[origCelli] = --sortedI;
1021  }
1022 
1023  Info<< "Ordered all " << nBndCells << " cells with a coupled face"
1024  << " to the end of the cell list, starting at " << sortedI
1025  << endl;
1026 
1027  // Compact
1028  sortedI = 0;
1029  forAll(cellOrder, newCelli)
1030  {
1031  label origCelli = cellOrder[newCelli];
1032  if (newReverseCellOrder[origCelli] == -1)
1033  {
1034  newReverseCellOrder[origCelli] = sortedI++;
1035  }
1036  }
1037 
1038  // Update sorted back to original (unsorted) map
1039  cellOrder = invert(mesh.nCells(), newReverseCellOrder);
1040  }
1041 
1042 
1043  // Determine new to old face order with new cell numbering
1044  faceOrder = getFaceOrder
1045  (
1046  mesh,
1047  cellOrder // New to old cell
1048  );
1049  }
1050 
1051 
1052  if (!overwrite)
1053  {
1054  ++runTime;
1055  }
1056 
1057 
1058  // Change the mesh.
1059  autoPtr<mapPolyMesh> map = reorderMesh(mesh, cellOrder, faceOrder);
1060 
1061 
1062  if (orderPoints)
1063  {
1064  polyTopoChange meshMod(mesh);
1065  autoPtr<mapPolyMesh> pointOrderMap = meshMod.changeMesh
1066  (
1067  mesh,
1068  false, // inflate
1069  true, // syncParallel
1070  false, // orderCells
1071  orderPoints // orderPoints
1072  );
1073 
1074  // Combine point reordering into map.
1075  const_cast<labelList&>(map().pointMap()) = labelUIndList
1076  (
1077  map().pointMap(),
1078  pointOrderMap().pointMap()
1079  )();
1080 
1082  (
1083  pointOrderMap().reversePointMap(),
1084  const_cast<labelList&>(map().reversePointMap())
1085  );
1086  }
1087 
1088 
1089  // Update fields
1090  mesh.updateMesh(map());
1091 
1092  // Update proc maps
1093  if (cellProcAddressing.headerOk())
1094  {
1095  bool localOk = (cellProcAddressing.size() == mesh.nCells());
1096 
1097  if (returnReduce(localOk, andOp<bool>()))
1098  {
1099  Info<< "Renumbering processor cell decomposition map "
1100  << cellProcAddressing.name() << endl;
1101 
1102  cellProcAddressing = labelList
1103  (
1104  labelUIndList(cellProcAddressing, map().cellMap())
1105  );
1106  }
1107  else
1108  {
1109  Info<< "Not writing inconsistent processor cell decomposition"
1110  << " map " << cellProcAddressing.filePath() << endl;
1111  cellProcAddressing.writeOpt() = IOobject::NO_WRITE;
1112  }
1113  }
1114  else
1115  {
1116  cellProcAddressing.writeOpt() = IOobject::NO_WRITE;
1117  }
1118 
1119  if (faceProcAddressing.headerOk())
1120  {
1121  bool localOk = (faceProcAddressing.size() == mesh.nFaces());
1122 
1123  if (returnReduce(localOk, andOp<bool>()))
1124  {
1125  Info<< "Renumbering processor face decomposition map "
1126  << faceProcAddressing.name() << endl;
1127 
1129  (
1131  );
1132 
1133  // Detect any flips.
1134  const labelHashSet& fff = map().flipFaceFlux();
1135  for (const label facei : fff)
1136  {
1137  label masterFacei = faceProcAddressing[facei];
1138 
1139  faceProcAddressing[facei] = -masterFacei;
1140 
1141  if (masterFacei == 0)
1142  {
1144  << " masterFacei:" << masterFacei << exit(FatalError);
1145  }
1146  }
1147  }
1148  else
1149  {
1150  Info<< "Not writing inconsistent processor face decomposition"
1151  << " map " << faceProcAddressing.filePath() << endl;
1153  }
1154  }
1155  else
1156  {
1158  }
1159 
1160  if (pointProcAddressing.headerOk())
1161  {
1162  bool localOk = (pointProcAddressing.size() == mesh.nPoints());
1163 
1164  if (returnReduce(localOk, andOp<bool>()))
1165  {
1166  Info<< "Renumbering processor point decomposition map "
1167  << pointProcAddressing.name() << endl;
1168 
1169  pointProcAddressing = labelList
1170  (
1171  labelUIndList(pointProcAddressing, map().pointMap())
1172  );
1173  }
1174  else
1175  {
1176  Info<< "Not writing inconsistent processor point decomposition"
1177  << " map " << pointProcAddressing.filePath() << endl;
1178  pointProcAddressing.writeOpt() = IOobject::NO_WRITE;
1179  }
1180  }
1181  else
1182  {
1183  pointProcAddressing.writeOpt() = IOobject::NO_WRITE;
1184  }
1185 
1186  if (boundaryProcAddressing.headerOk())
1187  {
1188  bool localOk =
1189  (
1190  boundaryProcAddressing.size()
1191  == mesh.boundaryMesh().size()
1192  );
1193  if (returnReduce(localOk, andOp<bool>()))
1194  {
1195  // No renumbering needed
1196  }
1197  else
1198  {
1199  Info<< "Not writing inconsistent processor patch decomposition"
1200  << " map " << boundaryProcAddressing.filePath() << endl;
1201  boundaryProcAddressing.writeOpt() = IOobject::NO_WRITE;
1202  }
1203  }
1204  else
1205  {
1206  boundaryProcAddressing.writeOpt() = IOobject::NO_WRITE;
1207  }
1208 
1209 
1210 
1211 
1212  // Move mesh (since morphing might not do this)
1213  if (map().hasMotionPoints())
1214  {
1215  mesh.movePoints(map().preMotionPoints());
1216  }
1217 
1218 
1219  {
1220  label band;
1221  scalar profile;
1222  scalar sumSqrIntersect;
1223  getBand
1224  (
1225  doFrontWidth,
1226  mesh.nCells(),
1227  mesh.faceOwner(),
1228  mesh.faceNeighbour(),
1229  band,
1230  profile,
1231  sumSqrIntersect
1232  );
1233  reduce(band, maxOp<label>());
1234  reduce(profile, sumOp<scalar>());
1235  scalar rmsFrontwidth = Foam::sqrt
1236  (
1237  returnReduce
1238  (
1239  sumSqrIntersect,
1240  sumOp<scalar>()
1242  );
1243 
1244  Info<< "After renumbering :" << nl
1245  << " band : " << band << nl
1246  << " profile : " << profile << nl;
1247 
1248  if (doFrontWidth)
1249  {
1250 
1251  Info<< " rms frontwidth : " << rmsFrontwidth << nl;
1252  }
1253 
1254  Info<< endl;
1255  }
1256 
1257  if (orderPoints)
1258  {
1259  // Force edge calculation (since only reason that points would need to
1260  // be sorted)
1261  (void)mesh.edges();
1262 
1263  label nTotPoints = returnReduce
1264  (
1265  mesh.nPoints(),
1266  sumOp<label>()
1267  );
1268  label nTotIntPoints = returnReduce
1269  (
1271  sumOp<label>()
1272  );
1273 
1274  label nTotEdges = returnReduce
1275  (
1276  mesh.nEdges(),
1277  sumOp<label>()
1278  );
1279  label nTotIntEdges = returnReduce
1280  (
1281  mesh.nInternalEdges(),
1282  sumOp<label>()
1283  );
1284  label nTotInt0Edges = returnReduce
1285  (
1287  sumOp<label>()
1288  );
1289  label nTotInt1Edges = returnReduce
1290  (
1292  sumOp<label>()
1293  );
1294 
1295  Info<< "Points:" << nl
1296  << " total : " << nTotPoints << nl
1297  << " internal: " << nTotIntPoints << nl
1298  << " boundary: " << nTotPoints-nTotIntPoints << nl
1299  << "Edges:" << nl
1300  << " total : " << nTotEdges << nl
1301  << " internal: " << nTotIntEdges << nl
1302  << " internal using 0 boundary points: "
1303  << nTotInt0Edges << nl
1304  << " internal using 1 boundary points: "
1305  << nTotInt1Edges-nTotInt0Edges << nl
1306  << " internal using 2 boundary points: "
1307  << nTotIntEdges-nTotInt1Edges << nl
1308  << " boundary: " << nTotEdges-nTotIntEdges << nl
1309  << endl;
1310  }
1311 
1312 
1313  if (overwrite)
1314  {
1315  mesh.setInstance(oldInstance);
1316  }
1317  else
1318  {
1320  }
1321 
1322 
1323  Info<< "Writing mesh to " << mesh.facesInstance() << endl;
1324 
1325  // Remove old procAddressing files
1327 
1328  // Update refinement data
1329  hexRef8Data refData
1330  (
1331  IOobject
1332  (
1333  "dummy",
1334  mesh.facesInstance(),
1336  mesh,
1339  false
1340  )
1341  );
1342  refData.updateMesh(map());
1343  refData.write();
1344 
1345  // Update sets
1346  topoSet::updateMesh(mesh.facesInstance(), map(), cellSets);
1347  topoSet::updateMesh(mesh.facesInstance(), map(), faceSets);
1348  topoSet::updateMesh(mesh.facesInstance(), map(), pointSets);
1349 
1350  mesh.write();
1351 
1352  if (writeMaps)
1353  {
1354  // For debugging: write out region
1355  createScalarField
1356  (
1357  mesh,
1358  "origCellID",
1359  map().cellMap()
1360  )().write();
1361 
1362  createScalarField
1363  (
1364  mesh,
1365  "cellID",
1366  identity(mesh.nCells())
1367  )().write();
1368 
1369  Info<< nl << "Written current cellID and origCellID as volScalarField"
1370  << " for use in postprocessing."
1371  << nl << endl;
1372 
1373  labelIOList
1374  (
1375  IOobject
1376  (
1377  "cellMap",
1378  mesh.facesInstance(),
1380  mesh,
1383  false
1384  ),
1385  map().cellMap()
1386  ).write();
1387 
1388  labelIOList
1389  (
1390  IOobject
1391  (
1392  "faceMap",
1393  mesh.facesInstance(),
1395  mesh,
1398  false
1399  ),
1400  map().faceMap()
1401  ).write();
1402 
1403  labelIOList
1404  (
1405  IOobject
1406  (
1407  "pointMap",
1408  mesh.facesInstance(),
1410  mesh,
1413  false
1414  ),
1415  map().pointMap()
1416  ).write();
1417  }
1418 
1419 
1420  Info<< "End\n" << endl;
1421 
1422  return 0;
1423 }
1424 
1425 
1426 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
volFields.H
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::autoPtr::reset
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:109
Foam::maxOp
Definition: ops.H:223
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
faceProcAddressing
PtrList< labelIOList > & faceProcAddressing
Definition: checkFaceAddressingComp.H:9
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
Foam::labelMax
constexpr label labelMax
Definition: label.H:61
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::primitiveMesh::nInternal0Edges
label nInternal0Edges() const
Definition: primitiveMeshI.H:43
Foam::fvMesh::write
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
Definition: fvMesh.C:895
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
Foam::ReadFields
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
Foam::tmp< volScalarField >
Foam::fvMeshSubset
Given the original mesh and the list of selected cells, it creates the mesh consisting only of the de...
Definition: fvMeshSubset.H:73
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const
Number of internal faces.
Definition: primitiveMeshI.H:78
fvMeshSubset.H
addOverwriteOption.H
Foam::primitiveMesh::nFaces
label nFaces() const
Number of mesh faces.
Definition: primitiveMeshI.H:90
Foam::faceZone::resetAddressing
virtual void resetAddressing(const labelUList &addr, const bool flipMapValue)
Reset addressing - use uniform flip map value.
Definition: faceZone.C:451
Foam::polyMesh::meshSubDir
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Definition: polyMesh.H:315
polyTopoChange.H
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:415
Foam::MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
Definition: MeshObject.C:48
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:785
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:138
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:99
Foam::globalMeshData::nTotalCells
label nTotalCells() const
Return total number of cells in decomposed mesh.
Definition: globalMeshData.H:394
Foam::argList::addNote
static void addNote(const string &note)
Add extra notes for the usage information.
Definition: argList.C:413
dictName
const word dictName("blockMeshDict")
Foam::primitiveMesh::nEdges
label nEdges() const
Number of mesh edges.
Definition: primitiveMeshI.H:67
Foam::polyMesh::facesInstance
const fileName & facesInstance() const
Return the current instance directory for faces.
Definition: polyMesh.C:821
Foam::polyMesh::cellZones
const cellZoneMesh & cellZones() const
Return cell zone mesh.
Definition: polyMesh.H:483
Foam::primitiveMesh::nInternal1Edges
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
Definition: primitiveMeshI.H:51
IOobjectList.H
Foam::fvMesh::movePoints
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:727
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:435
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
surfaceFields.H
Foam::surfaceFields.
decompositionMethod.H
Foam::primitiveMesh::edges
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Definition: primitiveMeshEdges.C:505
Foam::HashSet< label, Hash< label > >
Foam::labelIOList
IOList< label > labelIOList
Label container classes.
Definition: labelIOList.H:44
Foam::Swap
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
Definition: DynamicListI.H:909
processorMeshes.H
addTimeOptions.H
Foam::polyBoundaryMesh::start
label start() const
The start label of the boundary faces in the polyMesh face list.
Definition: polyBoundaryMesh.C:638
setSystemMeshDictionaryIO.H
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::invert
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
Definition: ListOps.C:36
Foam::inplaceRenumber
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:61
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sumOp
Definition: ops.H:213
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const
Return face zone mesh.
Definition: polyMesh.H:477
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::diff
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
Definition: triad.C:378
Foam::polyMesh::pointsInstance
const fileName & pointsInstance() const
Return the current instance directory for points.
Definition: polyMesh.C:815
SortableList.H
Foam::renumberMethod::renumber
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited, i.e.
Definition: renumberMethod.H:117
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:51
Foam::argList::noFunctionObjects
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition: argList.C:454
Foam::primitiveMesh::nCells
label nCells() const
Number of mesh cells.
Definition: primitiveMeshI.H:96
renumberMethod.H
Foam::topoSet::updateMesh
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
Definition: topoSet.C:632
Foam::boolUIndList
UIndirectList< bool > boolUIndList
UIndirectList of bools.
Definition: UIndirectList.H:54
Foam::Field< scalar >
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:65
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::primitiveMesh::nInternalEdges
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
Definition: primitiveMeshI.H:59
argList.H
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1076
faceSet.H
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:122
Foam::sort
void sort(UList< T > &a)
Definition: UList.C:254
Foam::TimePaths::times
instantList times() const
Search the case for valid time directories.
Definition: TimePaths.C:149
addRegionOption.H
Foam::fvMesh::updateMesh
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
Definition: fvMesh.C:807
Foam::polyMesh::resetPrimitives
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
Definition: polyMesh.C:687
Foam::ZoneMesh< faceZone, polyMesh >
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::andOp
Definition: ops.H:233
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::reorder
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
Definition: ListOpsTemplates.C:80
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::hexRef8Data
Various for reading/decomposing/reconstructing/distributing refinement data.
Definition: hexRef8Data.H:60
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:121
createNamedMesh.H
Foam::SortableList
A list that is sorted upon construction or when explicitly requested with the sort() method.
Definition: List.H:63
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
dictIO
IOobject dictIO
Definition: setConstantMeshDictionaryIO.H:1
hexRef8Data.H
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
checkTimeOptions.H
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:55
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::renumberMethod
Abstract base class for renumbering.
Definition: renumberMethod.H:50
Foam::argList::addBoolOption
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition: argList.C:325
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::labelListList
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
setRootCase.H
Foam::renumber
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:37
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:175
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1063
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:372
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
ReadFields.H
Field reading functions for post-processing utilities.
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::List< label >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::primitiveMesh::isInternalFace
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Definition: primitiveMeshI.H:102
Foam::Time::setTime
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
Definition: Time.C:1006
Foam::processorMeshes::removeFiles
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
Definition: processorMeshes.C:274
Foam::UList< label >
Foam::primitiveMesh::nPoints
label nPoints() const
Number of mesh points.
Definition: primitiveMeshI.H:37
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::IOList< label >
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
createTime.H
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
forAllReverse
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Definition: stdFoam.H:309
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
zoltanRenumber.H
Foam::UIndirectList
A List with indirect addressing.
Definition: fvMatrix.H:109
Foam::renumberMethod::New
static autoPtr< renumberMethod > New(const dictionary &renumberDict)
Return a reference to the selected renumbering method.
Definition: renumberMethod.C:46
startTime
Foam::label startTime
Definition: checkTimeOptions.H:1
Foam::sortedOrder
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
cellSet.H
Foam::ZoneMesh::clearAddressing
void clearAddressing()
Clear addressing.
Definition: ZoneMesh.C:618
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1234
Foam::List::setSize
void setSize(const label newSize)
Alias for resize(const label)
Definition: ListI.H:146
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::primitiveMesh::nInternalPoints
label nInternalPoints() const
Points not on boundary.
Definition: primitiveMeshI.H:31
Foam::CuthillMcKeeRenumber
Cuthill-McKee renumbering.
Definition: CuthillMcKeeRenumber.H:49
Foam::argList::addOption
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:336
Foam::IOobject::NO_READ
Definition: IOobject.H:123
args
Foam::argList args(argc, argv)
Foam::invertOneToMany
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
Definition: ListOps.C:114
Foam::faceZone::flipMap
const boolList & flipMap() const
Return face flip map.
Definition: faceZone.H:271
zeroGradientFvPatchFields.H
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:54
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::polyMesh::setInstance
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
Definition: polyMeshIO.C:36
Foam::polyMesh::faceNeighbour
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1082
Foam::decompositionMethod::New
static autoPtr< decompositionMethod > New(const dictionary &decompDict)
Return a reference to the selected decomposition method.
Definition: decompositionMethod.C:359
Foam::argList::found
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:157
CuthillMcKeeRenumber.H
Foam::labelUIndList
UIndirectList< label > labelUIndList
UIndirectList of labels.
Definition: UIndirectList.H:58
pointSet.H
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78