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
26 Foam::treeDataPrimitivePatch
29 Encapsulation of data needed to search on PrimitivePatches
32 treeDataPrimitivePatch.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef treeDataPrimitivePatch_H
37 #define treeDataPrimitivePatch_H
39 #include "PrimitivePatch.H"
40 //#include "indexedOctree.H"
41 #include "treeBoundBoxList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of classes
49 template<class Type> class indexedOctree;
52 /*---------------------------------------------------------------------------*\
53 Class treeDataPrimitivePatchName Declaration
54 \*---------------------------------------------------------------------------*/
56 TemplateName(treeDataPrimitivePatch);
59 /*---------------------------------------------------------------------------*\
60 Class treeDataPrimitivePatch Declaration
61 \*---------------------------------------------------------------------------*/
66 template<class> class FaceList,
70 class treeDataPrimitivePatch
72 public treeDataPrimitivePatchName
76 //- tolerance on linear dimensions
81 //- Underlying geometry
82 const PrimitivePatch<Face, FaceList, PointField, PointType>& patch_;
84 //- Whether to precalculate and store face bounding box
87 //- face bounding boxes (valid only if cacheBb_)
88 treeBoundBoxList bbs_;
91 // Private Member Functions
93 //- Calculate face bounding box
94 static treeBoundBox calcBb(const pointField&, const face&);
96 //- Initialise all member data
103 //- Construct from patch.
104 treeDataPrimitivePatch
107 const PrimitivePatch<Face, FaceList, PointField, PointType>&
117 return patch_.size();
120 //- Get representative point cloud for all shapes inside
121 // (one point per shape)
122 pointField points() const;
127 //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
128 // Only makes sense for closed surfaces.
133 treeDataPrimitivePatch
144 //- Does (bb of) shape at index overlap bb
148 const treeBoundBox& sampleBb
151 //- Calculates nearest (to sample) point in shape.
152 // Returns actual point and distance (squared)
155 const labelList& indices,
158 scalar& nearestDistSqr,
163 //- Calculates nearest (to line) point in shape.
164 // Returns point and distance (squared)
167 const labelList& indices,
168 const linePointRef& ln,
170 treeBoundBox& tightest,
178 "treeDataPrimitivePatch::findNearest"
179 "(const labelList&, const linePointRef&, ..)"
183 //- Calculate intersection of shape with ray. Sets result
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 } // End namespace Foam
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 # include "treeDataPrimitivePatch.C"
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // ************************************************************************* //