From b51ba049aa485bcf02a07c2bc328e6ad7fee6a2b Mon Sep 17 00:00:00 2001 From: laurence Date: Thu, 19 Sep 2013 16:18:11 +0100 Subject: [PATCH] BUG: treeBoundBox: If test point is on boundBox the intersection test can get stuck in a loop. Allow maximum of 4 iterations (3 clippings plus one iteration to update the result). --- src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C index 0968c71ca3..1cec955dbd 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C @@ -269,7 +269,8 @@ bool Foam::treeBoundBox::intersects const direction endBits = posBits(end); pt = start; - while (true) + // Allow maximum of 3 clips. + for (label i = 0; i < 4; ++i) { direction ptBits = posBits(pt); @@ -380,6 +381,9 @@ bool Foam::treeBoundBox::intersects } } } + + // Can end up here if the end point is on the edge of the boundBox + return true; }