From ba61e391194573609ba64b3f4ed09d20e5a4ee42 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 1 Feb 2019 16:10:33 +0000 Subject: [PATCH] surfaceFind: Report true distance to faces --- .../utilities/surface/surfaceFind/surfaceFind.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C index 26024e28e7..4f3f7f4aea 100644 --- a/applications/utilities/surface/surfaceFind/surfaceFind.C +++ b/applications/utilities/surface/surfaceFind/surfaceFind.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,19 +98,19 @@ int main(int argc, char *argv[]) forAll(surf1, facei) { - const point centre = surf1[facei].centre(points); + const pointHit hit = + surf1[facei].nearestPoint(samplePt, points); - const scalar dist = mag(centre - samplePt); - if (dist < minDist) + if (hit.distance() < minDist) { - minDist = dist; + minDist = hit.distance();; minIndex = facei; } } const face& f = surf1[minIndex]; - Info<< "Face with nearest centre:" << nl + Info<< "Nearest face:" << nl << " index : " << minIndex << nl << " centre : " << f.centre(points) << nl << " face : " << f << nl