correction to d4edb38234db8268907f04836d49bb93461b8a88
[OpenFOAM-1.5.x.git] / src / meshTools / searchableSurface / searchableSurfaces.H
blob4e6c1bc2edfbc27c468e4b2a3331412332e5f037
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::searchableSurfaces
28 Description
29     Container for searchableSurfaces.
31 SourceFiles
32     searchableSurfaces.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef searchableSurfaces_H
37 #define searchableSurfaces_H
39 #include "searchableSurface.H"
40 #include "labelPair.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 // Forward declaration of classes
49 /*---------------------------------------------------------------------------*\
50                            Class searchableSurfaces Declaration
51 \*---------------------------------------------------------------------------*/
53 class searchableSurfaces
55     public PtrList<searchableSurface>
57     // Private data
59         //- Surface names
60         wordList names_;
62         //- Region names per surface
63         List<wordList> regionNames_;
65         ////- From global region name to surface and region on surface
66         //HashTable<labelPair> regionNames_;
68         //- Indices of all surfaces. Precalculated and stored.
69         labelList allSurfaces_;
72         //- Disallow default bitwise copy construct
73         searchableSurfaces(const searchableSurfaces&);
75         //- Disallow default bitwise assignment
76         void operator=(const searchableSurfaces&);
79 public:
81     ClassName("searchableSurfaces");
83     // Constructors
85         //- Construct with length specified. Fill later.
86         explicit searchableSurfaces(const label);
89         ////- Construct from list of dictionaries
90         //searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
92         //- Construct from dictionary
93         searchableSurfaces(const IOobject&, const dictionary&);
96     // Member Functions
98         const wordList& names() const
99         {
100             return names_;
101         }
102         wordList& names()
103         {
104             return names_;
105         }
107         const List<wordList>& regionNames() const
108         {
109             return regionNames_;
110         }
111         List<wordList>& regionNames()
112         {
113             return regionNames_;
114         }
117         ////- If adding surfaces 'by hand'
118         //HashTable<labelPair>& regionNames()
119         //{
120         //    return regionNames_;
121         //}
122         ////- Get surface and region for a name
123         //const labelPair& surfaceRegion(const word& globalRegion) const
124         //{
125         //    return regionNames_[globalRegion];
126         //}
128         //- Find index of surface. Return -1 if not found.
129         label findSurfaceID(const word& name) const;
132         // Multiple point queries.
134             //- Find any intersection. Return hit point information and
135             //  surface number. If multiple surfaces hit the first surface
136             //  is returned, not necessarily the nearest (to start).
137             void findAnyIntersection
138             (
139                 const pointField& start,
140                 const pointField& end,
141                 labelList& surfaces,
142                 List<pointIndexHit>&
143             ) const;
145             //- Find all intersections in order from start to end. Returns for
146             //  every hit the surface and the hit info.
147             void findAllIntersections
148             (
149                 const pointField& start,
150                 const pointField& end,
151                 labelListList& surfaces,
152                 List<List<pointIndexHit> >& surfaceHits
153             ) const;
155             //- Find nearest. Return -1 (and a miss()) or surface and nearest
156             //  point.
157             void findNearest
158             (
159                 const pointField&,
160                 const scalarField& nearestDistSqr,
161                 labelList& surfaces,
162                 List<pointIndexHit>&
163             ) const;
166         // Single point queries
168             //- Calculate point which is on a set of surfaces.
169             pointIndexHit facesIntersection
170             (
171                 const scalar initialDistSqr,
172                 const scalar convergenceDistSqr,
173                 const point& start
174             ) const;
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 #endif
187 // ************************************************************************* //