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."
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;
136 if (surfWriter.
valid())
143 Info<<
" Cell to face addressing OK." <<
endl;
159 <<
" unused points to set " <<
points.name() <<
endl;
183 Info<<
" <<Writing " << nFaces
184 <<
" unordered faces to set " << faces.
name() <<
endl;
189 if (surfWriter.
valid())
206 Info<<
" <<Writing " << nFaces
207 <<
" faces with out-of-range or duplicate vertices to set "
213 if (surfWriter.
valid())
231 Info<<
" <<Writing " << nCells
232 <<
" cells with over used edges to set " <<
cells.name()
238 if (surfWriter.
valid())
258 Info<<
" <<Writing " << nFaces
259 <<
" faces with non-standard edge connectivity to set "
265 if (surfWriter.
valid())
290 nInternalFaces[owners[i]]++;
298 forAll(nInternalFaces, celli)
300 if (nInternalFaces[celli] <= 1)
304 else if (nInternalFaces[celli] == 2)
316 Info<<
" <<Writing " << nOneCells
317 <<
" cells with zero or one non-boundary face to set "
324 if (surfWriter.
valid())
336 Info<<
" <<Writing " << nTwoCells
337 <<
" cells with two non-boundary faces to set "
344 if (surfWriter.
valid())
356 Info<<
" Number of regions: " << rs.
nRegions() <<
" (OK)."
364 Info<<
" The mesh has multiple regions which are not connected "
365 "by any face." <<
endl;
369 Info<<
" <<Writing region information to "
418 label& pRegion = pointToRegion[
f[fp]];
423 else if (pRegion == -2)
426 regionDisconnected[regionI] =
false;
428 else if (pRegion != regionI)
431 regionDisconnected[regionI] =
false;
432 regionDisconnected[pRegion] =
false;
439 Pstream::listCombineGather
444 Pstream::listCombineScatter(regionDisconnected);
464 cellRegions[rs[i]].insert(i);
469 Info<<
" <<Writing region " << i;
471 if (regionDisconnected[i])
473 Info<<
" (fully disconnected)";
477 Info<<
" (point connected)";
482 <<
" cells to cellSet " << cellRegions[i].name()
486 cellRegions[i].write();
493 <<
" points that are in multiple regions to set "
509 if (!Pstream::parRun())
511 Info<<
"\nChecking patch topology for multiply connected"
512 <<
" surfaces..." <<
endl;
516 Info<<
"\nChecking basic patch addressing..." <<
endl;
533 <<
setw(20) <<
"Patch"
534 <<
setw(9) <<
"Faces"
535 <<
setw(9) <<
"Points";
536 if (!Pstream::parRun())
538 Info<<
setw(34) <<
"Surface topology";
546 if (!isA<processorPolyPatch>(pp))
553 if (!Pstream::parRun())
561 else if (pTyp == primitivePatch::MANIFOLD)
566 <<
"multiply connected (shared point)";
570 Info<<
setw(34) <<
"ok (closed singly connected)";
580 if (pTyp == primitivePatch::OPEN)
583 <<
"ok (non-closed singly connected)";
588 <<
"multiply connected (shared edge)";
599 <<
" conflicting points to set "
629 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 the top-level database.
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
label nInternalFaces() const
const labelListList & cellCells() 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.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
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.
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
prefixOSstream Pout(cout, "Pout")