1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 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
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
26 Foam::searchableSphere
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableSphere_H
37 #define searchableSphere_H
39 #include "treeBoundBox.H"
40 #include "searchableSurface.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of classes
49 /*---------------------------------------------------------------------------*\
50 Class searchableSphere Declaration
51 \*---------------------------------------------------------------------------*/
53 class searchableSphere
55 public searchableSurface
59 // Private Member Data
68 mutable wordList regions_;
71 // Private Member Functions
73 //- Find nearest point on sphere.
74 pointIndexHit findNearest
77 const scalar nearestDistSqr
80 //- Find intersection with sphere
90 //- Disallow default bitwise copy construct
91 searchableSphere(const searchableSphere&);
93 //- Disallow default bitwise assignment
94 void operator=(const searchableSphere&);
99 //- Runtime type information
100 TypeName("searchableSphere");
105 //- Construct from components
106 searchableSphere(const IOobject& io, const point&, const scalar radius);
108 //- Construct from dictionary (used by searchableSurface)
112 const dictionary& dict
117 virtual ~searchableSphere();
122 virtual const wordList& regions() const;
124 //- Whether supports volume type below
125 virtual bool hasVolumeType() const
130 //- Range of local indices that can be returned.
131 virtual label size() const
136 //- Get representative set of element coordinates
137 // Usually the element centres (should be of length size()).
138 virtual pointField coordinates() const
140 return pointField(1, centre_);
144 // Multiple point queries.
146 virtual void findNearest
148 const pointField& sample,
149 const scalarField& nearestDistSqr,
153 virtual void findLine
155 const pointField& start,
156 const pointField& end,
160 virtual void findLineAny
162 const pointField& start,
163 const pointField& end,
167 //- Get all intersections in order from start to end.
168 virtual void findLineAll
170 const pointField& start,
171 const pointField& end,
172 List<List<pointIndexHit> >&
175 //- From a set of points and indices get the region
176 virtual void getRegion
178 const List<pointIndexHit>&,
182 //- From a set of points and indices get the normal
183 virtual void getNormal
185 const List<pointIndexHit>&,
189 //- Determine type (inside/outside/mixed) for point. unknown if
190 // cannot be determined (e.g. non-manifold surface)
191 virtual void getVolumeType
198 // regIOobject implementation
200 bool writeData(Ostream&) const
202 notImplemented("searchableSphere::writeData(Ostream&) const");
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 // ************************************************************************* //