1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Holds data for octree to work on an edges subset.
34 \*---------------------------------------------------------------------------*/
36 #ifndef treeDataEdge_H
37 #define treeDataEdge_H
39 #include "treeBoundBoxList.H"
40 #include "linePointRef.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
48 template<class Type> class indexedOctree;
50 /*---------------------------------------------------------------------------*\
51 Class treeDataEdge Declaration
52 \*---------------------------------------------------------------------------*/
58 //- tolerance on linear dimensions
64 //- Reference to edgeList
65 const edgeList& edges_;
67 //- Reference to points
68 const pointField& points_;
71 const labelList edgeLabels_;
73 //- Whether to precalculate and store face bounding box
76 //- bbs for all above edges (valid only if cacheBb_)
77 treeBoundBoxList bbs_;
80 // Private Member Functions
82 //- Calculate edge bounding box
83 treeBoundBox calcBb(const label edgeI) const;
87 // Declare name of the class and its debug switch
88 ClassName("treeDataEdge");
93 //- Construct from selected edges. !Holds references to edges and points
97 const edgeList& edges,
98 const pointField& points,
99 const labelList& edgeLabels
109 return edgeLabels_.size();
112 //- Get representative point cloud for all shapes inside
113 // (one point per shape)
114 pointField points() const;
119 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
120 // Only makes sense for closed surfaces.
123 const indexedOctree<treeDataEdge>&,
127 //- Does (bb of) shape at index overlap bb
131 const treeBoundBox& sampleBb
134 //- Calculates nearest (to sample) point in shape.
135 // Returns actual point and distance (squared)
138 const labelList& indices,
141 scalar& nearestDistSqr,
146 //- Calculates nearest (to line) point in shape.
147 // Returns point and distance (squared)
150 const labelList& indices,
151 const linePointRef& ln,
153 treeBoundBox& tightest,
159 //- Calculate intersection of shape with ray. Sets result
171 "treeDataEdge::intersects(const label, const point&,"
172 "const point&, point&)"
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 } // End namespace Foam
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 // ************************************************************************* //