From 4d428e8fe771741b0675665d66617a8563214c72 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 29 Oct 2010 09:50:31 +0100
Subject: [PATCH] BUG: meshSearch : extraneous loop

---
 src/meshTools/meshSearch/meshSearch.C | 33 ++++++++++++---------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C
index 84315fa869f..1c9a4d2cab9 100644
--- a/src/meshTools/meshSearch/meshSearch.C
+++ b/src/meshTools/meshSearch/meshSearch.C
@@ -617,30 +617,25 @@ bool Foam::meshSearch::pointInCell(const point& p, label cellI) const
         {
             label faceI = cFaces[i];
 
-            const face& f = mesh_.faces()[faceI];
+            pointHit inter = mesh_.faces()[faceI].ray
+            (
+                ctr,
+                dir,
+                mesh_.points(),
+                intersection::HALF_RAY,
+                intersection::VECTOR
+            );
 
-            forAll(f, fp)
+            if (inter.hit())
             {
-                pointHit inter = f.ray
-                (
-                    ctr,
-                    dir,
-                    mesh_.points(),
-                    intersection::HALF_RAY,
-                    intersection::VECTOR
-                );
+                scalar dist = inter.distance();
 
-                if (inter.hit())
+                if (dist < magDir)
                 {
-                    scalar dist = inter.distance();
+                    // Valid hit. Hit face so point is not in cell.
+                    intersection::setPlanarTol(oldTol);
 
-                    if (dist < magDir)
-                    {
-                        // Valid hit. Hit face so point is not in cell.
-                        intersection::setPlanarTol(oldTol);
-
-                        return false;
-                    }
+                    return false;
                 }
             }
         }
-- 
GitLab