From 28eb349a30ab0d8d5aa9da56a816d6583806f659 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 6 Jan 2020 11:22:34 +0000 Subject: [PATCH] BUG: checkMesh: handling of unsorted points. Fixes #920. --- .../mesh/manipulation/checkMesh/checkTools.C | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 16ddeb96165..72512b5e8cd 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015-2017 OpenFOAM Foundation - Copyright (C) 2015-2018 OpenCFD Ltd. + Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,26 +54,30 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) << " points: " << returnReduce(mesh.points().size(), sumOp<label>()) << nl; - label nInternalPoints = returnReduce - ( - mesh.nInternalPoints(), - sumOp<label>() - ); + // Count number of internal points (-1 if not sorted; 0 if no internal + // points) + const label minInt = returnReduce(mesh.nInternalPoints(), minOp<label>()); + const label maxInt = returnReduce(mesh.nInternalPoints(), maxOp<label>()); - if (nInternalPoints != -Pstream::nProcs()) + if (minInt == -1 && maxInt > 0) { + WarningInFunction + << "Some processors have their points sorted into internal" + << " and external and some do not." << endl + << " This can cause problems later on." << endl; + } + else if (minInt != -1) + { + // Assume all sorted + label nInternalPoints = returnReduce + ( + mesh.nInternalPoints(), + sumOp<label>() + ); Info<< " internal points: " << nInternalPoints << nl; - - if (returnReduce(mesh.nInternalPoints(), minOp<label>()) == -1) - { - WarningInFunction - << "Some processors have their points sorted into internal" - << " and external and some do not." << endl - << "This can cause problems later on." << endl; - } } - if (allTopology && nInternalPoints != -Pstream::nProcs()) + if (allTopology && (minInt != -1)) { label nEdges = returnReduce(mesh.nEdges(), sumOp<label>()); label nInternalEdges = returnReduce -- GitLab