BUGFIX: Uninitialised member variables
[foam-extend-3.2.git] / applications / utilities / mesh / manipulation / checkMesh / printMeshStats.C
blob3a98ab61691a35fc310b08746ca72a95ce39d1b6
1 #include "printMeshStats.H"
2 #include "polyMesh.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
16         << "    all points:           "
17         << returnReduce(mesh.allPoints().size(), sumOp<label>()) << nl
18         << "    live points:          "
19         << returnReduce(mesh.points().size(), sumOp<label>()) << nl
20         << "    all faces:            "
21         << returnReduce(mesh.allFaces().size(), sumOp<label>()) << nl
22         << "    live faces:           "
23         << returnReduce(mesh.faces().size(), sumOp<label>()) << nl
24         << "    internal faces:   "
25         << returnReduce(mesh.faceNeighbour().size(), sumOp<label>()) << nl
26         << "    cells:            "
27         << returnReduce(mesh.cells().size(), sumOp<label>()) << nl
28         << "    boundary patches: "
29         << mesh.boundaryMesh().size() << nl
30         << "    point zones:      "
31         << mesh.pointZones().size() << nl
32         << "    face zones:       "
33         << mesh.faceZones().size() << nl
34         << "    cell zones:       "
35         << mesh.cellZones().size() << nl
36         << endl;
39     // Construct shape recognizers
40     hexMatcher hex;
41     prismMatcher prism;
42     wedgeMatcher wedge;
43     pyrMatcher pyr;
44     tetWedgeMatcher tetWedge;
45     tetMatcher tet;
47     // Counters for different cell types
48     label nHex = 0;
49     label nWedge = 0;
50     label nPrism = 0;
51     label nPyr = 0;
52     label nTet = 0;
53     label nTetWedge = 0;
54     label nUnknown = 0;
56     for(label cellI = 0; cellI < mesh.nCells(); cellI++)
57     {
58         if (hex.isA(mesh, cellI))
59         {
60             nHex++;
61         }
62         else if (tet.isA(mesh, cellI))
63         {
64             nTet++;
65         }
66         else if (pyr.isA(mesh, cellI))
67         {
68             nPyr++;
69         }
70         else if (prism.isA(mesh, cellI))
71         {
72             nPrism++;
73         }
74         else if (wedge.isA(mesh, cellI))
75         {
76             nWedge++;
77         }
78         else if (tetWedge.isA(mesh, cellI))
79         {
80             nTetWedge++;
81         }
82         else
83         {
84             nUnknown++;
85         }
86     }
88     reduce(nHex, sumOp<label>());
89     reduce(nPrism, sumOp<label>());
90     reduce(nWedge, sumOp<label>());
91     reduce(nPyr, sumOp<label>());
92     reduce(nTetWedge, sumOp<label>());
93     reduce(nTet, sumOp<label>());
94     reduce(nUnknown, sumOp<label>());
96     Info<< "Overall number of cells of each type:" << nl
97         << "    hexahedra:     " << nHex << nl
98         << "    prisms:        " << nPrism << nl
99         << "    wedges:        " << nWedge << nl
100         << "    pyramids:      " << nPyr << nl
101         << "    tet wedges:    " << nTetWedge << nl
102         << "    tetrahedra:    " << nTet << nl
103         << "    polyhedra:     " << nUnknown
104         << nl << endl;