From dbbacfbefd82546a57db434a4672a16281e8ee1e Mon Sep 17 00:00:00 2001 From: graham Date: Tue, 21 Dec 2010 15:20:00 +0000 Subject: [PATCH 1/4] ENH: Don't write badFaces when there are none. --- .../utilities/surface/surfaceCheck/surfaceCheck.C | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index 85593d457f..be220dfa2e 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -396,13 +396,17 @@ int main(int argc, char *argv[]) problemFaces.append(faceI); } } - OFstream str("badFaces"); - Info<< "Dumping bad quality faces to " << str.name() << endl - << "Paste this into the input for surfaceSubset" << nl - << nl << endl; + if (!problemFaces.empty()) + { + OFstream str("badFaces"); - str << problemFaces; + Info<< "Dumping bad quality faces to " << str.name() << endl + << "Paste this into the input for surfaceSubset" << nl + << nl << endl; + + str << problemFaces; + } } } From 916e81de98c3e860a4adfe7a3987a7d016194dd7 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 22 Dec 2010 13:43:29 +0000 Subject: [PATCH 2/4] STYLE: Spurious bracket in comment. --- src/lagrangian/basic/Particle/ParticleI.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/basic/Particle/ParticleI.H b/src/lagrangian/basic/Particle/ParticleI.H index cf135b3229..e39931adaa 100644 --- a/src/lagrangian/basic/Particle/ParticleI.H +++ b/src/lagrangian/basic/Particle/ParticleI.H @@ -104,7 +104,7 @@ inline Foam::scalar Foam::Particle::tetLambda if (mag(lambdaNumerator) < SMALL) { // Track starts on the face, and is potentially - // parallel to it. +-SMALL)/+-SMALL is not a good + // parallel to it. +-SMALL/+-SMALL is not a good // comparison, return 0.0, in anticipation of tet // centre correction. From 9552221daf00642333ce6d5a205b535dceb45938 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 22 Dec 2010 14:25:33 +0000 Subject: [PATCH 3/4] STLYE: Making triangle and tetrahedron less verbose. No warnings on recoverable degeneracies. --- .../tetrahedron/tetrahedronI.H | 21 +---- .../primitiveShapes/triangle/triangleI.H | 83 ++----------------- 2 files changed, 12 insertions(+), 92 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index 46a3adaea7..50d787937a 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -156,10 +156,7 @@ inline Point tetrahedron::circumCentre() const if (Foam::mag(denom) < ROOTVSMALL) { - WarningIn("Point tetrahedron::circumCentre() const") - << "Degenerate tetrahedron:" << nl << *this << nl - <<"Returning centre instead of circumCentre." - << endl; + // Degenerate tetrahedron, returning centre instead of circumCentre. return centre(); } @@ -186,10 +183,7 @@ inline scalar tetrahedron::circumRadius() const if (Foam::mag(denom) < ROOTVSMALL) { - WarningIn("Point tetrahedron::circumCentre() const") - << "Degenerate tetrahedron:" << nl << *this << nl - << "Returning GREAT for circumRadius." - << endl; + // Degenerate tetrahedron, returning GREAT for circumRadius. return GREAT; } @@ -269,16 +263,7 @@ scalar tetrahedron::barycentric if (Foam::mag(detT) < SMALL) { - WarningIn - ( - "List tetrahedron::barycentric" - "(" - "const point& pt" - ") const" - ) - << "Degenerate tetrahedron:" << nl << *this << nl - << "Returning 1/4 barycentric coordinates." - << endl; + // Degenerate tetrahedron, returning 1/4 barycentric coordinates. bary = List(4, 0.25); diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index b99ba990cd..1145e403a6 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -121,10 +121,7 @@ inline Point triangle::circumCentre() const if (Foam::mag(c) < ROOTVSMALL) { - WarningIn("Point triangle::circumCentre() const") - << "Degenerate triangle:" << nl << *this << nl - << "Returning centre instead of circumCentre." - << endl; + // Degenerate triangle, returning centre instead of circumCentre. return centre(); } @@ -147,10 +144,7 @@ inline scalar triangle::circumRadius() const if (Foam::mag(denom) < VSMALL) { - WarningIn("scalar triangle::circumRadius() const") - << "Degenerate triangle:" << nl << *this << nl - << "Returning GREAT for circumRadius." - << endl; + // Degenerate triangle, returning GREAT for circumRadius. return GREAT; } @@ -263,16 +257,7 @@ scalar triangle::barycentric if (Foam::mag(denom) < SMALL) { - WarningIn - ( - "List triangle::barycentric" - "(" - "const point& pt" - ") const" - ) - << "Degenerate triangle:" << nl << *this << nl - << "Returning 1/3 barycentric coordinates." - << endl; + // Degenerate triangle, returning 1/3 barycentric coordinates. bary = List(3, 1.0/3.0); @@ -537,20 +522,7 @@ pointHit triangle::nearestPointClassify { if ((d1 - d3) < ROOTVSMALL) { - WarningIn - ( - "pointHit triangle::nearestPointClassify" - "(" - "const point& p," - "label& nearType," - "label& nearLabel" - ") const" - ) - << "Degenerate triangle:" << nl << *this << nl - << "d1, d3: " << d1 << ", " << d3 << endl; - - // For d1 = d3, a_ and b_ are likely coincident. - + // Degenerate triangle, for d1 = d3, a_ and b_ are likely coincident nearType = POINT; nearLabel = 0; return pointHit(false, a_, Foam::mag(a_ - p), true); @@ -586,20 +558,7 @@ pointHit triangle::nearestPointClassify { if ((d2 - d6) < ROOTVSMALL) { - WarningIn - ( - "pointHit triangle::nearestPointClassify" - "(" - "const point& p," - "label& nearType," - "label& nearLabel" - ") const" - ) - << "Degenerate triangle:" << nl << *this << nl - << "d2, d6: " << d2 << ", " << d6 << endl; - - // For d2 = d6, a_ and c_ are likely coincident. - + // Degenerate triangle, for d2 = d6, a_ and c_ are likely coincident nearType = POINT; nearLabel = 0; return pointHit(false, a_, Foam::mag(a_ - p), true); @@ -621,21 +580,8 @@ pointHit triangle::nearestPointClassify { if (((d4 - d3) + (d5 - d6)) < ROOTVSMALL) { - WarningIn - ( - "pointHit triangle::nearestPointClassify" - "(" - "const point& p," - "label& nearType," - "label& nearLabel" - ") const" - ) - << "Degenerate triangle:" << nl << *this << nl - << "(d4 - d3), (d6 - d5): " << (d4 - d3) << ", " << (d6 - d5) - << endl; - - // For (d4 - d3) = (d6 - d5), b_ and c_ are likely coincident. - + // Degenerate triangle, for (d4 - d3) = (d6 - d5), b_ and c_ are + // likely coincident nearType = POINT; nearLabel = 1; return pointHit(false, b_, Foam::mag(b_ - p), true); @@ -655,19 +601,8 @@ pointHit triangle::nearestPointClassify if ((va + vb + vc) < ROOTVSMALL) { - WarningIn - ( - "pointHit triangle::nearestPointClassify" - "(" - "const point& p," - "label& nearType," - "label& nearLabel" - ") const" - ) - << "Degenerate triangle:" << nl << *this << nl - << "va, vb, vc: " << va << ", " << vb << ", " << vc - << endl; - + // Degenerate triangle, return the centre because no edge or points are + // closest point nearPt = centre(); nearType = NONE, nearLabel = -1; From 57e616312b6574c550827c230cf6fee797b3e83b Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 22 Dec 2010 17:13:42 +0000 Subject: [PATCH 4/4] STYLE: Comment fix. --- .../functionObjects/field/streamLine/streamLineParticle.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C index e14b11200b..5388f8a2a0 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C @@ -51,7 +51,7 @@ Foam::scalar Foam::streamLineParticle::calcSubCycleDeltaT scalar fraction = testParticle.trackToFace(position()+dt*U, td); td.keepParticle = oldKeepParticle; td.switchProcessor = oldSwitchProcessor; - // Adapt the dt to subdivide the trajectory into 4 substeps. + // Adapt the dt to subdivide the trajectory into substeps. return dt*fraction/td.nSubCycle_; }