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/>.
25 Foam::treeDataPolyMeshCell
28 Encapsulation of data needed to search in/for cells. Used to find the
29 cell containing a point (e.g. cell-cell mapping).
31 Note: similar to treeDataCell but stores polyMesh reference so
32 can use tetDecomposition instead of pointInCell. WIP. This will probably
36 treeDataPolyMeshCell.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef treeDataPolyMeshCell_H
41 #define treeDataPolyMeshCell_H
43 #include "treeBoundBoxList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
52 template<class Type> class indexedOctree;
54 /*---------------------------------------------------------------------------*\
55 Class treeDataPolyMeshCell Declaration
56 \*---------------------------------------------------------------------------*/
58 class treeDataPolyMeshCell
62 const polyMesh& mesh_;
64 //- Subset of cells to work on
65 const labelList cellLabels_;
67 //- Whether to precalculate and store cell bounding box
70 //- cell bounding boxes (valid only if cacheBb_)
71 treeBoundBoxList bbs_;
74 // Private Member Functions
76 //- Calculate cell bounding box
77 treeBoundBox calcCellBb(const label cellI) const;
79 //- Initialise all member data
84 // Declare name of the class and its debug switch
85 ClassName("treeDataPolyMeshCell");
90 //- Construct from mesh and subset of cells.
98 //- Construct from mesh and subset of cells, transferring contents
103 const Xfer<labelList>&
106 //- Construct from mesh. Uses all cells in mesh.
107 treeDataPolyMeshCell(const bool cacheBb, const polyMesh&);
114 inline const labelList& cellLabels() const
119 inline const polyMesh& mesh() const
125 inline label size() const
127 return cellLabels_.size();
130 //- Get representative point cloud for all shapes inside
131 // (one point per shape)
132 pointField shapePoints() const;
137 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
138 // Only makes sense for closed surfaces.
141 const indexedOctree<treeDataPolyMeshCell>&,
147 "treeDataPolyMeshCell::getVolumeType"
148 "(const indexedOctree<treeDataPolyMeshCell>&, const point&)"
153 //- Does (bb of) shape at index overlap bb
157 const treeBoundBox& sampleBb
160 //- Does shape at index contain sample
167 //- Calculates nearest (to sample) point in shape.
168 // Returns actual point and distance (squared)
171 const labelUList& indices,
174 scalar& nearestDistSqr,
179 //- Calculates nearest (to line) point in shape.
180 // Returns point and distance (squared)
183 const labelUList& indices,
184 const linePointRef& ln,
186 treeBoundBox& tightest,
194 "treeDataPolyMeshCell::findNearest"
195 "(const labelUList&, const linePointRef&, ..)"
199 //- Calculate intersection of shape with ray. Sets result
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 } // End namespace Foam
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 // ************************************************************************* //