diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 50ff6918b0..57f892b8e4 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