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 octreeDataEdges_H
36 #define octreeDataEdges_H
39 #include "linePointRef.H"
40 #include "treeBoundBoxList.H"
41 #include "labelList.H"
42 #include "className.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
50 template<class Type> class octree;
52 /*---------------------------------------------------------------------------*\
53 Class octreeDataEdges Declaration
54 \*---------------------------------------------------------------------------*/
60 //- tolerance on linear dimensions
66 //- Reference to edgeList
67 const edgeList& edges_;
69 //- Reference to points
70 const pointField& points_;
73 labelList edgeLabels_;
75 //- bbs for all above edges
76 treeBoundBoxList allBb_;
81 // Declare name of the class and its debug switch
82 ClassName("octreeDataEdges");
86 //- Construct from selected edges. !Holds references to edges and points
89 const edgeList& edges,
90 const pointField& points,
91 const labelList& edgeLabels
95 octreeDataEdges(const octreeDataEdges&);
106 const edgeList& edges() const
111 const pointField& points() const
116 const labelList& edgeLabels() const
121 const treeBoundBoxList& allBb() const
128 return allBb_.size();
134 //- Get type of sample
137 const octree<octreeDataEdges>&,
141 //- Does (bb of) shape at index overlap bb
145 const treeBoundBox& sampleBb
148 //- Does shape at index contain sample
155 //- Segment (from start to end) intersection with shape at index.
156 // If intersects returns true and sets intersectionPoint
162 point& intersectionPoint
165 //- Sets newTightest to bounding box (and returns true) if
166 // nearer to sample than tightest bounding box. Otherwise
172 treeBoundBox& tightest
175 //- Given index get unit normal and calculate (numerical) sign
177 // Used to determine accuracy of calcNearest or inside/outside.
185 //- Calculates nearest (to sample) point in shape.
186 // Returns point and mag(nearest - sample).
194 //- Calculates nearest (to line segment) point in shape.
195 // Returns distance and both point.
199 const linePointRef& ln,
200 point& linePt, // nearest point on line
201 point& shapePt // nearest point on shape
207 //- Write shape at index
208 void write(Ostream& os, const label index) const;
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 } // End namespace Foam
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 // ************************************************************************* //