1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 "treeBoundBox.H"
40 #include "pointField.H"
41 #include "treeBoundBoxList.H"
42 #include "linePointRef.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
50 template<class Type> class indexedOctree;
52 /*---------------------------------------------------------------------------*\
53 Class treeDataEdge Declaration
54 \*---------------------------------------------------------------------------*/
60 //- tolerance on linear dimensions
66 //- Reference to edgeList
67 const edgeList& edges_;
69 //- Reference to points
70 const pointField& points_;
73 const labelList edgeLabels_;
75 //- Whether to precalculate and store face bounding box
78 //- bbs for all above edges (valid only if cacheBb_)
79 treeBoundBoxList bbs_;
82 // Private Member Functions
84 //- Calculate edge bounding box
85 treeBoundBox calcBb(const label edgeI) const;
89 // Declare name of the class and its debug switch
90 ClassName("treeDataEdge");
95 //- Construct from selected edges. !Holds references to edges and points
99 const edgeList& edges,
100 const pointField& points,
101 const labelList& edgeLabels
111 return edgeLabels_.size();
114 //- Get representative point cloud for all shapes inside
115 // (one point per shape)
116 pointField points() const;
121 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
122 // Only makes sense for closed surfaces.
125 const indexedOctree<treeDataEdge>&,
129 //- Does (bb of) shape at index overlap bb
133 const treeBoundBox& sampleBb
136 //- Calculates nearest (to sample) point in shape.
137 // Returns actual point and distance (squared)
140 const labelList& indices,
143 scalar& nearestDistSqr,
148 //- Calculates nearest (to line) point in shape.
149 // Returns point and distance (squared)
152 const labelList& indices,
153 const linePointRef& ln,
155 treeBoundBox& tightest,
161 //- Calculate intersection of shape with ray. Sets result
173 "treeDataEdge::intersects(const label, const point&,"
174 "const point&, point&)"
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 } // End namespace Foam
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 // ************************************************************************* //