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
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 "treeBoundBox.H"
41 #include "treeBoundBoxList.H"
42 #include "labelList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 // Forward declaration of classes
51 template<class Type> class indexedOctree;
53 /*---------------------------------------------------------------------------*\
54 Class treeDataCell Declaration
55 \*---------------------------------------------------------------------------*/
61 const polyMesh& mesh_;
63 //- Subset of cells to work on
64 const labelList cellLabels_;
66 //- Whether to precalculate and store cell bounding box
69 //- cell bounding boxes (valid only if cacheBb_)
70 treeBoundBoxList bbs_;
73 // Private Member Functions
75 //- Calculate cell bounding box
76 treeBoundBox calcCellBb(const label cellI) const;
80 // Declare name of the class and its debug switch
81 ClassName("treeDataCell");
86 //- Construct from mesh and subset of cells.
94 //- Construct from mesh. Uses all cells in mesh.
95 treeDataCell(const bool cacheBb, const polyMesh&);
102 const labelList& cellLabels() const
107 const polyMesh& mesh() const
115 return cellLabels_.size();
118 //- Get representative point cloud for all shapes inside
119 // (one point per shape)
120 pointField points() const;
125 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
126 // Only makes sense for closed surfaces.
129 const indexedOctree<treeDataCell>&,
135 "treeDataCell::getVolumeType"
136 "(const indexedOctree<treeDataCell>&, const point&)"
141 //- Does (bb of) shape at index overlap bb
145 const treeBoundBox& sampleBb
148 //- Calculates nearest (to sample) point in shape.
149 // Returns actual point and distance (squared)
152 const labelList& indices,
155 scalar& nearestDistSqr,
160 //- Calculates nearest (to line) point in shape.
161 // Returns point and distance (squared)
164 const labelList& indices,
165 const linePointRef& ln,
167 treeBoundBox& tightest,
175 "treeDataCell::findNearest"
176 "(const labelList&, const linePointRef&, ..)"
180 //- Calculate intersection of shape with ray. Sets result
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 // ************************************************************************* //