1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Holds (reference to) pointField. Encapsulation of data needed for
30 Used for searching for nearest point. No bounding boxes around points.
31 Only overlaps and calcNearest are implemented, rest makes little sense.
33 Optionally works on subset of points.
38 \*---------------------------------------------------------------------------*/
40 #ifndef treeDataPoint_H
41 #define treeDataPoint_H
43 #include "pointField.H"
44 #include "treeBoundBox.H"
45 #include "linePointRef.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Forward declaration of classes
53 template<class Type> class indexedOctree;
55 /*---------------------------------------------------------------------------*\
56 Class treeDataPoint Declaration
57 \*---------------------------------------------------------------------------*/
63 const pointField& points_;
65 //- Subset of points to work on (or empty)
66 const labelList pointLabels_;
68 const bool useSubset_;
72 // Declare name of the class and its debug switch
73 ClassName("treeDataPoint");
78 //- Construct from pointField. Holds reference!
79 treeDataPoint(const pointField&);
81 //- Construct from subset of pointField. Holds reference!
82 treeDataPoint(const pointField&, const labelList&);
89 inline label size() const
99 inline const labelList& pointLabels() const
104 const pointField& points() const
109 //- Get representative point cloud for all shapes inside
110 // (one point per shape)
111 pointField shapePoints() const;
116 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
117 // Only makes sense for closed surfaces.
120 const indexedOctree<treeDataPoint>&,
124 //- Does (bb of) shape at index overlap bb
128 const treeBoundBox& sampleBb
131 //- Calculates nearest (to sample) point in shape.
132 // Returns actual point and distance (squared)
135 const labelUList& indices,
138 scalar& nearestDistSqr,
143 //- Calculates nearest (to line) point in shape.
144 // Returns point and distance (squared)
147 const labelUList& indices,
148 const linePointRef& ln,
150 treeBoundBox& tightest,
156 //- Calculate intersection of shape with ray. Sets result
168 "treeDataPoint::intersects(const label, const point&,"
169 "const point&, point&)"
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 // ************************************************************************* //