OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

searchableSphere.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::searchableSphere
00027 
00028 Description
00029     Searching on sphere
00030 
00031 SourceFiles
00032     searchableSphere.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef searchableSphere_H
00037 #define searchableSphere_H
00038 
00039 #include "treeBoundBox.H"
00040 #include "searchableSurface.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of classes
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class searchableSphere Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class searchableSphere
00054 :
00055     public searchableSurface
00056 {
00057 private:
00058 
00059     // Private Member Data
00060 
00061         //- Centre point
00062         const point centre_;
00063 
00064         //- Radius squared
00065         const scalar radius_;
00066 
00067         //- Names of regions
00068         mutable wordList regions_;
00069 
00070 
00071     // Private Member Functions
00072 
00073         //- Find nearest point on sphere.
00074         pointIndexHit findNearest
00075         (
00076             const point& sample,
00077             const scalar nearestDistSqr
00078         ) const;
00079 
00080         //- Find intersection with sphere
00081         void findLineAll
00082         (
00083             const point& start,
00084             const point& end,
00085             pointIndexHit& near,
00086             pointIndexHit& far
00087         ) const;
00088 
00089 
00090         //- Disallow default bitwise copy construct
00091         searchableSphere(const searchableSphere&);
00092 
00093         //- Disallow default bitwise assignment
00094         void operator=(const searchableSphere&);
00095 
00096 
00097 public:
00098 
00099     //- Runtime type information
00100     TypeName("searchableSphere");
00101 
00102 
00103     // Constructors
00104 
00105         //- Construct from components
00106         searchableSphere(const IOobject& io, const point&, const scalar radius);
00107 
00108         //- Construct from dictionary (used by searchableSurface)
00109         searchableSphere
00110         (
00111             const IOobject& io,
00112             const dictionary& dict
00113         );
00114 
00115     // Destructor
00116 
00117         virtual ~searchableSphere();
00118 
00119 
00120     // Member Functions
00121 
00122         virtual const wordList& regions() const;
00123 
00124         //- Whether supports volume type below
00125         virtual bool hasVolumeType() const
00126         {
00127             return true;
00128         }
00129 
00130         //- Range of local indices that can be returned.
00131         virtual label size() const
00132         {
00133             return 1;
00134         }
00135 
00136 
00137         // Multiple point queries.
00138 
00139             virtual void findNearest
00140             (
00141                 const pointField& sample,
00142                 const scalarField& nearestDistSqr,
00143                 List<pointIndexHit>&
00144             ) const;
00145 
00146             virtual void findLine
00147             (
00148                 const pointField& start,
00149                 const pointField& end,
00150                 List<pointIndexHit>&
00151             ) const;
00152 
00153             virtual void findLineAny
00154             (
00155                 const pointField& start,
00156                 const pointField& end,
00157                 List<pointIndexHit>&
00158             ) const;
00159 
00160             //- Get all intersections in order from start to end.
00161             virtual void findLineAll
00162             (
00163                 const pointField& start,
00164                 const pointField& end,
00165                 List<List<pointIndexHit> >&
00166             ) const;
00167 
00168             //- From a set of points and indices get the region
00169             virtual void getRegion
00170             (
00171                 const List<pointIndexHit>&,
00172                 labelList& region
00173             ) const;
00174 
00175             //- From a set of points and indices get the normal
00176             virtual void getNormal
00177             (
00178                 const List<pointIndexHit>&,
00179                 vectorField& normal
00180             ) const;
00181 
00182             //- Determine type (inside/outside/mixed) for point. unknown if
00183             //  cannot be determined (e.g. non-manifold surface)
00184             virtual void getVolumeType
00185             (
00186                 const pointField&,
00187                 List<volumeType>&
00188             ) const;
00189 
00190 
00191         // regIOobject implementation
00192 
00193             bool writeData(Ostream&) const
00194             {
00195                 notImplemented("searchableSphere::writeData(Ostream&) const");
00196                 return false;
00197             }
00198 
00199 };
00200 
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 } // End namespace Foam
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #endif
00209 
00210 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd