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

searchableCylinder.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::searchableCylinder
00027 
00028 Description
00029     Searching on cylinder
00030 
00031 SourceFiles
00032     searchableCylinder.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef searchableCylinder_H
00037 #define searchableCylinder_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 searchableCylinder Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class searchableCylinder
00054 :
00055     public searchableSurface
00056 {
00057 private:
00058 
00059     // Private Member Data
00060 
00061         //- 'left' point
00062         const point point1_;
00063 
00064         //- 'right' point
00065         const point point2_;
00066 
00067         //- length of vector point2-point1
00068         const scalar magDir_;
00069 
00070         //- normalised vector point2-point1
00071         const vector unitDir_;
00072 
00073         //- Radius squared
00074         const scalar radius_;
00075 
00076         //- Names of regions
00077         mutable wordList regions_;
00078 
00079 
00080     // Private Member Functions
00081 
00082         //- Find nearest point on cylinder.
00083         pointIndexHit findNearest
00084         (
00085             const point& sample,
00086             const scalar nearestDistSqr
00087         ) const;
00088 
00089         scalar radius2(const point& pt) const;
00090 
00091         //- Find intersection with cylinder
00092         void findLineAll
00093         (
00094             const point& start,
00095             const point& end,
00096             pointIndexHit& near,
00097             pointIndexHit& far
00098         ) const;
00099 
00100 
00101         //- Disallow default bitwise copy construct
00102         searchableCylinder(const searchableCylinder&);
00103 
00104         //- Disallow default bitwise assignment
00105         void operator=(const searchableCylinder&);
00106 
00107 
00108 public:
00109 
00110     //- Runtime type information
00111     TypeName("searchableCylinder");
00112 
00113 
00114     // Constructors
00115 
00116         //- Construct from components
00117         searchableCylinder
00118         (
00119             const IOobject& io,
00120             const point&,
00121             const point&,
00122             const scalar radius
00123         );
00124 
00125         //- Construct from dictionary (used by searchableSurface)
00126         searchableCylinder
00127         (
00128             const IOobject& io,
00129             const dictionary& dict
00130         );
00131 
00132     // Destructor
00133 
00134         virtual ~searchableCylinder();
00135 
00136 
00137     // Member Functions
00138 
00139         virtual const wordList& regions() const;
00140 
00141         //- Whether supports volume type below
00142         virtual bool hasVolumeType() const
00143         {
00144             return true;
00145         }
00146 
00147         //- Range of local indices that can be returned.
00148         virtual label size() const
00149         {
00150             return 1;
00151         }
00152 
00153 
00154         // Multiple point queries.
00155 
00156             virtual void findNearest
00157             (
00158                 const pointField& sample,
00159                 const scalarField& nearestDistSqr,
00160                 List<pointIndexHit>&
00161             ) const;
00162 
00163             virtual void findLine
00164             (
00165                 const pointField& start,
00166                 const pointField& end,
00167                 List<pointIndexHit>&
00168             ) const;
00169 
00170             virtual void findLineAny
00171             (
00172                 const pointField& start,
00173                 const pointField& end,
00174                 List<pointIndexHit>&
00175             ) const;
00176 
00177             //- Get all intersections in order from start to end.
00178             virtual void findLineAll
00179             (
00180                 const pointField& start,
00181                 const pointField& end,
00182                 List<List<pointIndexHit> >&
00183             ) const;
00184 
00185             //- From a set of points and indices get the region
00186             virtual void getRegion
00187             (
00188                 const List<pointIndexHit>&,
00189                 labelList& region
00190             ) const;
00191 
00192             //- From a set of points and indices get the normal
00193             virtual void getNormal
00194             (
00195                 const List<pointIndexHit>&,
00196                 vectorField& normal
00197             ) const;
00198 
00199             //- Determine type (inside/outside/mixed) for point. unknown if
00200             //  cannot be determined (e.g. non-manifold surface)
00201             virtual void getVolumeType
00202             (
00203                 const pointField&,
00204                 List<volumeType>&
00205             ) const;
00206 
00207 
00208         // regIOobject implementation
00209 
00210             bool writeData(Ostream&) const
00211             {
00212                 notImplemented("searchableCylinder::writeData(Ostream&) const");
00213                 return false;
00214             }
00215 
00216 };
00217 
00218 
00219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00220 
00221 } // End namespace Foam
00222 
00223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00224 
00225 #endif
00226 
00227 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd