1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Encapsulation of data needed to search for faces.
33 \*---------------------------------------------------------------------------*/
35 #ifndef treeDataFace_H
36 #define treeDataFace_H
39 #include "indexedOctree.H"
40 #include "treeBoundBoxList.H"
41 #include "PackedBoolList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of classes
50 //template<class Type> class indexedOctree;
53 /*---------------------------------------------------------------------------*\
54 Class treeDataFace Declaration
55 \*---------------------------------------------------------------------------*/
61 //- tolerance on linear dimensions
68 const primitiveMesh& mesh_;
70 //- Subset of faces to work on
71 const labelList faceLabels_;
73 //- Inverse of faceLabels. For every mesh whether face is in faceLabels.
74 PackedBoolList isTreeFace_;
76 //- Whether to precalculate and store face bounding box
79 //- face bounding boxes (valid only if cacheBb_)
80 treeBoundBoxList bbs_;
83 // Private Member Functions
85 //- Calculate face bounding box
86 treeBoundBox calcBb(const label cellI) const;
88 //- Initialise all member data
93 // Declare name of the class and its debug switch
94 ClassName("treeDataFace");
99 //- Construct from mesh and subset of faces.
103 const primitiveMesh&,
107 //- Construct from mesh. Uses all faces in mesh.
108 treeDataFace(const bool cacheBb, const primitiveMesh&);
110 //- Construct from mesh. Uses all faces in patch.
111 treeDataFace(const bool cacheBb, const polyPatch&);
118 const labelList& faceLabels() const
123 const primitiveMesh& mesh() const
130 return faceLabels_.size();
133 //- Get representative point cloud for all shapes inside
134 // (one point per shape)
135 pointField points() const;
140 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
141 // Only makes sense for closed surfaces.
144 const indexedOctree<treeDataFace>&,
148 //- Does (bb of) shape at index overlap bb
152 const treeBoundBox& sampleBb
155 //- Calculates nearest (to sample) point in shape.
156 // Returns actual point and distance (squared)
159 const labelList& indices,
162 scalar& nearestDistSqr,
167 //- Calculates nearest (to line) point in shape.
168 // Returns point and distance (squared)
171 const labelList& indices,
172 const linePointRef& ln,
174 treeBoundBox& tightest,
182 "treeDataFace::findNearest"
183 "(const labelList&, const linePointRef&, ..)"
187 //- Calculate intersection of shape with ray. Sets result
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 } // End namespace Foam
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 // ************************************************************************* //