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 octreeDataEdges_H
37 #define octreeDataEdges_H
40 #include "linePointRef.H"
41 #include "treeBoundBoxList.H"
42 #include "labelList.H"
43 #include "className.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
51 template<class Type> class octree;
53 /*---------------------------------------------------------------------------*\
54 Class octreeDataEdges Declaration
55 \*---------------------------------------------------------------------------*/
61 //- tolerance on linear dimensions
67 //- Reference to edgeList
68 const edgeList& edges_;
70 //- Reference to points
71 const pointField& points_;
74 labelList edgeLabels_;
76 //- bbs for all above edges
77 treeBoundBoxList allBb_;
82 // Declare name of the class and its debug switch
83 ClassName("octreeDataEdges");
87 //- Construct from selected edges. !Holds references to edges and points
90 const edgeList& edges,
91 const pointField& points,
92 const labelList& edgeLabels
96 octreeDataEdges(const octreeDataEdges&);
108 const edgeList& edges() const
113 const pointField& points() const
118 const labelList& edgeLabels() const
123 const treeBoundBoxList& allBb() const
130 return allBb_.size();
136 //- Get type of sample
139 const octree<octreeDataEdges>&,
143 //- Does (bb of) shape at index overlap bb
147 const treeBoundBox& sampleBb
150 //- Does shape at index contain sample
157 //- Segment (from start to end) intersection with shape
158 // at index. If intersects returns true and sets intersectionPoint
164 point& intersectionPoint
167 //- Sets newTightest to bounding box (and returns true) if
168 // nearer to sample than tightest bounding box. Otherwise
174 treeBoundBox& tightest
177 //- Given index get unit normal and calculate (numerical) sign
179 // Used to determine accuracy of calcNearest or inside/outside.
187 //- Calculates nearest (to sample) point in shape.
188 // Returns point and mag(nearest - sample).
196 //- Calculates nearest (to line segment) point in shape.
197 // Returns distance and both point.
201 const linePointRef& ln,
202 point& linePt, // nearest point on line
203 point& shapePt // nearest point on shape
209 //- Write shape at index
210 void write(Ostream& os, const label index) const;
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 } // End namespace Foam
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 // ************************************************************************* //