From f94c0c38d38a25eb0fd28dc0405d60f7dfdcaa76 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 23 Jul 2018 12:54:41 +0100 Subject: [PATCH] ENH: snappyHexMesh: limit warnings to 100 points. Fixes #941. --- .../snapParameters/snapParameters.H | 4 -- .../snappyHexMeshDriver/snappySnapDriver.C | 23 +++++--- .../snappySnapDriverFeature.C | 54 ++++++++++++++++--- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snapParameters/snapParameters.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snapParameters/snapParameters.H index c81b889999..18aca4d8c7 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snapParameters/snapParameters.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snapParameters/snapParameters.H @@ -233,10 +233,6 @@ public: { return minAreaRatio_; } - - - - }; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C index e25b4185fa..a00e780401 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriver.C @@ -2015,12 +2015,23 @@ Foam::vectorField Foam::snappySnapDriver::calcNearestSurface { if (snapSurf[pointi] == -1) { - WarningInFunction - << "For point:" << pointi - << " coordinate:" << localPoints[pointi] - << " did not find any surface within:" - << minSnapDist[pointi] - << " metre." << endl; + static label nWarn = 0; + + if (nWarn < 100) + { + WarningInFunction + << "For point:" << pointi + << " coordinate:" << localPoints[pointi] + << " did not find any surface within:" + << minSnapDist[pointi] << " metre." << endl; + nWarn++; + if (nWarn == 100) + { + WarningInFunction + << "Reached warning limit " << nWarn + << ". Suppressing further warnings." << endl; + } + } } } diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C index e7f391fdc4..7f7a3ac556 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappySnapDriverFeature.C @@ -328,9 +328,21 @@ void Foam::snappySnapDriver::calcNearestFace } else { - WarningInFunction - << "Did not find surface near face centre " << fc[hiti] + static label nWarn = 0; + + if (nWarn < 100) + { + WarningInFunction + << "Did not find surface near face centre " << fc[hiti] << endl; + nWarn++; + if (nWarn == 100) + { + WarningInFunction + << "Reached warning limit " << nWarn + << ". Suppressing further warnings." << endl; + } + } } } } @@ -392,9 +404,22 @@ void Foam::snappySnapDriver::calcNearestFace } else { - WarningInFunction - << "Did not find surface near face centre " << fc[hiti] - << endl; + static label nWarn = 0; + + if (nWarn < 100) + { + WarningInFunction + << "Did not find surface near face centre " << fc[hiti] + << endl; + + nWarn++; + if (nWarn == 100) + { + WarningInFunction + << "Reached warning limit " << nWarn + << ". Suppressing further warnings." << endl; + } + } } } @@ -3283,9 +3308,22 @@ void Foam::snappySnapDriver::reverseAttractMeshPoints } else { - WarningInFunction - << "Did not find pp point near " << featPt - << endl; + static label nWarn = 0; + + if (nWarn < 100) + { + WarningInFunction + << "Did not find pp point near " << featPt + << endl; + nWarn++; + if (nWarn == 100) + { + WarningInFunction + << "Reached warning limit " << nWarn + << ". Suppressing further warnings." << endl; + } + } + } } } -- GitLab