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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::shellSurfaces
29
30Description
31 Encapsulates queries for volume refinement ('refine all cells within
32 shell').
33
34SourceFiles
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
49namespace Foam
50{
51
52class searchableSurfaces;
53
54/*---------------------------------------------------------------------------*\
55 Class shellSurfaces Declaration
56\*---------------------------------------------------------------------------*/
58class shellSurfaces
59{
60public:
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
73private:
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 void orient();
139
140 //- Find first shell with a level higher than maxLevel
141 void findHigherLevel
142 (
143 const pointField& pt,
144 const label shellI,
146 ) const;
147
148 //- Update highest min gap level
149 void findHigherGapLevel
150 (
151 const pointField& pt,
152 const labelList& ptLevel,
153 const label shellI,
154 labelList& gapShell,
155 List<FixedList<label, 3>>& gapInfo,
156 List<volumeType>& gapMode
157 ) const;
158
159 //- Find first shell with a level lower or equal to minLevel. Update
160 // minLevel and shell.
161 void findLevel
162 (
163 const pointField& pt,
164 const label shellI,
165 labelList& minLevel,
166 labelList& shell
167 ) const;
168
169public:
170
171 // Constructors
172
173 //- Construct from geometry and dictionary
175 (
176 const searchableSurfaces& allGeometry,
177 const dictionary& shellsDict,
178 const bool dryRun = false
179 );
180
181
182 // Member Functions
183
184 // Access
185
186 //- Indices of surfaces that are shells
187 const labelList& shells() const
188 {
189 return shells_;
190 }
191
192 //- Per shell, per region the small-gap level specification
194 {
195 return extendedGapLevel_;
196 }
197
198 //- Per shell, per region the small-gap level specification
200 {
201 return extendedGapMode_;
202 }
203
204 //- Per shell, per region whether to test for gap with same surface
205 const boolListList& gapSelf() const
206 {
207 return selfProximity_;
208 }
209
210
211 // Query
212
213 //- Highest shell level
214 label maxLevel() const;
215
216 //- Highest shell gap level
217 labelList maxGapLevel() const;
218
219 //- Min and max cell level for directional refinement
221
222 //- Find shell level higher than ptLevel
223 void findHigherLevel
224 (
225 const pointField& pt,
226 const labelList& ptLevel,
228 ) const;
229
230 //- Find a shell whose minimum gap level is >= ptLevel
231 void findHigherGapLevel
232 (
233 const pointField& pt,
234 const labelList& ptLevel,
235 labelList& gapShell,
236 List<FixedList<label, 3>>& gapInfo,
237 List<volumeType>& gapMode
238 ) const;
239
240 //- Find a shell whose minimum gap level is >= ptLevel. gapInfo
241 // is (0 0 0) if no shell found
242 void findHigherGapLevel
243 (
244 const pointField& pt,
245 const labelList& ptLevel,
246 List<FixedList<label, 3>>& gapInfo,
247 List<volumeType>& gapMode
248 ) const;
249
250 //- Find first shell (or -1) with level equal or lower than ptLevel.
251 void findLevel
252 (
253 const pointField& pt,
254 const labelList& ptLevel,
255 labelList& shell
256 ) const;
257
258 //- Find any shell (or -1) with higher wanted directional level
260 (
261 const pointField& pt,
262 const labelList& ptLevel, // omnidirectional level
263 const labelList& dirLevel, // directional level
264 const direction dir,
265 labelList& shell
266 ) const;
267
268 //- Per shell the smoothing direction
269 const vectorField& smoothDirection() const;
270
271 //- Per shell the directional smoothing iterations
272 const labelList& nSmoothExpansion() const;
273
274 //- Per shell the positional smoothing iterations
275 const labelList& nSmoothPosition() const;
276};
277
278
279// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280
281} // End namespace Foam
282
283// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284
285#endif
286
287// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: FixedList.H:81
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:58
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Encapsulates queries for volume refinement ('refine all cells within shell').
Definition: shellSurfaces.H:58
const vectorField & smoothDirection() const
Per shell the smoothing direction.
labelList maxGapLevel() const
Highest shell gap level.
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.
const boolListList & gapSelf() const
Per shell, per region whether to test for gap with same surface.
const labelList & nSmoothPosition() const
Per shell the positional smoothing iterations.
label maxLevel() const
Highest shell level.
const List< List< FixedList< label, 3 > > > & extendedGapLevel() const
Per shell, per region the small-gap level specification.
const labelList & nSmoothExpansion() const
Per shell the directional smoothing iterations.
const labelList & shells() const
Indices of surfaces that are shells.
refineMode
Volume refinement controls.
Definition: shellSurfaces.H:65
const List< List< volumeType > > & extendedGapMode() const
Per shell, per region the small-gap level specification.
labelPairList directionalSelectLevel() const
Min and max cell level for directional refinement.
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:56