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::treeDataPrimitivePatch
28 Encapsulation of data needed to search on PrimitivePatches
31 treeDataPrimitivePatch.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef treeDataPrimitivePatch_H
36 #define treeDataPrimitivePatch_H
38 #include "PrimitivePatch.H"
39 //#include "indexedOctree.H"
40 #include "treeBoundBoxList.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
48 template<class Type> class indexedOctree;
51 /*---------------------------------------------------------------------------*\
52 Class treeDataPrimitivePatchName Declaration
53 \*---------------------------------------------------------------------------*/
55 TemplateName(treeDataPrimitivePatch);
58 /*---------------------------------------------------------------------------*\
59 Class treeDataPrimitivePatch Declaration
60 \*---------------------------------------------------------------------------*/
65 template<class> class FaceList,
69 class treeDataPrimitivePatch
71 public treeDataPrimitivePatchName
75 //- tolerance on linear dimensions
80 //- Underlying geometry
81 const PrimitivePatch<Face, FaceList, PointField, PointType>& patch_;
83 //- Whether to precalculate and store face bounding box
86 //- face bounding boxes (valid only if cacheBb_)
87 treeBoundBoxList bbs_;
90 // Private Member Functions
92 //- Calculate face bounding box
93 static treeBoundBox calcBb(const pointField&, const face&);
95 //- Initialise all member data
102 //- Construct from patch.
103 treeDataPrimitivePatch
106 const PrimitivePatch<Face, FaceList, PointField, PointType>&
116 return patch_.size();
119 //- Get representative point cloud for all shapes inside
120 // (one point per shape)
121 pointField shapePoints() const;
126 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
127 // Only makes sense for closed surfaces.
132 treeDataPrimitivePatch
143 //- Does (bb of) shape at index overlap bb
147 const treeBoundBox& sampleBb
150 //- Calculates nearest (to sample) point in shape.
151 // Returns actual point and distance (squared)
154 const labelUList& indices,
157 scalar& nearestDistSqr,
162 //- Calculates nearest (to line) point in shape.
163 // Returns point and distance (squared)
166 const labelUList& indices,
167 const linePointRef& ln,
169 treeBoundBox& tightest,
177 "treeDataPrimitivePatch::findNearest"
178 "(const labelUList&, const linePointRef&, ..)"
182 //- Calculate intersection of shape with ray. Sets result
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 } // End namespace Foam
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 # include "treeDataPrimitivePatch.C"
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 // ************************************************************************* //