BUG: PointEdgeWave : n cyclics bool instead of label
[OpenFOAM-1.6.x.git] / src / meshTools / searchableSurface / searchableSphere.H
blobfb4aeb22f81c9d3c37afc69da4c549880af66362
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         }
136         //- Get representative set of element coordinates
137         //  Usually the element centres (should be of length size()).
138         virtual pointField coordinates() const
139         {
140             return pointField(1, centre_);
141         }
144         // Multiple point queries.
146             virtual void findNearest
147             (
148                 const pointField& sample,
149                 const scalarField& nearestDistSqr,
150                 List<pointIndexHit>&
151             ) const;
153             virtual void findLine
154             (
155                 const pointField& start,
156                 const pointField& end,
157                 List<pointIndexHit>&
158             ) const;
160             virtual void findLineAny
161             (
162                 const pointField& start,
163                 const pointField& end,
164                 List<pointIndexHit>&
165             ) const;
167             //- Get all intersections in order from start to end.
168             virtual void findLineAll
169             (
170                 const pointField& start,
171                 const pointField& end,
172                 List<List<pointIndexHit> >&
173             ) const;
175             //- From a set of points and indices get the region
176             virtual void getRegion
177             (
178                 const List<pointIndexHit>&,
179                 labelList& region
180             ) const;
182             //- From a set of points and indices get the normal
183             virtual void getNormal
184             (
185                 const List<pointIndexHit>&,
186                 vectorField& normal
187             ) const;
189             //- Determine type (inside/outside/mixed) for point. unknown if
190             //  cannot be determined (e.g. non-manifold surface)
191             virtual void getVolumeType
192             (
193                 const pointField&,
194                 List<volumeType>&
195             ) const;
198         // regIOobject implementation
200             bool writeData(Ostream&) const
201             {
202                 notImplemented("searchableSphere::writeData(Ostream&) const");
203                 return false;
204             }
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 #endif
217 // ************************************************************************* //