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

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