ENH: checkMesh: Add output for the average number of faces per cell

Works in parallel
This commit is contained in:
laurence
2012-01-30 15:36:30 +00:00
parent ac40a2f68d
commit a84661c204

View File

@ -8,6 +8,7 @@
#include "pyrMatcher.H" #include "pyrMatcher.H"
#include "tetWedgeMatcher.H" #include "tetWedgeMatcher.H"
#include "tetMatcher.H" #include "tetMatcher.H"
#include "IOmanip.H"
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
@ -62,22 +63,19 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
<< nInternalEdges-nInternal1Edges << nl; << nInternalEdges-nInternal1Edges << nl;
} }
Info<< " faces: " label nFaces = returnReduce(mesh.faces().size(), sumOp<label>());
<< returnReduce(mesh.faces().size(), sumOp<label>()) << nl label nIntFaces = returnReduce(mesh.faceNeighbour().size(), sumOp<label>());
<< " internal faces: " label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
<< returnReduce(mesh.faceNeighbour().size(), sumOp<label>()) << nl
<< " cells: "
<< returnReduce(mesh.cells().size(), sumOp<label>()) << nl
<< " boundary patches: "
<< mesh.boundaryMesh().size() << nl
<< " point zones: "
<< mesh.pointZones().size() << nl
<< " face zones: "
<< mesh.faceZones().size() << nl
<< " cell zones: "
<< mesh.cellZones().size() << nl
<< endl;
Info<< " faces: " << nFaces << nl
<< " internal faces: " << nIntFaces << nl
<< " cells: " << nCells << nl
<< " faces per cell: " << scalar(nFaces + nIntFaces)/nCells << nl
<< " boundary patches: " << mesh.boundaryMesh().size() << nl
<< " point zones: " << mesh.pointZones().size() << nl
<< " face zones: " << mesh.faceZones().size() << nl
<< " cell zones: " << mesh.cellZones().size() << nl
<< endl;
// Construct shape recognizers // Construct shape recognizers
hexMatcher hex; hexMatcher hex;
@ -96,6 +94,8 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
label nTetWedge = 0; label nTetWedge = 0;
label nUnknown = 0; label nUnknown = 0;
Map<label> polyhedralFaces;
for (label cellI = 0; cellI < mesh.nCells(); cellI++) for (label cellI = 0; cellI < mesh.nCells(); cellI++)
{ {
if (hex.isA(mesh, cellI)) if (hex.isA(mesh, cellI))
@ -125,6 +125,7 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
else else
{ {
nUnknown++; nUnknown++;
polyhedralFaces(mesh.cells()[cellI].size())++;
} }
} }
@ -144,5 +145,21 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
<< " tet wedges: " << nTetWedge << nl << " tet wedges: " << nTetWedge << nl
<< " tetrahedra: " << nTet << nl << " tetrahedra: " << nTet << nl
<< " polyhedra: " << nUnknown << " polyhedra: " << nUnknown
<< nl << endl; << endl;
if (nUnknown > 0)
{
Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
Info<< " Breakdown of polyhedra by number of faces:" << endl;
Info<< " faces" << " number of cells" << endl;
forAllConstIter(Map<label>, polyhedralFaces, iter)
{
Info<< setf(std::ios::right) << setw(13)
<< iter.key() << " " << iter() << nl;
}
}
Info<< endl;
} }