1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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
125 // Single point queries.
127 //- Calculate nearest point on surface. Returns
128 // - bool : any point found nearer than nearestDistSqr
129 // - label: relevant index in surface (=face 0..5)
130 // - point: actual nearest point found
131 pointIndexHit findNearest
134 const scalar nearestDistSqr
137 //- Calculate nearest point on edge. Returns
138 // - bool : any point found nearer than nearestDistSqr
139 // - label: relevant index in surface(=?)
140 // - point: actual nearest point found
141 pointIndexHit findNearestOnEdge
144 const scalar nearestDistSqr
147 //- Find nearest to segment. Returns
148 // - bool : any point found?
149 // - label: relevant index in shapes (=face 0..5)
150 // - point: actual nearest point found
152 // - tightest : bounding box
153 // - linePoint : corresponding nearest point on line
154 pointIndexHit findNearest
156 const linePointRef& ln,
157 treeBoundBox& tightest,
161 //- Find nearest intersection of line between start and end.
162 pointIndexHit findLine
168 //- Find any intersection of line between start and end.
169 pointIndexHit findLineAny
176 // Multiple point queries.
178 virtual void findNearest
180 const pointField& sample,
181 const scalarField& nearestDistSqr,
185 virtual void findLine
187 const pointField& start,
188 const pointField& end,
192 virtual void findLineAny
194 const pointField& start,
195 const pointField& end,
199 //- Get all intersections in order from start to end.
200 virtual void findLineAll
202 const pointField& start,
203 const pointField& end,
204 List<List<pointIndexHit> >&
207 //- From a set of points and indices get the region
208 virtual void getRegion
210 const List<pointIndexHit>&,
214 //- From a set of points and indices get the normal
215 virtual void getNormal
217 const List<pointIndexHit>&,
221 //- Determine type (inside/outside/mixed) for point. unknown if
222 // cannot be determined (e.g. non-manifold surface)
223 virtual void getVolumeType
230 // regIOobject implementation
232 bool writeData(Ostream&) const
234 notImplemented("searchableBox::writeData(Ostream&) const");
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 } // End namespace Foam
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 // ************************************************************************* //