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 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 and subset of faces, transferring contents
111 const primitiveMesh&,
112 const Xfer<labelList>&
115 //- Construct from mesh. Uses all faces in mesh.
116 treeDataFace(const bool cacheBb, const primitiveMesh&);
118 //- Construct from mesh. Uses all faces in patch.
119 treeDataFace(const bool cacheBb, const polyPatch&);
126 inline const labelList& faceLabels() const
131 inline const primitiveMesh& mesh() const
136 inline label size() const
138 return faceLabels_.size();
141 //- Get representative point cloud for all shapes inside
142 // (one point per shape)
143 pointField shapePoints() const;
148 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
149 // Only makes sense for closed surfaces.
152 const indexedOctree<treeDataFace>&,
156 //- Does (bb of) shape at index overlap bb
160 const treeBoundBox& sampleBb
163 //- Calculates nearest (to sample) point in shape.
164 // Returns actual point and distance (squared)
167 const labelUList& indices,
170 scalar& nearestDistSqr,
175 //- Calculates nearest (to line) point in shape.
176 // Returns point and distance (squared)
179 const labelUList& indices,
180 const linePointRef& ln,
182 treeBoundBox& tightest,
190 "treeDataFace::findNearest"
191 "(const labelUList&, const linePointRef&, ..)"
195 //- Calculate intersection of shape with ray. Sets result
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 // ************************************************************************* //