45 template<
class PatchType>
48 const bool allGeometry,
59 if (!Pstream::parRun())
61 typedef typename PatchType::surfaceTopo TopoType;
62 TopoType pTyp = pp.surfaceType();
68 else if (pTyp == TopoType::MANIFOLD)
70 if (pp.checkPointManifold(
true, &
points))
73 <<
"multiply connected (shared point)";
77 Info<<
setw(34) <<
"ok (closed singly connected)";
81 pp.checkTopology(
false, &
points);
85 pp.checkTopology(
false, &
points);
87 if (pTyp == TopoType::OPEN)
90 <<
"ok (non-closed singly connected)";
95 <<
"multiply connected (shared edge)";
106 boundBox bb(pp.points(),
mp,
true);
115 const polyMesh&
mesh,
116 const bool allTopology,
117 const bool allGeometry,
118 autoPtr<surfaceWriter>& surfWriter,
119 const autoPtr<writer<scalar>>& setWriter
122 label noFailedChecks = 0;
124 Info<<
"Checking topology..." <<
endl;
127 mesh.boundaryMesh().checkDefinition(
true);
134 if (isA<emptyPolyPatch>(
mesh.boundaryMesh()[patchi]))
136 nEmpty +=
mesh.boundaryMesh()[patchi].size();
139 reduce(nEmpty, sumOp<label>());
143 if (nTotCells && (nEmpty % nTotCells))
145 Info<<
" ***Total number of faces on empty patches"
146 <<
" is not divisible by the number of cells in the mesh."
147 <<
" Hence this mesh is not 1D or 2D."
153 mesh.boundaryMesh().checkParallelSync(
true);
156 mesh.cellZones().checkDefinition(
true);
157 if (
mesh.cellZones().checkParallelSync(
true))
161 mesh.faceZones().checkDefinition(
true);
162 if (
mesh.faceZones().checkParallelSync(
true))
166 mesh.pointZones().checkDefinition(
true);
167 if (
mesh.pointZones().checkParallelSync(
true))
178 const cell& cFaces =
mesh.cells()[celli];
180 if (cFaces.size() <= 3)
184 for (
const label facei : cFaces)
186 if (facei < 0 || facei >=
mesh.nFaces())
197 Info<<
" Illegal cells (less than 4 faces or out of range faces)"
198 <<
" found, number of cells: " << nCells <<
endl;
201 Info<<
" <<Writing " << nCells
202 <<
" illegal cells to set " <<
cells.name() <<
endl;
203 cells.instance() =
mesh.pointsInstance();
212 Info<<
" Cell to face addressing OK." <<
endl;
226 <<
" unused points to set " <<
points.name() <<
endl;
237 faceSet faces(
mesh,
"upperTriangularFace",
mesh.nFaces()/100);
238 if (
mesh.checkUpperTriangular(
true, &faces))
243 const label nFaces =
returnReduce(faces.size(), sumOp<label>());
247 Info<<
" <<Writing " << nFaces
248 <<
" unordered faces to set " << faces.name() <<
endl;
249 faces.instance() =
mesh.pointsInstance();
259 faceSet faces(
mesh,
"outOfRangeFaces",
mesh.nFaces()/100);
260 if (
mesh.checkFaceVertices(
true, &faces))
264 const label nFaces =
returnReduce(faces.size(), sumOp<label>());
266 Info<<
" <<Writing " << nFaces
267 <<
" faces with out-of-range or duplicate vertices to set "
268 << faces.name() <<
endl;
269 faces.instance() =
mesh.pointsInstance();
287 Info<<
" <<Writing " << nCells
288 <<
" cells with over used edges to set " <<
cells.name()
290 cells.instance() =
mesh.pointsInstance();
302 faceSet faces(
mesh,
"edgeFaces",
mesh.nFaces()/100);
303 if (
mesh.checkFaceFaces(
true, &faces))
308 const label nFaces =
returnReduce(faces.size(), sumOp<label>());
311 Info<<
" <<Writing " << nFaces
312 <<
" faces with non-standard edge connectivity to set "
313 << faces.name() <<
endl;
314 faces.instance() =
mesh.pointsInstance();
327 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
329 nInternalFaces[
mesh.faceOwner()[facei]]++;
330 nInternalFaces[
mesh.faceNeighbour()[facei]]++;
332 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
339 for (
const label facei : owners)
341 nInternalFaces[facei]++;
346 cellSet oneCells(
mesh,
"oneInternalFaceCells",
mesh.nCells()/100);
347 cellSet twoCells(
mesh,
"twoInternalFacesCells",
mesh.nCells()/100);
349 forAll(nInternalFaces, celli)
351 if (nInternalFaces[celli] <= 1)
353 oneCells.insert(celli);
355 else if (nInternalFaces[celli] == 2)
357 twoCells.insert(celli);
361 label nOneCells =
returnReduce(oneCells.size(), sumOp<label>());
365 Info<<
" <<Writing " << nOneCells
366 <<
" cells with zero or one non-boundary face to set "
369 oneCells.instance() =
mesh.pointsInstance();
377 label nTwoCells =
returnReduce(twoCells.size(), sumOp<label>());
381 Info<<
" <<Writing " << nTwoCells
382 <<
" cells with two non-boundary faces to set "
385 twoCells.instance() =
mesh.pointsInstance();
395 regionSplit rs(
mesh);
397 if (rs.nRegions() <= 1)
399 Info<<
" Number of regions: " << rs.nRegions() <<
" (OK)."
405 Info<<
" *Number of regions: " << rs.nRegions() <<
endl;
407 Info<<
" The mesh has multiple regions which are not connected "
408 "by any face." <<
endl
409 <<
" <<Writing region information to "
410 <<
mesh.time().timeName()/
"cellToRegion"
418 mesh.time().timeName(),
437 boolList regionDisconnected(rs.nRegions(),
true);
447 label facei =
mesh.nInternalFaces();
448 facei <
mesh.nFaces();
452 const label regioni = rs[
mesh.faceOwner()[facei]];
453 const face&
f =
mesh.faces()[facei];
454 for (
const label verti :
f)
456 label& pRegion = pointToRegion[verti];
461 else if (pRegion == -2)
464 regionDisconnected[regioni] =
false;
466 else if (pRegion != regioni)
469 regionDisconnected[regioni] =
false;
470 regionDisconnected[pRegion] =
false;
477 Pstream::listCombineGather(regionDisconnected, andEqOp<bool>());
478 Pstream::listCombineScatter(regionDisconnected);
484 PtrList<cellSet> cellRegions(rs.nRegions());
485 for (label i = 0; i < rs.nRegions(); i++)
501 cellRegions[rs[i]].insert(i);
504 for (label i = 0; i < rs.nRegions(); i++)
506 Info<<
" <<Writing region " << i;
509 if (regionDisconnected[i])
511 Info<<
" (fully disconnected)";
515 Info<<
" (point connected)";
520 <<
" cells to cellSet " << cellRegions[i].name() <<
endl;
522 cellRegions[i].
write();
529 <<
" points that are in multiple regions to set "
549 if (!Pstream::parRun())
551 Info<<
"\nChecking patch topology for multiply connected"
552 <<
" surfaces..." <<
endl;
556 Info<<
"\nChecking basic patch addressing..." <<
endl;
559 const polyBoundaryMesh&
patches =
mesh.boundaryMesh();
564 <<
setw(20) <<
"Patch"
565 <<
setw(9) <<
"Faces"
566 <<
setw(9) <<
"Points";
567 if (!Pstream::parRun())
569 Info<<
setw(34) <<
"Surface topology";
573 Info<<
" Bounding box";
579 const polyPatch& pp =
patches[patchi];
581 if (!isA<processorPolyPatch>(pp))
592 if (!Pstream::parRun())
594 Info<<
"\nChecking faceZone topology for multiply connected"
595 <<
" surfaces..." <<
endl;
599 Info<<
"\nChecking basic faceZone addressing..." <<
endl;
606 if (faceZones.size())
609 <<
setw(20) <<
"FaceZone"
610 <<
setw(9) <<
"Faces"
611 <<
setw(9) <<
"Points";
613 if (!Pstream::parRun())
615 Info<<
setw(34) <<
"Surface topology";
619 Info<<
" Bounding box";
623 for (
const faceZone& fz : faceZones)
631 Info<<
" No faceZones found."<<
endl;
640 <<
" conflicting points to set " <<
points.name() <<
endl;
650 Info<<
"\nChecking basic cellZone addressing..." <<
endl;
656 if (cellZones.size())
659 <<
setw(20) <<
"CellZone"
660 <<
setw(13) <<
"Cells"
661 <<
setw(13) <<
"Points"
662 <<
setw(13) <<
"Volume"
663 <<
"BoundingBox" <<
endl;
669 bitSet isZonePoint(
mesh.nPoints());
671 for (
const cellZone& cZone : cellZones)
677 for (
const label celli : cZone)
679 v += cellVolumes[celli];
680 for (
const label facei :
cells[celli])
682 const face&
f = faces[facei];
683 for (
const label verti :
f)
685 if (isZonePoint.set(verti))
687 bb.add(
mesh.points()[verti]);
696 <<
setw(19) << cZone.name()
703 <<
' ' << bb <<
endl;
708 Info<<
" No cellZones found."<<
endl;
721 mesh.faceNeighbour();
732 return noFailedChecks;