compiler bug
[OpenFOAM-1.5.x.git] / src / meshTools / searchableSurface / searchableBox.H
blob1c51311511b0840fd27bc81d1d67e26f6bfc67e9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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         }
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
132             (
133                 const point& sample,
134                 const scalar nearestDistSqr
135             ) const;
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
142             (
143                 const point& sample,
144                 const scalar nearestDistSqr
145             ) const;
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
151             //  sets:
152             //  - tightest  : bounding box
153             //  - linePoint : corresponding nearest point on line
154             pointIndexHit findNearest
155             (
156                 const linePointRef& ln,
157                 treeBoundBox& tightest,
158                 point& linePoint
159             ) const;
161             //- Find nearest intersection of line between start and end.
162             pointIndexHit findLine
163             (
164                 const point& start,
165                 const point& end
166             ) const;
168             //- Find any intersection of line between start and end.
169             pointIndexHit findLineAny
170             (
171                 const point& start,
172                 const point& end
173             ) const;
176         // Multiple point queries.
178             virtual void findNearest
179             (
180                 const pointField& sample,
181                 const scalarField& nearestDistSqr,
182                 List<pointIndexHit>&
183             ) const;
185             virtual void findLine
186             (
187                 const pointField& start,
188                 const pointField& end,
189                 List<pointIndexHit>&
190             ) const;
192             virtual void findLineAny
193             (
194                 const pointField& start,
195                 const pointField& end,
196                 List<pointIndexHit>&
197             ) const;
199             //- Get all intersections in order from start to end.
200             virtual void findLineAll
201             (
202                 const pointField& start,
203                 const pointField& end,
204                 List<List<pointIndexHit> >&
205             ) const;
207             //- From a set of points and indices get the region
208             virtual void getRegion
209             (
210                 const List<pointIndexHit>&,
211                 labelList& region
212             ) const;
214             //- From a set of points and indices get the normal
215             virtual void getNormal
216             (
217                 const List<pointIndexHit>&,
218                 vectorField& normal
219             ) const;
221             //- Determine type (inside/outside/mixed) for point. unknown if
222             //  cannot be determined (e.g. non-manifold surface)
223             virtual void getVolumeType
224             (
225                 const pointField&,
226                 List<volumeType>&
227             ) const;
230         // regIOobject implementation
232             bool writeData(Ostream&) const
233             {
234                 notImplemented("searchableBox::writeData(Ostream&) const");
235                 return false;
236             }
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 } // End namespace Foam
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 #endif
249 // ************************************************************************* //