From e3f20df12f5b5b9dbccc10d81ecf69d2c1734bb6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 23 Jul 2010 12:06:42 +0100 Subject: [PATCH 1/5] ENH: checkMesh : wedge & empty checking improved - aspect ratio and cellDeterminant do not use 3rd direction - wedges are properly check for having opposite one --- .../manipulation/checkMesh/checkGeometry.C | 282 +++++++++++++++++- .../manipulation/checkMesh/checkGeometry.H | 13 + .../mesh/manipulation/checkMesh/checkMesh.C | 2 +- .../meshes/primitiveMesh/primitiveMesh.C | 2 +- .../meshes/primitiveMesh/primitiveMesh.H | 8 +- .../primitiveMeshCheck/primitiveMeshCheck.C | 164 +++++++--- 6 files changed, 415 insertions(+), 56 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 50ff6918b0..4a7a7628b7 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -1,10 +1,265 @@ #include "checkGeometry.H" #include "polyMesh.H" -#include "globalMeshData.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" #include "EdgeMap.H" +#include "wedgePolyPatch.H" +#include "unitConversion.H" + + +// Find wedge with opposite orientation. Note: does not actually check that +// it is opposite, only that it has opposite normal and same axis +Foam::label Foam::findOppositeWedge +( + const polyMesh& mesh, + const wedgePolyPatch& wpp +) +{ + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + scalar wppCosAngle = wpp.centreNormal()&wpp.patchNormal(); + + forAll(patches, patchI) + { + if + ( + patchI != wpp.index() + && patches[patchI].size() + && isA(patches[patchI]) + ) + { + const wedgePolyPatch& pp = refCast + ( + patches[patchI] + ); + + // Calculate (cos of) angle to wpp (not pp!) centre normal + scalar ppCosAngle = wpp.centreNormal()&pp.patchNormal(); + + if + ( + pp.size() == wpp.size() + && mag(pp.axis() & wpp.axis()) >= (1-1E-3) + && mag(ppCosAngle - wppCosAngle) >= 1E-3 + ) + { + return patchI; + } + } + } + return -1; +} + + +bool Foam::checkWedges +( + const polyMesh& mesh, + const bool report, + const Vector