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 data for octree to work on an edges subset.
33 \*---------------------------------------------------------------------------*/
35 #ifndef treeDataEdge_H
36 #define treeDataEdge_H
38 #include "treeBoundBoxList.H"
39 #include "linePointRef.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
47 template<class Type> class indexedOctree;
49 /*---------------------------------------------------------------------------*\
50 Class treeDataEdge Declaration
51 \*---------------------------------------------------------------------------*/
57 //- tolerance on linear dimensions
63 //- Reference to edgeList
64 const edgeList& edges_;
66 //- Reference to points
67 const pointField& points_;
70 const labelList edgeLabels_;
72 //- Whether to precalculate and store face bounding box
75 //- bbs for all above edges (valid only if cacheBb_)
76 treeBoundBoxList bbs_;
79 // Private Member Functions
81 //- Calculate edge bounding box
82 treeBoundBox calcBb(const label edgeI) const;
84 //- Initialise all member data
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 labelUList& edgeLabels
104 //- Construct from selected edges, transferring contents.
105 // !Holds references to edges and points
109 const edgeList& edges,
110 const pointField& points,
111 const Xfer<labelList>& edgeLabels
119 const labelList& edgeLabels() const
126 return edgeLabels_.size();
129 //- Get representative point cloud for all shapes inside
130 // (one point per shape)
131 pointField shapePoints() const;
136 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
137 // Only makes sense for closed surfaces.
140 const indexedOctree<treeDataEdge>&,
144 //- Does (bb of) shape at index overlap bb
148 const treeBoundBox& sampleBb
151 //- Calculates nearest (to sample) point in shape.
152 // Returns actual point and distance (squared)
155 const labelUList& indices,
158 scalar& nearestDistSqr,
163 //- Calculates nearest (to line) point in shape.
164 // Returns point and distance (squared)
167 const labelUList& indices,
168 const linePointRef& ln,
170 treeBoundBox& tightest,
176 //- Calculate intersection of shape with ray. Sets result
188 "treeDataEdge::intersects(const label, const point&,"
189 "const point&, point&)"
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 } // End namespace Foam
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 // ************************************************************************* //