1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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
29 Encapsulation of data needed to search for faces.
34 \*---------------------------------------------------------------------------*/
36 #ifndef treeDataFace_H
37 #define treeDataFace_H
39 #include <OpenFOAM/face.H>
40 #include "indexedOctree.H"
41 #include <meshTools/treeBoundBoxList.H>
42 #include <OpenFOAM/PackedBoolList.H>
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
51 //template<class Type> class indexedOctree;
54 /*---------------------------------------------------------------------------*\
55 Class treeDataFace Declaration
56 \*---------------------------------------------------------------------------*/
62 //- tolerance on linear dimensions
69 const primitiveMesh& mesh_;
71 //- Subset of faces to work on
72 const labelList faceLabels_;
74 //- Inverse of faceLabels. For every mesh whether face is in faceLabels.
75 PackedBoolList isTreeFace_;
77 //- Whether to precalculate and store face bounding box
80 //- face bounding boxes (valid only if cacheBb_)
81 treeBoundBoxList bbs_;
84 // Private Member Functions
86 //- Calculate face bounding box
87 treeBoundBox calcBb(const label cellI) const;
89 //- Initialise all member data
94 // Declare name of the class and its debug switch
95 ClassName("treeDataFace");
100 //- Construct from mesh and subset of faces.
104 const primitiveMesh&,
108 //- Construct from mesh. Uses all faces in mesh.
109 treeDataFace(const bool cacheBb, const primitiveMesh&);
111 //- Construct from mesh. Uses all faces in patch.
112 treeDataFace(const bool cacheBb, const polyPatch&);
119 const labelList& faceLabels() const
124 const primitiveMesh& mesh() const
131 return faceLabels_.size();
134 //- Get representative point cloud for all shapes inside
135 // (one point per shape)
136 pointField points() const;
141 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
142 // Only makes sense for closed surfaces.
145 const indexedOctree<treeDataFace>&,
149 //- Does (bb of) shape at index overlap bb
153 const treeBoundBox& sampleBb
156 //- Calculates nearest (to sample) point in shape.
157 // Returns actual point and distance (squared)
160 const labelList& indices,
163 scalar& nearestDistSqr,
168 //- Calculates nearest (to line) point in shape.
169 // Returns point and distance (squared)
172 const labelList& indices,
173 const linePointRef& ln,
175 treeBoundBox& tightest,
183 "treeDataFace::findNearest"
184 "(const labelList&, const linePointRef&, ..)"
188 //- Calculate intersection of shape with ray. Sets result
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 } // End namespace Foam
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // ************************ vim: set sw=4 sts=4 et: ************************ //