initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / searchableSurface / searchableSphere.H
blob297890b9db1b6e4568db5a65ca6d2055fd25777e
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::searchableSphere
28 Description
29     Searching on sphere
31 SourceFiles
32     searchableSphere.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableSphere_H
37 #define searchableSphere_H
39 #include "treeBoundBox.H"
40 #include "searchableSurface.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 // Forward declaration of classes
49 /*---------------------------------------------------------------------------*\
50                            Class searchableSphere Declaration
51 \*---------------------------------------------------------------------------*/
53 class searchableSphere
55     public searchableSurface
57 private:
59     // Private Member Data
61         //- Centre point
62         const point centre_;
64         //- Radius squared
65         const scalar radius_;
67         //- Names of regions
68         mutable wordList regions_;
71     // Private Member Functions
73         //- Find nearest point on sphere.
74         pointIndexHit findNearest
75         (
76             const point& sample,
77             const scalar nearestDistSqr
78         ) const;
80         //- Find intersection with sphere
81         void findLineAll
82         (
83             const point& start,
84             const point& end,
85             pointIndexHit& near,
86             pointIndexHit& far
87         ) const;
90         //- Disallow default bitwise copy construct
91         searchableSphere(const searchableSphere&);
93         //- Disallow default bitwise assignment
94         void operator=(const searchableSphere&);
97 public:
99     //- Runtime type information
100     TypeName("searchableSphere");
103     // Constructors
105         //- Construct from components
106         searchableSphere(const IOobject& io, const point&, const scalar radius);
108         //- Construct from dictionary (used by searchableSurface)
109         searchableSphere
110         (
111             const IOobject& io,
112             const dictionary& dict
113         );
115     // Destructor
117         virtual ~searchableSphere();
120     // Member Functions
122         virtual const wordList& regions() const;
124         //- Whether supports volume type below
125         virtual bool hasVolumeType() const
126         {
127             return true;
128         }
130         //- Range of local indices that can be returned.
131         virtual label size() const
132         {
133             return 1;
134         }
137         // Multiple point queries.
139             virtual void findNearest
140             (
141                 const pointField& sample,
142                 const scalarField& nearestDistSqr,
143                 List<pointIndexHit>&
144             ) const;
146             virtual void findLine
147             (
148                 const pointField& start,
149                 const pointField& end,
150                 List<pointIndexHit>&
151             ) const;
153             virtual void findLineAny
154             (
155                 const pointField& start,
156                 const pointField& end,
157                 List<pointIndexHit>&
158             ) const;
160             //- Get all intersections in order from start to end.
161             virtual void findLineAll
162             (
163                 const pointField& start,
164                 const pointField& end,
165                 List<List<pointIndexHit> >&
166             ) const;
168             //- From a set of points and indices get the region
169             virtual void getRegion
170             (
171                 const List<pointIndexHit>&,
172                 labelList& region
173             ) const;
175             //- From a set of points and indices get the normal
176             virtual void getNormal
177             (
178                 const List<pointIndexHit>&,
179                 vectorField& normal
180             ) const;
182             //- Determine type (inside/outside/mixed) for point. unknown if
183             //  cannot be determined (e.g. non-manifold surface)
184             virtual void getVolumeType
185             (
186                 const pointField&,
187                 List<volumeType>&
188             ) const;
191         // regIOobject implementation
193             bool writeData(Ostream&) const
194             {
195                 notImplemented("searchableSphere::writeData(Ostream&) const");
196                 return false;
197             }
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace Foam
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 #endif
210 // ************************************************************************* //