44 const bool allTopology,
49 label noFailedChecks = 0;
51 Info<<
"Checking topology..." <<
endl;
70 if (nTotCells && (nEmpty % nTotCells))
72 Info<<
" ***Total number of faces on empty patches"
73 <<
" is not divisible by the number of cells in the mesh."
74 <<
" Hence this mesh is not 1D or 2D."
105 const cell& cFaces = mesh.
cells()[celli];
107 if (cFaces.
size() <= 3)
113 if (cFaces[i] < 0 || cFaces[i] >= mesh.
nFaces())
124 Info<<
" Illegal cells (less than 4 faces or out of range faces)"
125 <<
" found, number of cells: " << nCells <<
endl;
130 Info<<
" <<Writing " << nCells
131 <<
" illegal cells to set " <<
cells.name() <<
endl;
134 if (surfWriter.
valid())
142 Info<<
" Cell to face addressing OK." <<
endl;
158 <<
" unused points to set " <<
points.name() <<
endl;
170 faceSet faces(mesh,
"upperTriangularFace", mesh.
nFaces()/100);
182 Info<<
" <<Writing " << nFaces
183 <<
" unordered faces to set " << faces.
name() <<
endl;
186 if (surfWriter.
valid())
204 Info<<
" <<Writing " << nFaces
205 <<
" faces with out-of-range or duplicate vertices to set "
209 if (surfWriter.
valid())
228 Info<<
" <<Writing " << nCells
229 <<
" cells with over used edges to set " <<
cells.name()
233 if (surfWriter.
valid())
254 Info<<
" <<Writing " << nFaces
255 <<
" faces with non-standard edge connectivity to set "
259 if (surfWriter.
valid())
273 nInternalFaces[mesh.
faceOwner()[facei]]++;
285 nInternalFaces[owners[i]]++;
290 cellSet oneCells(mesh,
"oneInternalFaceCells", mesh.
nCells()/100);
291 cellSet twoCells(mesh,
"twoInternalFacesCells", mesh.
nCells()/100);
293 forAll(nInternalFaces, celli)
295 if (nInternalFaces[celli] <= 1)
299 else if (nInternalFaces[celli] == 2)
311 Info<<
" <<Writing " << nOneCells
312 <<
" cells with zero or one non-boundary face to set "
317 if (surfWriter.
valid())
330 Info<<
" <<Writing " << nTwoCells
331 <<
" cells with two non-boundary faces to set "
336 if (surfWriter.
valid())
349 Info<<
" Number of regions: " << rs.
nRegions() <<
" (OK)."
357 Info<<
" The mesh has multiple regions which are not connected "
358 "by any face." <<
endl;
362 Info<<
" <<Writing region information to "
363 << mesh.
time().
name()/
"cellToRegion"
411 label& pRegion = pointToRegion[
f[fp]];
416 else if (pRegion == -2)
419 regionDisconnected[regionI] =
false;
421 else if (pRegion != regionI)
424 regionDisconnected[regionI] =
false;
425 regionDisconnected[pRegion] =
false;
432 Pstream::listCombineGather
437 Pstream::listCombineScatter(regionDisconnected);
457 cellRegions[rs[i]].insert(i);
462 Info<<
" <<Writing region " << i;
464 if (regionDisconnected[i])
466 Info<<
" (fully disconnected)";
470 Info<<
" (point connected)";
475 <<
" cells to cellSet " << cellRegions[i].name()
479 cellRegions[i].write();
486 <<
" points that are in multiple regions to set "
502 if (!Pstream::parRun())
504 Info<<
"\nChecking patch topology for multiply connected"
505 <<
" surfaces..." <<
endl;
509 Info<<
"\nChecking basic patch addressing..." <<
endl;
526 <<
setw(20) <<
"Patch"
527 <<
setw(9) <<
"Faces"
528 <<
setw(9) <<
"Points";
529 if (!Pstream::parRun())
531 Info<<
setw(34) <<
"Surface topology";
539 if (!isA<processorPolyPatch>(pp))
546 if (!Pstream::parRun())
554 else if (pTyp == primitivePatch::MANIFOLD)
559 <<
"multiply connected (shared point)";
563 Info<<
setw(34) <<
"ok (closed singly connected)";
573 if (pTyp == primitivePatch::OPEN)
576 <<
"ok (non-closed singly connected)";
581 <<
"multiply connected (shared edge)";
592 <<
" conflicting points to set "
622 return noFailedChecks;
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
bool insert(const Key &key)
Insert a new entry.
label size() const
Return number of elements in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
const word & name() const
Return name.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
void size(const label)
Override size to be inconsistent with allocated storage.
label nPoints() const
Return number of points supporting patch faces.
bool checkPointManifold(const bool report=false, labelHashSet *setPtr=nullptr) const
Checks primitivePatch for faces sharing point but not edge.
surfaceTopo surfaceType() const
Calculate surface type formed by patch.
bool checkTopology(const bool report=false, labelHashSet *setPtr=nullptr) const
Check surface formed by patch for manifoldness (see above).
surfaceTopo
Enumeration defining the surface type. Used in check routines.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the UList.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
label size() const
Return the number of elements in the UPtrList.
bool checkDefinition(const bool report=false) const
Check zone definition. Return true if in error.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order. Return.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
A collection of cell labels.
A cell is defined as a list of faces with extra functionality.
const word & name() const
Return const reference to name.
A face is a list of labels corresponding to mesh vertices.
const Time & time() const
Return time.
const word & name() const
Return name.
bool checkDefinition(const bool report=false) const
Check boundary definition. Return true if in error.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order. Return.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const cellZoneList & cellZones() const
Return cell zones.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const fileName & pointsInstance() const
Return the current instance directory for points.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & cellEdges() const
const labelListList & pointCells() const
const labelListList & cellCells() const
label nInternalFaces() const
const labelListList & pointFaces() const
const labelListList & edgeFaces() const
const labelListList & faceEdges() const
const labelListList & edgeCells() const
const cellList & cells() const
virtual bool write(const bool write=true) const
Write using setting from DB.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nRegions() const
Return total number of regions.
Base class for writing coordinate sets with data.
const fvPatchList & patches
Tools for checking the mesh.
Functions for checking mesh topology and geometry.
bool checkFaceFaces(const primitiveMesh &mesh, const bool report=false, labelHashSet *setPtr=nullptr)
Check face-face connectivity.
bool checkUpperTriangular(const primitiveMesh &mesh, const bool report=false, labelHashSet *setPtr=nullptr)
Check face ordering.
bool checkFaceVertices(const primitiveMesh &mesh, const bool report=false, labelHashSet *setPtr=nullptr)
Check uniqueness of face vertices.
void mergeAndWrite(const polyMesh &mesh, const surfaceWriter &setWriter, const word &name, const indirectPrimitivePatch setPatch, const fileName &outputDir)
Generate merged surface on master and write. Needs input patch.
label checkTopology(const polyMesh &mesh, const bool allTopology, const autoPtr< surfaceWriter > &surfWriter, const autoPtr< setWriter > &setWriter)
Check the topology.
bool checkPoints(const primitiveMesh &mesh, const bool report=false, labelHashSet *setPtr=nullptr)
Check for unused points.
bool checkCellsZipUp(const primitiveMesh &mesh, const bool report=false, labelHashSet *setPtr=nullptr)
Check cell zip-up.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
Omanip< int > setw(const int i)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
prefixOSstream Pout(cout, "Pout")