parallel checkMesh

This commit is contained in:
mattijs
2008-10-07 18:24:56 +01:00
parent 69c567167d
commit 0bbc8fd2c4
4 changed files with 141 additions and 61 deletions

View File

@ -39,10 +39,15 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
if (mesh.checkEdgeAlignment(true, validDirs, &nonAlignedPoints)) if (mesh.checkEdgeAlignment(true, validDirs, &nonAlignedPoints))
{ {
noFailedChecks++; noFailedChecks++;
label nNonAligned = returnReduce
(
nonAlignedPoints.size(),
sumOp<label>()
);
if (nonAlignedPoints.size() > 0) if (nNonAligned > 0)
{ {
Pout<< " <<Writing " << nonAlignedPoints.size() Info<< " <<Writing " << nNonAligned
<< " points on non-aligned edges to set " << " points on non-aligned edges to set "
<< nonAlignedPoints.name() << endl; << nonAlignedPoints.name() << endl;
nonAlignedPoints.write(); nonAlignedPoints.write();
@ -59,16 +64,21 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
if (cells.size() > 0) label nNonClosed = returnReduce(cells.size(), sumOp<label>());
if (nNonClosed > 0)
{ {
Pout<< " <<Writing " << cells.size() Info<< " <<Writing " << nNonClosed
<< " non closed cells to set " << cells.name() << endl; << " non closed cells to set " << cells.name() << endl;
cells.write(); cells.write();
} }
} }
if (aspectCells.size() > 0)
label nHighAspect = returnReduce(aspectCells.size(), sumOp<label>());
if (nHighAspect > 0)
{ {
Pout<< " <<Writing " << aspectCells.size() Info<< " <<Writing " << nHighAspect
<< " cells with high aspect ratio to set " << " cells with high aspect ratio to set "
<< aspectCells.name() << endl; << aspectCells.name() << endl;
aspectCells.write(); aspectCells.write();
@ -81,9 +91,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " zero area faces to set " << faces.name() << endl; << " zero area faces to set " << faces.name() << endl;
faces.write(); faces.write();
} }
@ -96,9 +108,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
if (cells.size() > 0) label nCells = returnReduce(cells.size(), sumOp<label>());
if (nCells > 0)
{ {
Pout<< " <<Writing " << cells.size() Info<< " <<Writing " << nCells
<< " zero volume cells to set " << cells.name() << endl; << " zero volume cells to set " << cells.name() << endl;
cells.write(); cells.write();
} }
@ -112,9 +126,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
noFailedChecks++; noFailedChecks++;
} }
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " non-orthogonal faces to set " << faces.name() << endl; << " non-orthogonal faces to set " << faces.name() << endl;
faces.write(); faces.write();
} }
@ -127,9 +143,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " faces with incorrect orientation to set " << " faces with incorrect orientation to set "
<< faces.name() << endl; << faces.name() << endl;
faces.write(); faces.write();
@ -143,9 +161,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " skew faces to set " << faces.name() << endl; << " skew faces to set " << faces.name() << endl;
faces.write(); faces.write();
} }
@ -160,25 +180,29 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
//noFailedChecks++; //noFailedChecks++;
if (points.size() > 0) label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints > 0)
{ {
Pout<< " <<Writing " << points.size() Info<< " <<Writing " << nPoints
<< " points on short edges to set " << points.name() << " points on short edges to set " << points.name()
<< endl; << endl;
points.write(); points.write();
} }
} }
label nEdgeClose = points.size(); label nEdgeClose = returnReduce(points.size(), sumOp<label>());
if (mesh.checkPointNearness(false, minDistSqr, &points)) if (mesh.checkPointNearness(false, minDistSqr, &points))
{ {
//noFailedChecks++; //noFailedChecks++;
if (points.size() > nEdgeClose) label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints > nEdgeClose)
{ {
pointSet nearPoints(mesh, "nearPoints", points); pointSet nearPoints(mesh, "nearPoints", points);
Pout<< " <<Writing " << nearPoints.size() Info<< " <<Writing " << nPoints
<< " near (closer than " << Foam::sqrt(minDistSqr) << " near (closer than " << Foam::sqrt(minDistSqr)
<< " apart) points to set " << nearPoints.name() << endl; << " apart) points to set " << nearPoints.name() << endl;
nearPoints.write(); nearPoints.write();
@ -193,9 +217,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
//noFailedChecks++; //noFailedChecks++;
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " faces with concave angles to set " << faces.name() << " faces with concave angles to set " << faces.name()
<< endl; << endl;
faces.write(); faces.write();
@ -210,9 +236,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
//noFailedChecks++; //noFailedChecks++;
if (faces.size() > 0) label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " warped faces to set " << faces.name() << endl; << " warped faces to set " << faces.name() << endl;
faces.write(); faces.write();
} }
@ -226,7 +254,9 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
{ {
noFailedChecks++; noFailedChecks++;
Pout<< " <<Writing " << cells.size() label nCells = returnReduce(cells.size(), sumOp<label>());
Info<< " <<Writing " << nCells
<< " under-determined cells to set " << cells.name() << endl; << " under-determined cells to set " << cells.name() << endl;
cells.write(); cells.write();
} }

View File

@ -16,7 +16,7 @@ Foam::label Foam::checkTopology
{ {
label noFailedChecks = 0; label noFailedChecks = 0;
Pout<< "Checking topology..." << endl; Info<< "Checking topology..." << endl;
// Check if the boundary definition is unique // Check if the boundary definition is unique
mesh.boundaryMesh().checkDefinition(true); mesh.boundaryMesh().checkDefinition(true);
@ -30,7 +30,9 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
Pout<< " <<Writing " << points.size() label nPoints = returnReduce(points.size(), sumOp<label>());
Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl; << " unused points to set " << points.name() << endl;
points.write(); points.write();
} }
@ -42,9 +44,12 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
} }
if (faces.size() > 0)
label nFaces = returnReduce(faces.size(), sumOp<label>());
if (nFaces > 0)
{ {
Pout<< " <<Writing " << faces.size() Info<< " <<Writing " << nFaces
<< " unordered faces to set " << faces.name() << endl; << " unordered faces to set " << faces.name() << endl;
faces.write(); faces.write();
} }
@ -57,7 +62,9 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
Pout<< " <<Writing " << cells.size() label nCells = returnReduce(cells.size(), sumOp<label>());
Info<< " <<Writing " << nCells
<< " cells with over used edges to set " << cells.name() << " cells with over used edges to set " << cells.name()
<< endl; << endl;
cells.write(); cells.write();
@ -70,7 +77,9 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
Pout<< " <<Writing " << faces.size() label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with out-of-range or duplicate vertices to set " << " faces with out-of-range or duplicate vertices to set "
<< faces.name() << endl; << faces.name() << endl;
faces.write(); faces.write();
@ -84,7 +93,9 @@ Foam::label Foam::checkTopology
{ {
noFailedChecks++; noFailedChecks++;
Pout<< " <<Writing " << faces.size() label nFaces = returnReduce(faces.size(), sumOp<label>());
Info<< " <<Writing " << nFaces
<< " faces with incorrect edges to set " << faces.name() << " faces with incorrect edges to set " << faces.name()
<< endl; << endl;
faces.write(); faces.write();

View File

@ -12,43 +12,72 @@
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
{ {
Pout<< "Mesh stats" << nl Info<< "Mesh stats" << nl
<< " points: " << mesh.points().size() << nl; << " points: "
<< returnReduce(mesh.points().size(), sumOp<label>()) << nl;
if (mesh.nInternalPoints() != -1) label nInternalPoints = returnReduce
(
mesh.nInternalPoints(),
sumOp<label>()
);
if (nInternalPoints != -Pstream::nProcs())
{ {
Pout<< " internal points: " << mesh.nInternalPoints() << nl; 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;
}
} }
if (allTopology && mesh.nInternalPoints() != -1) if (allTopology && nInternalPoints != -Pstream::nProcs())
{ {
Pout<< " edges: " << mesh.nEdges() << nl label nEdges = returnReduce(mesh.nEdges(), sumOp<label>());
<< " internal edges: " << mesh.nInternalEdges() << nl 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
<< " internal edges using one boundary point: " << " internal edges using one boundary point: "
<< mesh.nInternal1Edges()-mesh.nInternal0Edges() << nl << nInternal1Edges-nInternal0Edges << nl
<< " internal edges using two boundary points: " << " internal edges using two boundary points: "
<< mesh.nInternalEdges()-mesh.nInternal1Edges() << nl; << nInternalEdges-nInternal1Edges << nl;
} }
Pout<< " faces: " << mesh.faces().size() << nl Info<< " faces: "
<< " internal faces: " << mesh.faceNeighbour().size() << nl << returnReduce(mesh.faces().size(), sumOp<label>()) << nl
<< " cells: " << mesh.cells().size() << nl << " internal faces: "
<< " boundary patches: " << mesh.boundaryMesh().size() << nl << returnReduce(mesh.faceNeighbour().size(), sumOp<label>()) << nl
<< " point zones: " << mesh.pointZones().size() << nl << " cells: "
<< " face zones: " << mesh.faceZones().size() << nl << returnReduce(mesh.cells().size(), sumOp<label>()) << nl
<< " cell zones: " << mesh.cellZones().size() << nl << " boundary patches: "
<< returnReduce(mesh.boundaryMesh().size(), sumOp<label>()) << nl
<< " point zones: "
<< returnReduce(mesh.pointZones().size(), sumOp<label>()) << nl
<< " face zones: "
<< returnReduce(mesh.faceZones().size(), sumOp<label>()) << nl
<< " cell zones: "
<< returnReduce(mesh.cellZones().size(), sumOp<label>()) << nl
<< endl; << endl;
if (Pstream::parRun())
{
const globalMeshData& parData = mesh.globalData();
Info<< "Overall stats" << nl
<< " points: " << parData.nTotalPoints() << nl
<< " faces: " << parData.nTotalFaces() << nl
<< " cells: " << parData.nTotalCells() << nl
<< endl;
}
// Construct shape recognizers // Construct shape recognizers
hexMatcher hex; hexMatcher hex;
@ -99,7 +128,15 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
} }
} }
Pout<< "Number of cells of each type: " << nl 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
<< " hexahedra: " << nHex << nl << " hexahedra: " << nHex << nl
<< " prisms: " << nPrism << nl << " prisms: " << nPrism << nl
<< " wedges: " << nWedge << nl << " wedges: " << nWedge << nl

View File

@ -552,6 +552,8 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
nextPatchStart += bm[patchI].size(); nextPatchStart += bm[patchI].size();
} }
reduce(boundaryError, orOp<bool>());
if (boundaryError) if (boundaryError)
{ {
if (debug || report) if (debug || report)
@ -565,7 +567,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
{ {
if (debug || report) if (debug || report)
{ {
Pout << " Boundary definition OK." << endl; Info << " Boundary definition OK." << endl;
} }
return false; return false;