Skip to content
Permalink
Browse files

surfaceFind: Report true distance to faces

  • Loading branch information...
Will Bainbridge
Will Bainbridge committed Feb 1, 2019
1 parent 756d10c commit ba61e391194573609ba64b3f4ed09d20e5a4ee42
Showing with 6 additions and 6 deletions.
  1. +6 −6 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

0 comments on commit ba61e39

Please sign in to comment.
You can’t perform that action at this time.