1 #include "printMeshStats.H"
3 #include "globalMeshData.H"
5 #include "hexMatcher.H"
6 #include "wedgeMatcher.H"
7 #include "prismMatcher.H"
8 #include "pyrMatcher.H"
9 #include "tetWedgeMatcher.H"
10 #include "tetMatcher.H"
13 void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
15 Info<< "Mesh stats" << nl
17 << returnReduce(mesh.points().size(), sumOp<label>()) << nl;
19 label nInternalPoints = returnReduce
21 mesh.nInternalPoints(),
25 if (nInternalPoints != -Pstream::nProcs())
27 Info<< " internal points: " << nInternalPoints << nl;
29 if (returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
31 WarningIn("Foam::printMeshStats(const polyMesh&, const bool)")
32 << "Some processors have their points sorted into internal"
33 << " and external and some do not." << endl
34 << "This can cause problems later on." << endl;
38 if (allTopology && nInternalPoints != -Pstream::nProcs())
40 label nEdges = returnReduce(mesh.nEdges(), sumOp<label>());
41 label nInternalEdges = returnReduce
43 mesh.nInternalEdges(),
46 label nInternal1Edges = returnReduce
48 mesh.nInternal1Edges(),
51 label nInternal0Edges = returnReduce
53 mesh.nInternal0Edges(),
57 Info<< " edges: " << nEdges << nl
58 << " internal edges: " << nInternalEdges << nl
59 << " internal edges using one boundary point: "
60 << nInternal1Edges-nInternal0Edges << nl
61 << " internal edges using two boundary points: "
62 << nInternalEdges-nInternal1Edges << nl;
66 << returnReduce(mesh.faces().size(), sumOp<label>()) << nl
67 << " internal faces: "
68 << returnReduce(mesh.faceNeighbour().size(), sumOp<label>()) << nl
70 << returnReduce(mesh.cells().size(), sumOp<label>()) << nl
71 << " boundary patches: "
72 << mesh.boundaryMesh().size() << nl
74 << mesh.pointZones().size() << nl
76 << mesh.faceZones().size() << nl
78 << mesh.cellZones().size() << nl
82 // Construct shape recognizers
87 tetWedgeMatcher tetWedge;
90 // Counters for different cell types
99 for(label cellI = 0; cellI < mesh.nCells(); cellI++)
101 if (hex.isA(mesh, cellI))
105 else if (tet.isA(mesh, cellI))
109 else if (pyr.isA(mesh, cellI))
113 else if (prism.isA(mesh, cellI))
117 else if (wedge.isA(mesh, cellI))
121 else if (tetWedge.isA(mesh, cellI))
131 reduce(nHex,sumOp<label>());
132 reduce(nPrism,sumOp<label>());
133 reduce(nWedge,sumOp<label>());
134 reduce(nPyr,sumOp<label>());
135 reduce(nTetWedge,sumOp<label>());
136 reduce(nTet,sumOp<label>());
137 reduce(nUnknown,sumOp<label>());
139 Info<< "Overall number of cells of each type:" << nl
140 << " hexahedra: " << nHex << nl
141 << " prisms: " << nPrism << nl
142 << " wedges: " << nWedge << nl
143 << " pyramids: " << nPyr << nl
144 << " tet wedges: " << nTetWedge << nl
145 << " tetrahedra: " << nTet << nl
146 << " polyhedra: " << nUnknown