diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 6b1a10d90e6f7e1b771a7672e0f5bafdd28bc800..8eb1f3f05fbb1a92ef5c889418e0741796e7dd72 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -39,10 +39,15 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) if (mesh.checkEdgeAlignment(true, validDirs, &nonAlignedPoints)) { 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 " << nonAlignedPoints.name() << endl; nonAlignedPoints.write(); @@ -59,16 +64,21 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { 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; 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 " << aspectCells.name() << endl; aspectCells.write(); @@ -81,9 +91,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { 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; faces.write(); } @@ -96,9 +108,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { 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; cells.write(); } @@ -112,9 +126,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) 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; faces.write(); } @@ -127,9 +143,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { 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.name() << endl; faces.write(); @@ -143,9 +161,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { 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; faces.write(); } @@ -160,25 +180,29 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { //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() << endl; points.write(); } } - label nEdgeClose = points.size(); + label nEdgeClose = returnReduce(points.size(), sumOp<label>()); if (mesh.checkPointNearness(false, minDistSqr, &points)) { //noFailedChecks++; - if (points.size() > nEdgeClose) + label nPoints = returnReduce(points.size(), sumOp<label>()); + + if (nPoints > nEdgeClose) { pointSet nearPoints(mesh, "nearPoints", points); - Pout<< " <<Writing " << nearPoints.size() + Info<< " <<Writing " << nPoints << " near (closer than " << Foam::sqrt(minDistSqr) << " apart) points to set " << nearPoints.name() << endl; nearPoints.write(); @@ -193,9 +217,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { //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() << endl; faces.write(); @@ -210,9 +236,11 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { //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; faces.write(); } @@ -226,7 +254,9 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) { noFailedChecks++; - Pout<< " <<Writing " << cells.size() + label nCells = returnReduce(cells.size(), sumOp<label>()); + + Info<< " <<Writing " << nCells << " under-determined cells to set " << cells.name() << endl; cells.write(); } diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 85dc0bae62720f8bf7f8fd1219624cc176c29289..ac924136e1cf104e13e9a1fdc861e9ad6ba9c911 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -16,7 +16,7 @@ Foam::label Foam::checkTopology { label noFailedChecks = 0; - Pout<< "Checking topology..." << endl; + Info<< "Checking topology..." << endl; // Check if the boundary definition is unique mesh.boundaryMesh().checkDefinition(true); @@ -30,7 +30,9 @@ Foam::label Foam::checkTopology { noFailedChecks++; - Pout<< " <<Writing " << points.size() + label nPoints = returnReduce(points.size(), sumOp<label>()); + + Info<< " <<Writing " << nPoints << " unused points to set " << points.name() << endl; points.write(); } @@ -42,9 +44,12 @@ Foam::label Foam::checkTopology { 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; faces.write(); } @@ -57,7 +62,9 @@ Foam::label Foam::checkTopology { noFailedChecks++; - Pout<< " <<Writing " << cells.size() + label nCells = returnReduce(cells.size(), sumOp<label>()); + + Info<< " <<Writing " << nCells << " cells with over used edges to set " << cells.name() << endl; cells.write(); @@ -70,7 +77,9 @@ Foam::label Foam::checkTopology { 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.name() << endl; faces.write(); @@ -84,7 +93,9 @@ Foam::label Foam::checkTopology { noFailedChecks++; - Pout<< " <<Writing " << faces.size() + label nFaces = returnReduce(faces.size(), sumOp<label>()); + + Info<< " <<Writing " << nFaces << " faces with incorrect edges to set " << faces.name() << endl; faces.write(); diff --git a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C index 9c608b689d7958ba94344a5208124cdafcc2d3c2..9a2c9396afba0a645483f86eec3d65239372cb43 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C +++ b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C @@ -12,43 +12,72 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) { - Pout<< "Mesh stats" << nl - << " points: " << mesh.points().size() << nl; + Info<< "Mesh stats" << 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 - << " internal edges: " << mesh.nInternalEdges() << nl + 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 << " internal edges using one boundary point: " - << mesh.nInternal1Edges()-mesh.nInternal0Edges() << nl + << nInternal1Edges-nInternal0Edges << nl << " internal edges using two boundary points: " - << mesh.nInternalEdges()-mesh.nInternal1Edges() << nl; + << nInternalEdges-nInternal1Edges << nl; } - Pout<< " faces: " << mesh.faces().size() << nl - << " internal faces: " << mesh.faceNeighbour().size() << nl - << " cells: " << mesh.cells().size() << 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 + 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: " + << 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; - 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 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 << " prisms: " << nPrism << nl << " wedges: " << nWedge << nl diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index a74458fe9fce68936ec738ba775192f3f883fc5d..e7d7567a138da742b2eb21630b1b0866aad718ad 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -552,6 +552,8 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const nextPatchStart += bm[patchI].size(); } + reduce(boundaryError, orOp<bool>()); + if (boundaryError) { if (debug || report) @@ -565,7 +567,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const { if (debug || report) { - Pout << " Boundary definition OK." << endl; + Info << " Boundary definition OK." << endl; } return false;