FreeFOAM The Cross-Platform CFD Toolkit
searchableSurfaces.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::searchableSurfaces
26 
27 Description
28  Container for searchableSurfaces.
29 
30 SourceFiles
31  searchableSurfaces.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef searchableSurfaces_H
36 #define searchableSurfaces_H
37 
38 #include "searchableSurface.H"
39 #include <OpenFOAM/labelPair.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 
48 /*---------------------------------------------------------------------------*\
49  Class searchableSurfaces Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public PtrList<searchableSurface>
55 {
56  // Private data
57 
58  //- Surface names
59  wordList names_;
60 
61  //- Region names per surface
62  List<wordList> regionNames_;
63 
65  //HashTable<labelPair> regionNames_;
66 
67  //- Indices of all surfaces. Precalculated and stored.
68  labelList allSurfaces_;
69 
70 
71  // Private Member Functions
72 
73  //- Disallow default bitwise copy construct
75 
76  //- Disallow default bitwise assignment
77  void operator=(const searchableSurfaces&);
78 
79 
80 public:
81 
82  ClassName("searchableSurfaces");
83 
84  // Constructors
85 
86  //- Construct with length specified. Fill later.
87  explicit searchableSurfaces(const label);
88 
89 
91  //searchableSurfaces(const IOobject&, const PtrList<dictionary>&);
92 
93  //- Construct from dictionary
94  searchableSurfaces(const IOobject&, const dictionary&);
95 
96 
97  // Member Functions
98 
99  const wordList& names() const
100  {
101  return names_;
102  }
104  {
105  return names_;
106  }
107 
109  {
110  return regionNames_;
111  }
113  {
114  return regionNames_;
115  }
116 
117 
119  //HashTable<labelPair>& regionNames()
120  //{
121  // return regionNames_;
122  //}
124  //const labelPair& surfaceRegion(const word& globalRegion) const
125  //{
126  // return regionNames_[globalRegion];
127  //}
128 
129  //- Find index of surface. Return -1 if not found.
130  label findSurfaceID(const word& name) const;
131 
132 
133  // Multiple point queries.
134 
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).
139  (
140  const pointField& start,
141  const pointField& end,
142  labelList& surfaces,
144  ) const;
145 
146  //- Find all intersections in order from start to end. Returns for
147  // every hit the surface and the hit info.
149  (
150  const pointField& start,
151  const pointField& end,
152  labelListList& surfaces,
154  ) const;
155 
156  //- Find nearest. Return -1 (and a miss()) or surface and nearest
157  // point.
158  void findNearest
159  (
160  const pointField&,
161  const scalarField& nearestDistSqr,
162  labelList& surfaces,
164  ) const;
165 
166 
167  // Single point queries
168 
169  //- Calculate point which is on a set of surfaces.
171  (
172  const scalar initialDistSqr,
173  const scalar convergenceDistSqr,
174  const point& start
175  ) const;
176 
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************ vim: set sw=4 sts=4 et: ************************ //