shellSurfaces.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2015-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::shellSurfaces
29 
30 Description
31  Encapsulates queries for volume refinement ('refine all cells within
32  shell').
33 
34 SourceFiles
35  shellSurfaces.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef shellSurfaces_H
40 #define shellSurfaces_H
41 
42 #include "searchableSurface.H"
43 #include "Enum.H"
44 #include "Tuple2.H"
45 #include "labelVector.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class searchableSurfaces;
53 
54 /*---------------------------------------------------------------------------*\
55  Class shellSurfaces Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class shellSurfaces
59 {
60 public:
61 
62  // Public data types
63 
64  //- Volume refinement controls
65  enum refineMode
66  {
67  INSIDE, // Refine all inside shell
68  OUTSIDE, // ,, outside
69  DISTANCE // Refine based on distance to shell
70  };
71 
72 
73 private:
74 
75  // Private data
76 
77  //- Reference to all geometry.
78  const searchableSurfaces& allGeometry_;
79 
80  //- Dry-run mode?
81  const bool dryRun_;
82 
83  //- Indices of surfaces that are shells
84  labelList shells_;
85 
86  //- Per shell whether to refine inside or outside
87  List<refineMode> modes_;
88 
89  //- Per shell the list of ranges
90  List<scalarField> distances_;
91 
92  //- Per shell per distance the refinement level
93  labelListList levels_;
94 
95 
96  // Directional
97 
98  //- Per shell any additional directional refinement
100 
101  //- Per shell the smoothing direction
102  vectorField smoothDirection_;
103 
104  //- Per shell the directional smoothing iterations
105  labelList nSmoothExpansion_;
106 
107  //- Per shell the positional smoothing iterations
108  labelList nSmoothPosition_;
109 
110 
111  // Gap level refinement
112 
113  //- Per shell, per region the small-gap level specification
114  List<List<FixedList<label, 3>>> extendedGapLevel_;
115 
116  //- Per shell, per region the small-gap level specification
117  List<List<volumeType>> extendedGapMode_;
118 
119  //- Per shell, per region whether to allow selfProximity refinement
120  boolListList selfProximity_;
121 
122 
123  // Private data
124 
125  //- refineMode names
126  static const Enum<refineMode> refineModeNames_;
127 
128 
129  // Private Member Functions
130 
131  //- Helper function for initialisation of levels
132  void setAndCheckLevels
133  (
134  const label shellI,
136  );
137 
138  //- Helper function for checking of gap information
139  void checkGapLevels
140  (
141  const dictionary&,
142  const label shellI,
143  const List<FixedList<label, 3>>& levels
144  );
145 
146  void orient();
147 
148  //- Find first shell with a level higher than maxLevel
149  void findHigherLevel
150  (
151  const pointField& pt,
152  const label shellI,
154  ) const;
155 
156  //- Update highest min gap level
157  void findHigherGapLevel
158  (
159  const pointField& pt,
160  const labelList& ptLevel,
161  const label shellI,
162  labelList& gapShell,
163  List<FixedList<label, 3>>& gapInfo,
164  List<volumeType>& gapMode
165  ) const;
166 
167  //- Find first shell with a level lower or equal to minLevel. Update
168  // minLevel and shell.
169  void findLevel
170  (
171  const pointField& pt,
172  const label shellI,
173  labelList& minLevel,
174  labelList& shell
175  ) const;
176 
177 public:
178 
179  // Constructors
180 
181  //- Construct from geometry and dictionary
183  (
184  const searchableSurfaces& allGeometry,
185  const dictionary& shellsDict,
186  const bool dryRun = false
187  );
188 
189 
190  // Member Functions
191 
192  // Access
193 
194  //- Indices of surfaces that are shells
195  const labelList& shells() const
196  {
197  return shells_;
198  }
199 
200  //- Per shell, per region the small-gap level specification
202  {
203  return extendedGapLevel_;
204  }
205 
206  //- Per shell, per region the small-gap level specification
207  const List<List<volumeType>>& extendedGapMode() const
208  {
209  return extendedGapMode_;
210  }
211 
212  //- Per shell, per region whether to test for gap with same surface
213  const boolListList& gapSelf() const
214  {
215  return selfProximity_;
216  }
217 
218 
219  // Query
220 
221  //- Highest shell level
222  label maxLevel() const;
223 
224  //- Highest shell gap level
225  labelList maxGapLevel() const;
226 
227  //- Min and max cell level for directional refinement
229 
230  //- Find shell level higher than ptLevel
231  void findHigherLevel
232  (
233  const pointField& pt,
234  const labelList& ptLevel,
236  ) const;
237 
238  //- Find a shell whose minimum gap level is >= ptLevel
239  void findHigherGapLevel
240  (
241  const pointField& pt,
242  const labelList& ptLevel,
243  labelList& gapShell,
244  List<FixedList<label, 3>>& gapInfo,
245  List<volumeType>& gapMode
246  ) const;
247 
248  //- Find a shell whose minimum gap level is >= ptLevel. gapInfo
249  // is (0 0 0) if no shell found
250  void findHigherGapLevel
251  (
252  const pointField& pt,
253  const labelList& ptLevel,
254  List<FixedList<label, 3>>& gapInfo,
255  List<volumeType>& gapMode
256  ) const;
257 
258  //- Find first shell (or -1) with level equal or lower than ptLevel.
259  void findLevel
260  (
261  const pointField& pt,
262  const labelList& ptLevel,
263  labelList& shell
264  ) const;
265 
266  //- Find any shell (or -1) with higher wanted directional level
268  (
269  const pointField& pt,
270  const labelList& ptLevel, // omnidirectional level
271  const labelList& dirLevel, // directional level
272  const direction dir,
273  labelList& shell
274  ) const;
275 
276  //- Per shell the smoothing direction
277  const vectorField& smoothDirection() const;
278 
279  //- Per shell the directional smoothing iterations
280  const labelList& nSmoothExpansion() const;
281 
282  //- Per shell the positional smoothing iterations
283  const labelList& nSmoothPosition() const;
284 };
285 
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 } // End namespace Foam
290 
291 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 
293 #endif
294 
295 // ************************************************************************* //
Foam::shellSurfaces::refineMode
refineMode
Volume refinement controls.
Definition: shellSurfaces.H:64
Foam::shellSurfaces::shells
const labelList & shells() const
Indices of surfaces that are shells.
Definition: shellSurfaces.H:194
Foam::Enum< refineMode >
Foam::shellSurfaces::smoothDirection
const vectorField & smoothDirection() const
Per shell the smoothing direction.
Definition: shellSurfaces.C:847
searchableSurface.H
Tuple2.H
labelVector.H
Foam::shellSurfaces::DISTANCE
Definition: shellSurfaces.H:68
Foam::shellSurfaces::extendedGapLevel
const List< List< FixedList< label, 3 > > > & extendedGapLevel() const
Per shell, per region the small-gap level specification.
Definition: shellSurfaces.H:200
Foam::shellSurfaces::maxGapLevel
labelList maxGapLevel() const
Highest shell gap level.
Definition: shellSurfaces.C:814
Foam::shellSurfaces::OUTSIDE
Definition: shellSurfaces.H:67
Foam::shellSurfaces
Encapsulates queries for volume refinement ('refine all cells within shell').
Definition: shellSurfaces.H:57
Foam::Field< vector >
Foam::shellSurfaces::directionalSelectLevel
labelPairList directionalSelectLevel() const
Min and max cell level for directional refinement.
Definition: shellSurfaces.C:830
Foam::shellSurfaces::shellSurfaces
shellSurfaces(const searchableSurfaces &allGeometry, const dictionary &shellsDict, const bool dryRun=false)
Construct from geometry and dictionary.
Definition: shellSurfaces.C:579
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::shellSurfaces::findDirectionalLevel
void findDirectionalLevel(const pointField &pt, const labelList &ptLevel, const labelList &dirLevel, const direction dir, labelList &shell) const
Find any shell (or -1) with higher wanted directional level.
Definition: shellSurfaces.C:939
Foam::List< label >
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::FixedList< label, 3 >
Foam::shellSurfaces::extendedGapMode
const List< List< volumeType > > & extendedGapMode() const
Per shell, per region the small-gap level specification.
Definition: shellSurfaces.H:206
Foam::direction
uint8_t direction
Definition: direction.H:47
Foam::shellSurfaces::gapSelf
const boolListList & gapSelf() const
Per shell, per region whether to test for gap with same surface.
Definition: shellSurfaces.H:212
Foam::shellSurfaces::nSmoothPosition
const labelList & nSmoothPosition() const
Per shell the positional smoothing iterations.
Definition: shellSurfaces.C:853
Foam::shellSurfaces::nSmoothExpansion
const labelList & nSmoothExpansion() const
Per shell the directional smoothing iterations.
Definition: shellSurfaces.C:841
Foam::Tuple2
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:57
Foam::shellSurfaces::INSIDE
Definition: shellSurfaces.H:66
Foam::shellSurfaces::maxLevel
label maxLevel() const
Highest shell level.
Definition: shellSurfaces.C:803
Enum.H