diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C index 84315fa869f3dac078da406da92f8380d1f9ddd8..1c9a4d2cab9a0d5e61fe464a957a791a08947bc8 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; } } }