Added linuxIA64 compilation options
[OpenFOAM-1.6.x.git] / src / meshTools / searchableSurface / searchableBox.H
blob9d1f2e8217ef3db841ebf9d1c8b4f5796c34b866
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::searchableBox
28 Description
29     Searching on bounding box
31 SourceFiles
32     searchableBox.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableBox_H
37 #define searchableBox_H
39 #include "searchableSurface.H"
40 #include "treeBoundBox.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 // Forward declaration of classes
49 /*---------------------------------------------------------------------------*\
50                            Class searchableBox Declaration
51 \*---------------------------------------------------------------------------*/
53 class searchableBox
55     public searchableSurface,
56     public treeBoundBox
58 private:
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
69         (
70             const direction dir,
71             const point& planePt,
72             pointIndexHit& info
73         ) const;
75         //- Returns miss or hit with face (0..5)
76         pointIndexHit findNearest
77         (
78             const point& bbMid,
79             const point& sample,
80             const scalar nearestDistSqr
81         ) const;
84         //- Disallow default bitwise copy construct
85         searchableBox(const searchableBox&);
87         //- Disallow default bitwise assignment
88         void operator=(const searchableBox&);
91 public:
93     //- Runtime type information
94     TypeName("searchableBox");
97     // Constructors
99         //- Construct from components
100         searchableBox(const IOobject& io, const treeBoundBox& bb);
102         //- Construct from dictionary (used by searchableSurface)
103         searchableBox
104         (
105             const IOobject& io,
106             const dictionary& dict
107         );
109     // Destructor
111         virtual ~searchableBox();
114     // Member Functions
116         virtual const wordList& regions() const;
118         //- Whether supports volume type below
119         virtual bool hasVolumeType() const
120         {
121             return true;
122         }
124         //- Range of local indices that can be returned.
125         virtual label size() const
126         {
127             return 6;
128         }
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
138             (
139                 const point& sample,
140                 const scalar nearestDistSqr
141             ) const;
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
148             (
149                 const point& sample,
150                 const scalar nearestDistSqr
151             ) const;
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
157             //  sets:
158             //  - tightest  : bounding box
159             //  - linePoint : corresponding nearest point on line
160             pointIndexHit findNearest
161             (
162                 const linePointRef& ln,
163                 treeBoundBox& tightest,
164                 point& linePoint
165             ) const;
167             //- Find nearest intersection of line between start and end.
168             pointIndexHit findLine
169             (
170                 const point& start,
171                 const point& end
172             ) const;
174             //- Find any intersection of line between start and end.
175             pointIndexHit findLineAny
176             (
177                 const point& start,
178                 const point& end
179             ) const;
182         // Multiple point queries.
184             virtual void findNearest
185             (
186                 const pointField& sample,
187                 const scalarField& nearestDistSqr,
188                 List<pointIndexHit>&
189             ) const;
191             virtual void findLine
192             (
193                 const pointField& start,
194                 const pointField& end,
195                 List<pointIndexHit>&
196             ) const;
198             virtual void findLineAny
199             (
200                 const pointField& start,
201                 const pointField& end,
202                 List<pointIndexHit>&
203             ) const;
205             //- Get all intersections in order from start to end.
206             virtual void findLineAll
207             (
208                 const pointField& start,
209                 const pointField& end,
210                 List<List<pointIndexHit> >&
211             ) const;
213             //- From a set of points and indices get the region
214             virtual void getRegion
215             (
216                 const List<pointIndexHit>&,
217                 labelList& region
218             ) const;
220             //- From a set of points and indices get the normal
221             virtual void getNormal
222             (
223                 const List<pointIndexHit>&,
224                 vectorField& normal
225             ) const;
227             //- Determine type (inside/outside/mixed) for point. unknown if
228             //  cannot be determined (e.g. non-manifold surface)
229             virtual void getVolumeType
230             (
231                 const pointField&,
232                 List<volumeType>&
233             ) const;
236         // regIOobject implementation
238             bool writeData(Ostream&) const
239             {
240                 notImplemented("searchableBox::writeData(Ostream&) const");
241                 return false;
242             }
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 } // End namespace Foam
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 #endif
255 // ************************************************************************* //