Fix tutorials: coupled/conjugateHeatFoam/conjugateCavity: fix Allrun file
[OpenFOAM-1.6-ext.git] / src / meshTools / searchableSurface / searchableBox.H
blobd8b50cd61873259ed628264fc4467f59a9cb93f4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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         }
130         //- Get representative set of element coordinates
131         //  Usually the element centres (should be of length size()).
132         virtual pointField coordinates() const;
134         // Single point queries.
136             //- Calculate nearest point on surface. Returns
137             //  - bool : any point found nearer than nearestDistSqr
138             //  - label: relevant index in surface (=face 0..5)
139             //  - point: actual nearest point found
140             pointIndexHit findNearest
141             (
142                 const point& sample,
143                 const scalar nearestDistSqr
144             ) const;
146             //- Calculate nearest point on edge. Returns
147             //  - bool : any point found nearer than nearestDistSqr
148             //  - label: relevant index in surface(=?)
149             //  - point: actual nearest point found
150             pointIndexHit findNearestOnEdge
151             (
152                 const point& sample,
153                 const scalar nearestDistSqr
154             ) const;
156             //- Find nearest to segment. Returns
157             //  - bool : any point found?
158             //  - label: relevant index in shapes (=face 0..5)
159             //  - point: actual nearest point found
160             //  sets:
161             //  - tightest  : bounding box
162             //  - linePoint : corresponding nearest point on line
163             pointIndexHit findNearest
164             (
165                 const linePointRef& ln,
166                 treeBoundBox& tightest,
167                 point& linePoint
168             ) const;
170             //- Find nearest intersection of line between start and end.
171             pointIndexHit findLine
172             (
173                 const point& start,
174                 const point& end
175             ) const;
177             //- Find any intersection of line between start and end.
178             pointIndexHit findLineAny
179             (
180                 const point& start,
181                 const point& end
182             ) const;
185         // Multiple point queries.
187             virtual void findNearest
188             (
189                 const pointField& sample,
190                 const scalarField& nearestDistSqr,
191                 List<pointIndexHit>&
192             ) const;
194             virtual void findLine
195             (
196                 const pointField& start,
197                 const pointField& end,
198                 List<pointIndexHit>&
199             ) const;
201             virtual void findLineAny
202             (
203                 const pointField& start,
204                 const pointField& end,
205                 List<pointIndexHit>&
206             ) const;
208             //- Get all intersections in order from start to end.
209             virtual void findLineAll
210             (
211                 const pointField& start,
212                 const pointField& end,
213                 List<List<pointIndexHit> >&
214             ) const;
216             //- From a set of points and indices get the region
217             virtual void getRegion
218             (
219                 const List<pointIndexHit>&,
220                 labelList& region
221             ) const;
223             //- From a set of points and indices get the normal
224             virtual void getNormal
225             (
226                 const List<pointIndexHit>&,
227                 vectorField& normal
228             ) const;
230             //- Determine type (inside/outside/mixed) for point. unknown if
231             //  cannot be determined (e.g. non-manifold surface)
232             virtual void getVolumeType
233             (
234                 const pointField&,
235                 List<volumeType>&
236             ) const;
239         // regIOobject implementation
241             bool writeData(Ostream&) const
242             {
243                 notImplemented("searchableBox::writeData(Ostream&) const");
244                 return false;
245             }
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 } // End namespace Foam
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 #endif
258 // ************************************************************************* //