1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Searching on bounding box
33 \*---------------------------------------------------------------------------*/
35 #ifndef searchableBox_H
36 #define searchableBox_H
38 #include "searchableSurface.H"
39 #include "treeBoundBox.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
48 /*---------------------------------------------------------------------------*\
49 Class searchableBox Declaration
50 \*---------------------------------------------------------------------------*/
54 public searchableSurface,
59 // Private Member Data
61 mutable wordList regions_;
64 // Private Member Functions
66 //- Project onto component dir of planePt and update index() (=face)
67 void projectOntoCoordPlane
74 //- Returns miss or hit with face (0..5)
75 pointIndexHit findNearest
79 const scalar nearestDistSqr
83 //- Disallow default bitwise copy construct
84 searchableBox(const searchableBox&);
86 //- Disallow default bitwise assignment
87 void operator=(const searchableBox&);
92 //- Runtime type information
93 TypeName("searchableBox");
98 //- Construct from components
99 searchableBox(const IOobject& io, const treeBoundBox& bb);
101 //- Construct from dictionary (used by searchableSurface)
105 const dictionary& dict
110 virtual ~searchableBox();
115 virtual const wordList& regions() const;
117 //- Whether supports volume type below
118 virtual bool hasVolumeType() const
123 //- Range of local indices that can be returned.
124 virtual label size() const
129 //- Get representative set of element coordinates
130 // Usually the element centres (should be of length size()).
131 virtual pointField coordinates() const;
133 // Single point queries.
135 //- Calculate nearest point on surface. Returns
136 // - bool : any point found nearer than nearestDistSqr
137 // - label: relevant index in surface (=face 0..5)
138 // - point: actual nearest point found
139 pointIndexHit findNearest
142 const scalar nearestDistSqr
145 //- Calculate nearest point on edge. Returns
146 // - bool : any point found nearer than nearestDistSqr
147 // - label: relevant index in surface(=?)
148 // - point: actual nearest point found
149 pointIndexHit findNearestOnEdge
152 const scalar nearestDistSqr
155 //- Find nearest to segment. Returns
156 // - bool : any point found?
157 // - label: relevant index in shapes (=face 0..5)
158 // - point: actual nearest point found
160 // - tightest : bounding box
161 // - linePoint : corresponding nearest point on line
162 pointIndexHit findNearest
164 const linePointRef& ln,
165 treeBoundBox& tightest,
169 //- Find nearest intersection of line between start and end.
170 pointIndexHit findLine
176 //- Find any intersection of line between start and end.
177 pointIndexHit findLineAny
184 // Multiple point queries.
186 virtual void findNearest
188 const pointField& sample,
189 const scalarField& nearestDistSqr,
193 virtual void findLine
195 const pointField& start,
196 const pointField& end,
200 virtual void findLineAny
202 const pointField& start,
203 const pointField& end,
207 //- Get all intersections in order from start to end.
208 virtual void findLineAll
210 const pointField& start,
211 const pointField& end,
212 List<List<pointIndexHit> >&
215 //- From a set of points and indices get the region
216 virtual void getRegion
218 const List<pointIndexHit>&,
222 //- From a set of points and indices get the normal
223 virtual void getNormal
225 const List<pointIndexHit>&,
229 //- Determine type (inside/outside/mixed) for point. unknown if
230 // cannot be determined (e.g. non-manifold surface)
231 virtual void getVolumeType
238 // regIOobject implementation
240 bool writeData(Ostream&) const
242 notImplemented("searchableBox::writeData(Ostream&) const");
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 } // End namespace Foam
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 // ************************************************************************* //