ENH: treeDataPoint: work on subset of points

This commit is contained in:
mattijs
2011-03-18 17:23:08 +00:00
parent e45bcc9188
commit 714d79a3c1
2 changed files with 33 additions and 7 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,6 @@ License
#include "treeDataPoint.H"
#include "treeBoundBox.H"
#include "indexedOctree.H"
#include "polyMesh.H"
#include "triangleFuncs.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -42,6 +41,17 @@ Foam::treeDataPoint::treeDataPoint(const pointField& points)
{}
Foam::treeDataPoint::treeDataPoint
(
const pointField& points,
const labelList& pointLabels
)
:
points_(points),
pointLabels_(pointLabels)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::pointField Foam::treeDataPoint::points() const
@ -69,7 +79,8 @@ bool Foam::treeDataPoint::overlaps
const treeBoundBox& cubeBb
) const
{
return cubeBb.contains(points_[index]);
label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
return cubeBb.contains(points_[pointI]);
}
@ -88,8 +99,9 @@ void Foam::treeDataPoint::findNearest
forAll(indices, i)
{
const label index = indices[i];
label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
const point& pt = points_[index];
const point& pt = points_[pointI];
scalar distSqr = magSqr(pt - sample);
@ -122,8 +134,9 @@ void Foam::treeDataPoint::findNearest
forAll(indices, i)
{
const label index = indices[i];
label pointI = (pointLabels_.size() ? pointLabels_[index] : index);
const point& shapePt = points_[index];
const point& shapePt = points_[pointI];
if (tightest.contains(shapePt))
{