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
26 Foam::octreeDataFaceList
29 Holds data for octree to work on list of faces on a bMesh
30 (= PrimitivePatch which holds faces, not references them)
31 Same as octreeDataFace except for that.
36 \*---------------------------------------------------------------------------*/
38 #ifndef octreeDataFaceList_H
39 #define octreeDataFaceList_H
41 #include "treeBoundBoxList.H"
44 #include "className.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Forward declaration of classes
53 template<class Type> class octree;
55 /*---------------------------------------------------------------------------*\
56 Class octreeDataFaceList Declaration
57 \*---------------------------------------------------------------------------*/
59 class octreeDataFaceList
63 //- tolerance on linear dimensions
69 static inline label nexti(label max, label i)
80 //- labels (in mesh indexing) of faces
81 labelList faceLabels_;
83 //- bbs for all above faces
84 treeBoundBoxList allBb_;
87 // Private Member Functions
89 //- Set allBb to tight fitting bounding box
94 // Declare name of the class and its debug switch
95 ClassName("octreeDataFaceList");
99 //- Construct from all faces in bMesh.
100 octreeDataFaceList(const bMesh& mesh);
102 //- Construct from selected faces in bMesh.
103 octreeDataFaceList(const bMesh& mesh, const labelList& faceLabels);
105 //- Construct as copy
106 octreeDataFaceList(const octreeDataFaceList&);
111 ~octreeDataFaceList();
118 const bMesh& mesh() const
123 const labelList& faceLabels() const
128 const treeBoundBoxList& allBb() const
135 return allBb_.size();
140 //- Get type of sample
143 const octree<octreeDataFaceList>&,
147 //- Does (bb of) shape at index overlap bb
151 const treeBoundBox& sampleBb
154 //- Does shape at index contain sample
161 //- Segment (from start to end) intersection with shape
162 // at index. If intersects returns true and sets intersectionPoint
168 point& intersectionPoint
171 //- Sets newTightest to bounding box (and returns true) if
172 // nearer to sample than tightest bounding box. Otherwise
178 treeBoundBox& tightest
181 //- Given index get unit normal and calculate (numerical) sign
183 // Used to determine accuracy of calcNearest or inside/outside.
191 //- Calculates nearest (to sample) point in shape.
192 // Returns point and mag(nearest - sample). Returns GREAT if
193 // sample does not project onto (triangle decomposition) of face.
206 //- Write shape at index
207 void write(Ostream& os, const label index) const;
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 // ************************************************************************* //