Forward compatibility: flex
[foam-extend-3.2.git] / src / meshTools / searchableSurface / searchableCylinder.H
blob023bf9f2582529d7da4ae1aa1848c41bd2d23527
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::searchableCylinder
27 Description
28     Searching on cylinder
30 SourceFiles
31     searchableCylinder.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef searchableCylinder_H
36 #define searchableCylinder_H
38 #include "treeBoundBox.H"
39 #include "searchableSurface.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 // Forward declaration of classes
48 /*---------------------------------------------------------------------------*\
49                            Class searchableCylinder Declaration
50 \*---------------------------------------------------------------------------*/
52 class searchableCylinder
54     public searchableSurface
56 private:
58     // Private Member Data
60         //- 'left' point
61         const point point1_;
63         //- 'right' point
64         const point point2_;
66         //- length of vector point2-point1
67         const scalar magDir_;
69         //- normalised vector point2-point1
70         const vector unitDir_;
72         //- Radius squared
73         const scalar radius_;
75         //- Names of regions
76         mutable wordList regions_;
79     // Private Member Functions
81         //- Find nearest point on cylinder.
82         pointIndexHit findNearest
83         (
84             const point& sample,
85             const scalar nearestDistSqr
86         ) const;
88         scalar radius2(const point& pt) const;
90         //- Find intersection with cylinder
91         void findLineAll
92         (
93             const point& start,
94             const point& end,
95             pointIndexHit& near,
96             pointIndexHit& far
97         ) const;
100         //- Disallow default bitwise copy construct
101         searchableCylinder(const searchableCylinder&);
103         //- Disallow default bitwise assignment
104         void operator=(const searchableCylinder&);
107 public:
109     //- Runtime type information
110     TypeName("searchableCylinder");
113     // Constructors
115         //- Construct from components
116         searchableCylinder
117         (
118             const IOobject& io,
119             const point&,
120             const point&,
121             const scalar radius
122         );
124         //- Construct from dictionary (used by searchableSurface)
125         searchableCylinder
126         (
127             const IOobject& io,
128             const dictionary& dict
129         );
131     // Destructor
133         virtual ~searchableCylinder();
136     // Member Functions
138         virtual const wordList& regions() const;
140         //- Whether supports volume type below
141         virtual bool hasVolumeType() const
142         {
143             return true;
144         }
146         //- Range of local indices that can be returned.
147         virtual label size() const
148         {
149             return 1;
150         }
152         //- Get representative set of element coordinates
153         //  Usually the element centres (should be of length size()).
154         virtual pointField coordinates() const;
157         // Multiple point queries.
159             virtual void findNearest
160             (
161                 const pointField& sample,
162                 const scalarField& nearestDistSqr,
163                 List<pointIndexHit>&
164             ) const;
166             virtual void findLine
167             (
168                 const pointField& start,
169                 const pointField& end,
170                 List<pointIndexHit>&
171             ) const;
173             virtual void findLineAny
174             (
175                 const pointField& start,
176                 const pointField& end,
177                 List<pointIndexHit>&
178             ) const;
180             //- Get all intersections in order from start to end.
181             virtual void findLineAll
182             (
183                 const pointField& start,
184                 const pointField& end,
185                 List<List<pointIndexHit> >&
186             ) const;
188             //- From a set of points and indices get the region
189             virtual void getRegion
190             (
191                 const List<pointIndexHit>&,
192                 labelList& region
193             ) const;
195             //- From a set of points and indices get the normal
196             virtual void getNormal
197             (
198                 const List<pointIndexHit>&,
199                 vectorField& normal
200             ) const;
202             //- Determine type (inside/outside/mixed) for point. unknown if
203             //  cannot be determined (e.g. non-manifold surface)
204             virtual void getVolumeType
205             (
206                 const pointField&,
207                 List<volumeType>&
208             ) const;
211         // regIOobject implementation
213             bool writeData(Ostream&) const
214             {
215                 notImplemented("searchableCylinder::writeData(Ostream&) const");
216                 return false;
217             }
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 } // End namespace Foam
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 #endif
230 // ************************************************************************* //