2010-05-12 13:27:55 +00:00
|
|
|
#include "printMeshStats.H"
|
|
|
|
#include "polyMesh.H"
|
|
|
|
#include "globalMeshData.H"
|
|
|
|
|
|
|
|
#include "hexMatcher.H"
|
|
|
|
#include "wedgeMatcher.H"
|
|
|
|
#include "prismMatcher.H"
|
|
|
|
#include "pyrMatcher.H"
|
|
|
|
#include "tetWedgeMatcher.H"
|
|
|
|
#include "tetMatcher.H"
|
|
|
|
|
|
|
|
|
|
|
|
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
|
|
|
{
|
2010-08-25 21:42:57 +00:00
|
|
|
Info<< "Mesh stats" << nl
|
|
|
|
<< " points: "
|
|
|
|
<< returnReduce(mesh.points().size(), sumOp<label>()) << nl;
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2010-08-25 21:42:57 +00:00
|
|
|
label nInternalPoints = returnReduce
|
|
|
|
(
|
|
|
|
mesh.nInternalPoints(),
|
|
|
|
sumOp<label>()
|
|
|
|
);
|
|
|
|
|
|
|
|
if (nInternalPoints != -Pstream::nProcs())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-08-25 21:42:57 +00:00
|
|
|
Info<< " internal points: " << nInternalPoints << nl;
|
|
|
|
|
|
|
|
if (returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1)
|
|
|
|
{
|
|
|
|
WarningIn("Foam::printMeshStats(const polyMesh&, const bool)")
|
|
|
|
<< "Some processors have their points sorted into internal"
|
|
|
|
<< " and external and some do not." << endl
|
|
|
|
<< "This can cause problems later on." << endl;
|
|
|
|
}
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-08-25 21:42:57 +00:00
|
|
|
if (allTopology && nInternalPoints != -Pstream::nProcs())
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
2010-08-25 21:42:57 +00:00
|
|
|
label nEdges = returnReduce(mesh.nEdges(), sumOp<label>());
|
|
|
|
label nInternalEdges = returnReduce
|
|
|
|
(
|
|
|
|
mesh.nInternalEdges(),
|
|
|
|
sumOp<label>()
|
|
|
|
);
|
|
|
|
label nInternal1Edges = returnReduce
|
|
|
|
(
|
|
|
|
mesh.nInternal1Edges(),
|
|
|
|
sumOp<label>()
|
|
|
|
);
|
|
|
|
label nInternal0Edges = returnReduce
|
|
|
|
(
|
|
|
|
mesh.nInternal0Edges(),
|
|
|
|
sumOp<label>()
|
|
|
|
);
|
|
|
|
|
|
|
|
Info<< " edges: " << nEdges << nl
|
|
|
|
<< " internal edges: " << nInternalEdges << nl
|
2010-05-12 13:27:55 +00:00
|
|
|
<< " internal edges using one boundary point: "
|
2010-08-25 21:42:57 +00:00
|
|
|
<< nInternal1Edges-nInternal0Edges << nl
|
2010-05-12 13:27:55 +00:00
|
|
|
<< " internal edges using two boundary points: "
|
2010-08-25 21:42:57 +00:00
|
|
|
<< nInternalEdges-nInternal1Edges << nl;
|
2010-05-12 13:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-08-25 21:42:57 +00:00
|
|
|
Info<< " faces: "
|
|
|
|
<< returnReduce(mesh.faces().size(), sumOp<label>()) << nl
|
|
|
|
<< " internal faces: "
|
|
|
|
<< 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
|
2010-05-12 13:27:55 +00:00
|
|
|
<< endl;
|
|
|
|
|
|
|
|
|
|
|
|
// Construct shape recognizers
|
|
|
|
hexMatcher hex;
|
|
|
|
prismMatcher prism;
|
|
|
|
wedgeMatcher wedge;
|
|
|
|
pyrMatcher pyr;
|
|
|
|
tetWedgeMatcher tetWedge;
|
|
|
|
tetMatcher tet;
|
|
|
|
|
|
|
|
// Counters for different cell types
|
|
|
|
label nHex = 0;
|
|
|
|
label nWedge = 0;
|
|
|
|
label nPrism = 0;
|
|
|
|
label nPyr = 0;
|
|
|
|
label nTet = 0;
|
|
|
|
label nTetWedge = 0;
|
|
|
|
label nUnknown = 0;
|
|
|
|
|
|
|
|
for(label cellI = 0; cellI < mesh.nCells(); cellI++)
|
|
|
|
{
|
|
|
|
if (hex.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nHex++;
|
|
|
|
}
|
|
|
|
else if (tet.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nTet++;
|
|
|
|
}
|
|
|
|
else if (pyr.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nPyr++;
|
|
|
|
}
|
|
|
|
else if (prism.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nPrism++;
|
|
|
|
}
|
|
|
|
else if (wedge.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nWedge++;
|
|
|
|
}
|
|
|
|
else if (tetWedge.isA(mesh, cellI))
|
|
|
|
{
|
|
|
|
nTetWedge++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nUnknown++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-25 21:42:57 +00:00
|
|
|
reduce(nHex,sumOp<label>());
|
|
|
|
reduce(nPrism,sumOp<label>());
|
|
|
|
reduce(nWedge,sumOp<label>());
|
|
|
|
reduce(nPyr,sumOp<label>());
|
|
|
|
reduce(nTetWedge,sumOp<label>());
|
|
|
|
reduce(nTet,sumOp<label>());
|
|
|
|
reduce(nUnknown,sumOp<label>());
|
|
|
|
|
|
|
|
Info<< "Overall number of cells of each type:" << nl
|
2010-05-12 13:27:55 +00:00
|
|
|
<< " hexahedra: " << nHex << nl
|
|
|
|
<< " prisms: " << nPrism << nl
|
|
|
|
<< " wedges: " << nWedge << nl
|
|
|
|
<< " pyramids: " << nPyr << nl
|
|
|
|
<< " tet wedges: " << nTetWedge << nl
|
|
|
|
<< " tetrahedra: " << nTet << nl
|
|
|
|
<< " polyhedra: " << nUnknown
|
|
|
|
<< nl << endl;
|
|
|
|
}
|