FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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