From 4e57d975f330a1472ac6eb3337e0ebb0b7ca2901 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Jan 2013 11:28:02 +0000 Subject: [PATCH] ENH: polyMeshTetDecomposition: suppress excessive amount of warnings --- .../polyMeshTetDecomposition.C | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C index ef697325b6..df95c96818 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -538,6 +538,9 @@ Foam::List Foam::polyMeshTetDecomposition::faceTetIndices label cI ) { + static label nWarnings = 0; + static const label maxWarnings = 100; + const faceList& pFaces = mesh.faces(); const labelList& pOwner = mesh.faceOwner(); @@ -553,19 +556,27 @@ Foam::List Foam::polyMeshTetDecomposition::faceTetIndices if (tetBasePtI == -1) { - WarningIn - ( - "Foam::List " - "Foam::polyMeshTetDecomposition::faceTetIndices" - "(" - "const polyMesh&, " - "label, " - "label" - ")" - ) - << "No base point for face " << fI << ", " << f - << ", produces a valid tet decomposition." - << endl; + if (nWarnings < maxWarnings) + { + WarningIn + ( + "Foam::List " + "Foam::polyMeshTetDecomposition::faceTetIndices" + "(" + "const polyMesh&, " + "label, " + "label" + ")" + ) << "No base point for face " << fI << ", " << f + << ", produces a valid tet decomposition." + << endl; + nWarnings++; + } + if (nWarnings == maxWarnings) + { + Warning<< "Suppressing any further warnings." << endl; + nWarnings++; + } tetBasePtI = 0; }