surfaceFind: Report true distance to faces

This commit is contained in:
Will Bainbridge
2019-02-01 16:10:33 +00:00
parent 756d10c37c
commit ba61e39119

View File

@ -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