From c90e6ed48c9bf6f88c5b74a3b367e6125586f5ce Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 31 Oct 2016 15:41:34 +0000 Subject: [PATCH] ENH: surfaceCheck: additional printing. Additional self-intersect test with reverse ray --- .../surface/surfaceCheck/surfaceCheck.C | 93 ++++++++++++++++--- 1 file changed, 78 insertions(+), 15 deletions(-) diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index ca2320a434..94804ea24c 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -795,6 +795,12 @@ int main(int argc, char *argv[]) Info<< "Splitting surface into parts ..." << endl << endl; writeZoning(surf, faceZone, "zone", surfFilePath, surfFileNameBase); + + if (numZones > outputThreshold) + { + Info<< "Limiting number of files to " << outputThreshold + << endl; + } writeParts ( surf, @@ -849,6 +855,12 @@ int main(int argc, char *argv[]) surfFilePath, surfFileNameBase ); + + if (numNormalZones > outputThreshold) + { + Info<< "Limiting number of files to " << outputThreshold + << endl; + } writeParts ( surf, @@ -885,28 +897,79 @@ int main(int argc, char *argv[]) forAll(surf.edges(), edgeI) { const edge& e = surf.edges()[edgeI]; + const point& start = surf.points()[surf.meshPoints()[e[0]]]; + const point& end = surf.points()[surf.meshPoints()[e[1]]]; - pointIndexHit hitInfo - ( - tree.findLine - ( - surf.points()[surf.meshPoints()[e[0]]], - surf.points()[surf.meshPoints()[e[1]]], - treeDataTriSurface::findSelfIntersectOp - ( - tree, - edgeI - ) - ) - ); + // Exclude hits of connected triangles + treeDataTriSurface::findSelfIntersectOp exclOp(tree, edgeI); - if (hitInfo.hit() && intStreamPtr.valid()) + pointIndexHit hitInfo(tree.findLineAny(start, end, exclOp)); + + if (hitInfo.hit()) { - intStreamPtr().write(hitInfo.hitPoint()); nInt++; + + if (intStreamPtr.valid()) + { + intStreamPtr().write(hitInfo.hitPoint()); + } + + // Try and find from other side. + pointIndexHit hitInfo2(tree.findLineAny(end, start, exclOp)); + + if (hitInfo2.hit() && hitInfo.index() != hitInfo2.index()) + { + nInt++; + + if (intStreamPtr.valid()) + { + intStreamPtr().write(hitInfo2.hitPoint()); + } + } + } } + //// Check very near triangles + //{ + // const pointField& localPoints = surf.localPoints(); + // + // const boundBox bb(localPoints); + // scalar smallDim = 1e-6 * bb.mag(); + // scalar smallDimSqr = Foam::sqr(smallDim); + // + // const pointField& faceCentres = surf.faceCentres(); + // forAll(faceCentres, faceI) + // { + // const point& fc = faceCentres[faceI]; + // pointIndexHit hitInfo + // ( + // tree.findNearest + // ( + // fc, + // smallDimSqr, + // findSelfNearOp(tree, faceI) + // ) + // ); + // + // if (hitInfo.hit() && intStreamPtr.valid()) + // { + // intStreamPtr().write(hitInfo.hitPoint()); + // + // label nearFaceI = hitInfo.index(); + // triPointRef nearTri(surf[nearFaceI].tri(surf.points())); + // triStreamPtr().write + // ( + // surf[faceI].tri(surf.points()), + // false + // ); + // triStreamPtr().write(nearTri, false); + // nInt++; + // } + // } + //} + + if (nInt == 0) { Info<< "Surface is not self-intersecting" << endl;