1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 in/for cells. Used to find the
30 cell containing a point (e.g. cell-cell mapping).
35 \*---------------------------------------------------------------------------*/
37 #ifndef treeDataCell_H
38 #define treeDataCell_H
40 #include "treeBoundBoxList.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
49 template<class Type> class indexedOctree;
51 /*---------------------------------------------------------------------------*\
52 Class treeDataCell Declaration
53 \*---------------------------------------------------------------------------*/
59 const primitiveMesh& mesh_;
61 //- Subset of cells to work on
62 const labelList cellLabels_;
64 //- Whether to precalculate and store cell bounding box
67 //- cell bounding boxes (valid only if cacheBb_)
68 treeBoundBoxList bbs_;
71 // Private Member Functions
73 //- Calculate cell bounding box
74 treeBoundBox calcCellBb(const label cellI) const;
78 // Declare name of the class and its debug switch
79 ClassName("treeDataCell");
84 //- Construct from mesh and subset of cells.
92 //- Construct from mesh. Uses all cells in mesh.
93 treeDataCell(const bool cacheBb, const primitiveMesh&);
100 const labelList& cellLabels() const
105 const primitiveMesh& mesh() const
113 return cellLabels_.size();
116 //- Get representative point cloud for all shapes inside
117 // (one point per shape)
118 pointField points() const;
123 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
124 // Only makes sense for closed surfaces.
127 const indexedOctree<treeDataCell>&,
133 "treeDataCell::getVolumeType"
134 "(const indexedOctree<treeDataCell>&, const point&)"
139 //- Does (bb of) shape at index overlap bb
143 const treeBoundBox& sampleBb
146 //- Calculates nearest (to sample) point in shape.
147 // Returns actual point and distance (squared)
150 const labelList& indices,
153 scalar& nearestDistSqr,
158 //- Calculates nearest (to line) point in shape.
159 // Returns point and distance (squared)
162 const labelList& indices,
163 const linePointRef& ln,
165 treeBoundBox& tightest,
173 "treeDataCell::findNearest"
174 "(const labelList&, const linePointRef&, ..)"
178 //- Calculate intersection of shape with ray. Sets result
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 } // End namespace Foam
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 // ************************************************************************* //