1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 Foam::searchableSphere
33 \*---------------------------------------------------------------------------*/
35 #ifndef searchableSphere_H
36 #define searchableSphere_H
38 #include "treeBoundBox.H"
39 #include "searchableSurface.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
48 /*---------------------------------------------------------------------------*\
49 Class searchableSphere Declaration
50 \*---------------------------------------------------------------------------*/
52 class searchableSphere
54 public searchableSurface
58 // Private Member Data
67 mutable wordList regions_;
70 // Private Member Functions
72 //- Find nearest point on sphere.
73 pointIndexHit findNearest
76 const scalar nearestDistSqr
79 //- Find intersection with sphere
89 //- Disallow default bitwise copy construct
90 searchableSphere(const searchableSphere&);
92 //- Disallow default bitwise assignment
93 void operator=(const searchableSphere&);
98 //- Runtime type information
99 TypeName("searchableSphere");
104 //- Construct from components
105 searchableSphere(const IOobject& io, const point&, const scalar radius);
107 //- Construct from dictionary (used by searchableSurface)
111 const dictionary& dict
115 virtual ~searchableSphere();
120 virtual const wordList& regions() const;
122 //- Whether supports volume type below
123 virtual bool hasVolumeType() const
128 //- Range of local indices that can be returned.
129 virtual label size() const
134 //- Get representative set of element coordinates
135 // Usually the element centres (should be of length size()).
136 virtual pointField coordinates() const
138 return pointField(1, centre_);
142 // Multiple point queries.
144 virtual void findNearest
146 const pointField& sample,
147 const scalarField& nearestDistSqr,
151 virtual void findLine
153 const pointField& start,
154 const pointField& end,
158 virtual void findLineAny
160 const pointField& start,
161 const pointField& end,
165 //- Get all intersections in order from start to end.
166 virtual void findLineAll
168 const pointField& start,
169 const pointField& end,
170 List<List<pointIndexHit> >&
173 //- From a set of points and indices get the region
174 virtual void getRegion
176 const List<pointIndexHit>&,
180 //- From a set of points and indices get the normal
181 virtual void getNormal
183 const List<pointIndexHit>&,
187 //- Determine type (inside/outside/mixed) for point. unknown if
188 // cannot be determined (e.g. non-manifold surface)
189 virtual void getVolumeType
196 // regIOobject implementation
198 bool writeData(Ostream&) const
200 notImplemented("searchableSphere::writeData(Ostream&) const");
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 } // End namespace Foam
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 // ************************************************************************* //