FreeFOAM The Cross-Platform CFD Toolkit
searchableSurfaceCollection.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::searchableSurfaceCollection
26 
27 Description
28  Set of transformed searchableSurfaces. Does not do boolean operations.
29  So when meshing might find parts 'inside'.
30 
31 SourceFiles
32  searchableSurfaceCollection.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef searchableSurfaceCollection_H
37 #define searchableSurfaceCollection_H
38 
39 #include "searchableSurface.H"
40 #include <meshTools/treeBoundBox.H>
42 #include <OpenFOAM/UPtrList.H>
43 #include <OpenFOAM/Switch.H>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 
52 /*---------------------------------------------------------------------------*\
53  Class searchableSurfaceCollection Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public searchableSurface
59 {
60 private:
61 
62  // Private Member Data
63 
64  // Per instance data
65 
66  //- instance name
67  wordList instance_;
68 
69  //- scaling vector
70  vectorField scale_;
71 
72  //- transformation
73  PtrList<coordinateSystem> transform_;
74 
76 
77  Switch mergeSubRegions_;
78 
79  //- offsets for indices coming from different surfaces
80  // (sized with size() of each surface)
81  labelList indexOffset_;
82 
83  //- Region names
84  mutable wordList regions_;
85  //- From individual regions to collection regions
86  mutable labelList regionOffset_;
87 
88 
89  // Private Member Functions
90 
91  //- Find point nearest to sample. Updates minDistSqr. Sets nearestInfo
92  // and surface index
93  void findNearest
94  (
95  const pointField& samples,
96  scalarField& minDistSqr,
97  List<pointIndexHit>& nearestInfo,
98  labelList& nearestSurf
99  ) const;
100 
101  //- Sort hits into per-surface bins. Misses are rejected.
102  // Maintains map back to position
103  void sortHits
104  (
105  const List<pointIndexHit>& info,
106  List<List<pointIndexHit> >& surfInfo,
107  labelListList& infoMap
108  ) const;
109 
110 
111  //- Disallow default bitwise copy construct
113 
114  //- Disallow default bitwise assignment
115  void operator=(const searchableSurfaceCollection&);
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("searchableSurfaceCollection");
122 
123 
124  // Constructors
125 
126  //- Construct from dictionary (used by searchableSurface)
128  (
129  const IOobject& io,
130  const dictionary& dict
131  );
132 
133  // Destructor
134 
136 
137 
138  // Member Functions
139 
140  virtual const wordList& regions() const;
141 
142  //- Whether supports volume type below
143  virtual bool hasVolumeType() const
144  {
145  return false;
146  }
147 
148  //- Range of local indices that can be returned.
149  virtual label size() const;
150 
151  //- Get representative set of element coordinates
152  // Usually the element centres (should be of length size()).
153  virtual pointField coordinates() const;
154 
155 
156  // Multiple point queries.
157 
158  virtual void findNearest
159  (
160  const pointField& sample,
161  const scalarField& nearestDistSqr,
163  ) const;
164 
165  virtual void findLine
166  (
167  const pointField& start,
168  const pointField& end,
170  ) const;
171 
172  virtual void findLineAny
173  (
174  const pointField& start,
175  const pointField& end,
177  ) const;
178 
179  //- Get all intersections in order from start to end.
180  virtual void findLineAll
181  (
182  const pointField& start,
183  const pointField& end,
185  ) const;
186 
187  //- From a set of points and indices get the region
188  virtual void getRegion
189  (
190  const List<pointIndexHit>&,
191  labelList& region
192  ) const;
193 
194  //- From a set of points and indices get the normal
195  virtual void getNormal
196  (
197  const List<pointIndexHit>&,
199  ) const;
200 
201  //- Determine type (inside/outside/mixed) for point. unknown if
202  // cannot be determined (e.g. non-manifold surface)
203  virtual void getVolumeType
204  (
205  const pointField&,
207  ) const;
208 
209  // Other
210 
211  //- Set bounds of surface. Bounds currently set as list of
212  // bounding boxes. The bounds are hints to the surface as for
213  // the range of queries it can expect. faceMap/pointMap can be
214  // set if the surface has done any redistribution.
215  virtual void distribute
216  (
217  const List<treeBoundBox>&,
218  const bool keepNonLocal,
219  autoPtr<mapDistribute>& faceMap,
220  autoPtr<mapDistribute>& pointMap
221  );
222 
223  //- WIP. Store element-wise field.
224  virtual void setField(const labelList& values);
225 
226  //- WIP. From a set of hits (points and
227  // indices) get the specified field. Misses do not get set. Return
228  // empty field if not supported.
229  virtual void getField(const List<pointIndexHit>&, labelList&) const;
230 
231  // regIOobject implementation
232 
233  bool writeData(Ostream&) const
234  {
236  (
237  "searchableSurfaceCollection::writeData(Ostream&) const"
238  );
239  return false;
240  }
241 
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************ vim: set sw=4 sts=4 et: ************************ //