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

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