1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 Foam::searchableSurfaces
28 Container for searchableSurfaces.
33 \*---------------------------------------------------------------------------*/
35 #ifndef searchableSurfaces_H
36 #define searchableSurfaces_H
38 #include "searchableSurface.H"
39 #include "labelPair.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of classes
48 /*---------------------------------------------------------------------------*\
49 Class searchableSurfaces Declaration
50 \*---------------------------------------------------------------------------*/
52 class searchableSurfaces
54 public PtrList<searchableSurface>
61 //- Region names per surface
62 List<wordList> regionNames_;
64 ////- From global region name to surface and region on surface
65 //HashTable<labelPair> regionNames_;
67 //- Indices of all surfaces. Precalculated and stored.
68 labelList allSurfaces_;
71 // Private Member Functions
73 //- Disallow default bitwise copy construct
74 searchableSurfaces(const searchableSurfaces&);
76 //- Disallow default bitwise assignment
77 void operator=(const searchableSurfaces&);
82 ClassName("searchableSurfaces");
86 //- Construct with length specified. Fill later.
87 explicit searchableSurfaces(const label);
90 ////- Construct from list of dictionaries
91 //searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
93 //- Construct from dictionary
94 searchableSurfaces(const IOobject&, const dictionary&);
99 const wordList& names() const
108 const List<wordList>& regionNames() const
112 List<wordList>& regionNames()
118 ////- If adding surfaces 'by hand'
119 //HashTable<labelPair>& regionNames()
121 // return regionNames_;
123 ////- Get surface and region for a name
124 //const labelPair& surfaceRegion(const word& globalRegion) const
126 // return regionNames_[globalRegion];
129 //- Find index of surface. Return -1 if not found.
130 label findSurfaceID(const word& name) const;
133 // Multiple point queries.
135 //- Find any intersection. Return hit point information and
136 // surface number. If multiple surfaces hit the first surface
137 // is returned, not necessarily the nearest (to start).
138 void findAnyIntersection
140 const pointField& start,
141 const pointField& end,
146 //- Find all intersections in order from start to end. Returns for
147 // every hit the surface and the hit info.
148 void findAllIntersections
150 const pointField& start,
151 const pointField& end,
152 labelListList& surfaces,
153 List<List<pointIndexHit> >&
156 //- Find nearest. Return -1 (and a miss()) or surface and nearest
161 const scalarField& nearestDistSqr,
167 // Single point queries
169 //- Calculate point which is on a set of surfaces.
170 pointIndexHit facesIntersection
172 const scalar initialDistSqr,
173 const scalar convergenceDistSqr,
180 //- Return const and non-const reference to searchableSurface by index.
181 using PtrList<searchableSurface>::operator[];
183 //- Return const reference to searchableSurface by name.
184 const searchableSurface& operator[](const word&) const;
186 //- Return reference to searchableSurface by name.
187 searchableSurface& operator[](const word&);
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 // ************************************************************************* //