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

searchableSurfaces.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::searchableSurfaces
00027 
00028 Description
00029     Container for searchableSurfaces.
00030 
00031 SourceFiles
00032     searchableSurfaces.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef searchableSurfaces_H
00037 #define searchableSurfaces_H
00038 
00039 #include "searchableSurface.H"
00040 #include "labelPair.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 // Forward declaration of classes
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class searchableSurfaces Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class searchableSurfaces
00054 :
00055     public PtrList<searchableSurface>
00056 {
00057     // Private data
00058 
00059         //- Surface names
00060         wordList names_;
00061 
00062         //- Region names per surface
00063         List<wordList> regionNames_;
00064 
00066         //HashTable<labelPair> regionNames_;
00067 
00068         //- Indices of all surfaces. Precalculated and stored.
00069         labelList allSurfaces_;
00070 
00071 
00072     // Private Member Functions
00073 
00074         //- Disallow default bitwise copy construct
00075         searchableSurfaces(const searchableSurfaces&);
00076 
00077         //- Disallow default bitwise assignment
00078         void operator=(const searchableSurfaces&);
00079 
00080 
00081 public:
00082 
00083     ClassName("searchableSurfaces");
00084 
00085     // Constructors
00086 
00087         //- Construct with length specified. Fill later.
00088         explicit searchableSurfaces(const label);
00089 
00090 
00092         //searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
00093 
00094         //- Construct from dictionary
00095         searchableSurfaces(const IOobject&, const dictionary&);
00096 
00097 
00098     // Member Functions
00099 
00100         const wordList& names() const
00101         {
00102             return names_;
00103         }
00104         wordList& names()
00105         {
00106             return names_;
00107         }
00108 
00109         const List<wordList>& regionNames() const
00110         {
00111             return regionNames_;
00112         }
00113         List<wordList>& regionNames()
00114         {
00115             return regionNames_;
00116         }
00117 
00118 
00120         //HashTable<labelPair>& regionNames()
00121         //{
00122         //    return regionNames_;
00123         //}
00125         //const labelPair& surfaceRegion(const word& globalRegion) const
00126         //{
00127         //    return regionNames_[globalRegion];
00128         //}
00129 
00130         //- Find index of surface. Return -1 if not found.
00131         label findSurfaceID(const word& name) const;
00132 
00133 
00134         // Multiple point queries.
00135 
00136             //- Find any intersection. Return hit point information and
00137             //  surface number. If multiple surfaces hit the first surface
00138             //  is returned, not necessarily the nearest (to start).
00139             void findAnyIntersection
00140             (
00141                 const pointField& start,
00142                 const pointField& end,
00143                 labelList& surfaces,
00144                 List<pointIndexHit>&
00145             ) const;
00146 
00147             //- Find all intersections in order from start to end. Returns for
00148             //  every hit the surface and the hit info.
00149             void findAllIntersections
00150             (
00151                 const pointField& start,
00152                 const pointField& end,
00153                 labelListList& surfaces,
00154                 List<List<pointIndexHit> >&
00155             ) const;
00156 
00157             //- Find nearest. Return -1 (and a miss()) or surface and nearest
00158             //  point.
00159             void findNearest
00160             (
00161                 const pointField&,
00162                 const scalarField& nearestDistSqr,
00163                 labelList& surfaces,
00164                 List<pointIndexHit>&
00165             ) const;
00166 
00167 
00168         // Single point queries
00169 
00170             //- Calculate point which is on a set of surfaces.
00171             pointIndexHit facesIntersection
00172             (
00173                 const scalar initialDistSqr,
00174                 const scalar convergenceDistSqr,
00175                 const point& start
00176             ) const;
00177 
00178 };
00179 
00180 
00181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00182 
00183 } // End namespace Foam
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 #endif
00188 
00189 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd