1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 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
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/>.
25 Foam::octreeDataFaceList
28 Holds data for octree to work on list of faces on a bMesh
29 (= PrimitivePatch which holds faces, not references them)
30 Same as octreeDataFace except for that.
35 \*---------------------------------------------------------------------------*/
37 #ifndef octreeDataFaceList_H
38 #define octreeDataFaceList_H
40 #include "treeBoundBoxList.H"
43 #include "className.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
52 template<class Type> class octree;
54 /*---------------------------------------------------------------------------*\
55 Class octreeDataFaceList Declaration
56 \*---------------------------------------------------------------------------*/
58 class octreeDataFaceList
62 //- tolerance on linear dimensions
68 static inline label nexti(label max, label i)
79 //- labels (in mesh indexing) of faces
80 labelList faceLabels_;
82 //- bbs for all above faces
83 treeBoundBoxList allBb_;
86 // Private Member Functions
88 //- Set allBb to tight fitting bounding box
93 // Declare name of the class and its debug switch
94 ClassName("octreeDataFaceList");
98 //- Construct from all faces in bMesh.
99 octreeDataFaceList(const bMesh& mesh);
101 //- Construct from selected faces in bMesh.
102 octreeDataFaceList(const bMesh& mesh, const labelList& faceLabels);
104 //- Construct as copy
105 octreeDataFaceList(const octreeDataFaceList&);
110 ~octreeDataFaceList();
117 const bMesh& mesh() const
122 const labelList& faceLabels() const
127 const treeBoundBoxList& allBb() const
134 return allBb_.size();
139 //- Get type of sample
142 const octree<octreeDataFaceList>&,
146 //- Does (bb of) shape at index overlap bb
150 const treeBoundBox& sampleBb
153 //- Does shape at index contain sample
160 //- Segment (from start to end) intersection with shape
161 // at index. If intersects returns true and sets intersectionPoint
167 point& intersectionPoint
170 //- Sets newTightest to bounding box (and returns true) if
171 // nearer to sample than tightest bounding box. Otherwise
177 treeBoundBox& tightest
180 //- Given index get unit normal and calculate (numerical) sign
182 // Used to determine accuracy of calcNearest or inside/outside.
190 //- Calculates nearest (to sample) point in shape.
191 // Returns point and mag(nearest - sample). Returns GREAT if
192 // sample does not project onto (triangle decomposition) of face.
205 //- Write shape at index
206 void write(Ostream& os, const label index) const;
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 } // End namespace Foam
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 // ************************************************************************* //