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 Searching on bounding box
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableBox_H
37 #define searchableBox_H
39 #include "searchableSurface.H"
40 #include "treeBoundBox.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
49 /*---------------------------------------------------------------------------*\
50 Class searchableBox Declaration
51 \*---------------------------------------------------------------------------*/
55 public searchableSurface,
60 // Private Member Data
62 mutable wordList regions_;
65 // Private Member Functions
67 //- Project onto component dir of planePt and update index() (=face)
68 void projectOntoCoordPlane
75 //- Returns miss or hit with face (0..5)
76 pointIndexHit findNearest
80 const scalar nearestDistSqr
84 //- Disallow default bitwise copy construct
85 searchableBox(const searchableBox&);
87 //- Disallow default bitwise assignment
88 void operator=(const searchableBox&);
93 //- Runtime type information
94 TypeName("searchableBox");
99 //- Construct from components
100 searchableBox(const IOobject& io, const treeBoundBox& bb);
102 //- Construct from dictionary (used by searchableSurface)
106 const dictionary& dict
111 virtual ~searchableBox();
116 virtual const wordList& regions() const;
118 //- Whether supports volume type below
119 virtual bool hasVolumeType() const
124 //- Range of local indices that can be returned.
125 virtual label size() const
130 //- Get representative set of element coordinates
131 // Usually the element centres (should be of length size()).
132 virtual pointField coordinates() const;
134 // Single point queries.
136 //- Calculate nearest point on surface. Returns
137 // - bool : any point found nearer than nearestDistSqr
138 // - label: relevant index in surface (=face 0..5)
139 // - point: actual nearest point found
140 pointIndexHit findNearest
143 const scalar nearestDistSqr
146 //- Calculate nearest point on edge. Returns
147 // - bool : any point found nearer than nearestDistSqr
148 // - label: relevant index in surface(=?)
149 // - point: actual nearest point found
150 pointIndexHit findNearestOnEdge
153 const scalar nearestDistSqr
156 //- Find nearest to segment. Returns
157 // - bool : any point found?
158 // - label: relevant index in shapes (=face 0..5)
159 // - point: actual nearest point found
161 // - tightest : bounding box
162 // - linePoint : corresponding nearest point on line
163 pointIndexHit findNearest
165 const linePointRef& ln,
166 treeBoundBox& tightest,
170 //- Find nearest intersection of line between start and end.
171 pointIndexHit findLine
177 //- Find any intersection of line between start and end.
178 pointIndexHit findLineAny
185 // Multiple point queries.
187 virtual void findNearest
189 const pointField& sample,
190 const scalarField& nearestDistSqr,
194 virtual void findLine
196 const pointField& start,
197 const pointField& end,
201 virtual void findLineAny
203 const pointField& start,
204 const pointField& end,
208 //- Get all intersections in order from start to end.
209 virtual void findLineAll
211 const pointField& start,
212 const pointField& end,
213 List<List<pointIndexHit> >&
216 //- From a set of points and indices get the region
217 virtual void getRegion
219 const List<pointIndexHit>&,
223 //- From a set of points and indices get the normal
224 virtual void getNormal
226 const List<pointIndexHit>&,
230 //- Determine type (inside/outside/mixed) for point. unknown if
231 // cannot be determined (e.g. non-manifold surface)
232 virtual void getVolumeType
239 // regIOobject implementation
241 bool writeData(Ostream&) const
243 notImplemented("searchableBox::writeData(Ostream&) const");
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 } // End namespace Foam
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 // ************************************************************************* //