Пример #1
0
Foam::pointIndexHit Foam::searchableSurfacesQueries::tempFindNearest
(
    const searchableSurface& surf,
    const point& pt,
    const scalar initDistSqr
)
{
    pointField onePoint(1, pt);
    scalarField oneDist(1, initDistSqr);
    List<pointIndexHit> oneHit(1);
    surf.findNearest(onePoint, oneDist, oneHit);
    return oneHit[0];
}
Пример #2
0
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
(
    const searchableSurface& surf,
    pointField& pts
) const
{
    if (debug)
    {
        Info<< "AMI: projecting points to surface" << endl;
    }

    List<pointIndexHit> nearInfo;

    surf.findNearest(pts, scalarField(pts.size(), GREAT), nearInfo);

    label nMiss = 0;
    forAll(nearInfo, i)
    {
        const pointIndexHit& pi = nearInfo[i];

        if (pi.hit())
        {
            pts[i] = pi.hitPoint();
        }
        else
        {
            pts[i] = pts[i];
            nMiss++;
        }
    }

    if (nMiss > 0)
    {
        FatalErrorInFunction
            << "Error projecting points to surface: "
            << nMiss << " faces could not be determined"
            << abort(FatalError);
    }
}