From 4e57d975f330a1472ac6eb3337e0ebb0b7ca2901 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Jan 2013 11:28:02 +0000 Subject: [PATCH 1/4] 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; } From 0df429453644460cc37be0763965dbd889a4abe9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Jan 2013 12:28:10 +0000 Subject: [PATCH 2/4] STYLE: pointEdgePoint: improved comment --- src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H index d4f4aa062f..5c323b0a3b 100644 --- a/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H +++ b/src/meshTools/algorithms/PointEdgeWave/pointEdgePoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,8 +25,8 @@ Class Foam::pointEdgePoint Description - Holds information regarding nearest wall point. Used in pointEdgeWave. - (so not standard meshWave) + Holds information regarding nearest wall point. Used in PointEdgeWave. + (so not standard FaceCellWave) To be used in wall distance calculation. SourceFiles @@ -116,7 +116,7 @@ public: inline scalar distSqr() const; - // Needed by meshWave + // Needed by PointEdgeWave //- Check whether origin has been changed at all or // still contains original (invalid) value. From 6f2c11175244c233d368906f3f06ef9dd696a217 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Jan 2013 12:33:07 +0000 Subject: [PATCH 3/4] STYLE: pointData: indentation --- .../autoHexMesh/autoHexMeshDriver/pointData/pointData.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C index 75ea3867d1..e3d36bfcb3 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,9 +43,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const pointData& wDist) } } + Foam::Istream& Foam::operator>>(Istream& is, pointData& wDist) { return is >> static_cast(wDist) >> wDist.s_ >> wDist.v_; } + // ************************************************************************* // From b734b860f163e0bdf86cf84ea41bd3aa16a6f4b9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 10 Jan 2013 12:33:46 +0000 Subject: [PATCH 4/4] ENH: meshRefinement: utility functions for checking sync --- .../meshRefinement/meshRefinement.C | 102 +++++++++++++++++- .../meshRefinement/meshRefinement.H | 16 ++- 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 69cdf234cd..04c5786ea6 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.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 @@ -258,6 +258,106 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces) } +void Foam::meshRefinement::testSyncPointList +( + const string& msg, + const polyMesh& mesh, + const List& fld +) +{ + if (fld.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "meshRefinement::testSyncPointList(const polyMesh&" + ", const List&)" + ) << msg << endl + << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints() + << abort(FatalError); + } + + Pout<< "Checking field " << msg << endl; + scalarField minFld(fld); + syncTools::syncPointList + ( + mesh, + minFld, + minEqOp(), + GREAT + ); + scalarField maxFld(fld); + syncTools::syncPointList + ( + mesh, + maxFld, + maxEqOp(), + -GREAT + ); + forAll(minFld, pointI) + { + const scalar& minVal = minFld[pointI]; + const scalar& maxVal = maxFld[pointI]; + if (mag(minVal-maxVal) > SMALL) + { + Pout<< msg << " at:" << mesh.points()[pointI] << nl + << " minFld:" << minVal << nl + << " maxFld:" << maxVal << nl + << endl; + } + } +} + + +void Foam::meshRefinement::testSyncPointList +( + const string& msg, + const polyMesh& mesh, + const List& fld +) +{ + if (fld.size() != mesh.nPoints()) + { + FatalErrorIn + ( + "meshRefinement::testSyncPointList(const polyMesh&" + ", const List&)" + ) << msg << endl + << "fld size:" << fld.size() << " mesh points:" << mesh.nPoints() + << abort(FatalError); + } + + Pout<< "Checking field " << msg << endl; + pointField minFld(fld); + syncTools::syncPointList + ( + mesh, + minFld, + minMagSqrEqOp(), + point(GREAT, GREAT, GREAT) + ); + pointField maxFld(fld); + syncTools::syncPointList + ( + mesh, + maxFld, + maxMagSqrEqOp(), + vector::zero + ); + forAll(minFld, pointI) + { + const point& minVal = minFld[pointI]; + const point& maxVal = maxFld[pointI]; + if (mag(minVal-maxVal) > SMALL) + { + Pout<< msg << " at:" << mesh.points()[pointI] << nl + << " minFld:" << minVal << nl + << " maxFld:" << maxVal << nl + << endl; + } + } +} + + void Foam::meshRefinement::checkData() { Pout<< "meshRefinement::checkData() : Checking refinement structure." diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index c265f05257..899311d909 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -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 @@ -879,6 +879,20 @@ public: //- Debugging: check that all faces still obey start()>end() void checkData(); + static void testSyncPointList + ( + const string& msg, + const polyMesh& mesh, + const List& fld + ); + + static void testSyncPointList + ( + const string& msg, + const polyMesh& mesh, + const List& fld + ); + //- Compare two lists over all boundary faces template void testSyncBoundaryFaceList