1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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
131 // Single point queries.
133 //- Calculate nearest point on surface. Returns
134 // - bool : any point found nearer than nearestDistSqr
135 // - label: relevant index in surface (=face 0..5)
136 // - point: actual nearest point found
137 pointIndexHit findNearest
140 const scalar nearestDistSqr
143 //- Calculate nearest point on edge. Returns
144 // - bool : any point found nearer than nearestDistSqr
145 // - label: relevant index in surface(=?)
146 // - point: actual nearest point found
147 pointIndexHit findNearestOnEdge
150 const scalar nearestDistSqr
153 //- Find nearest to segment. Returns
154 // - bool : any point found?
155 // - label: relevant index in shapes (=face 0..5)
156 // - point: actual nearest point found
158 // - tightest : bounding box
159 // - linePoint : corresponding nearest point on line
160 pointIndexHit findNearest
162 const linePointRef& ln,
163 treeBoundBox& tightest,
167 //- Find nearest intersection of line between start and end.
168 pointIndexHit findLine
174 //- Find any intersection of line between start and end.
175 pointIndexHit findLineAny
182 // Multiple point queries.
184 virtual void findNearest
186 const pointField& sample,
187 const scalarField& nearestDistSqr,
191 virtual void findLine
193 const pointField& start,
194 const pointField& end,
198 virtual void findLineAny
200 const pointField& start,
201 const pointField& end,
205 //- Get all intersections in order from start to end.
206 virtual void findLineAll
208 const pointField& start,
209 const pointField& end,
210 List<List<pointIndexHit> >&
213 //- From a set of points and indices get the region
214 virtual void getRegion
216 const List<pointIndexHit>&,
220 //- From a set of points and indices get the normal
221 virtual void getNormal
223 const List<pointIndexHit>&,
227 //- Determine type (inside/outside/mixed) for point. unknown if
228 // cannot be determined (e.g. non-manifold surface)
229 virtual void getVolumeType
236 // regIOobject implementation
238 bool writeData(Ostream&) const
240 notImplemented("searchableBox::writeData(Ostream&) const");
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 } // End namespace Foam
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 // ************************************************************************* //