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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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::shellSurfaces
26 
27 Description
28  Encapsulates queries for volume refinement ('refine all cells within
29  shell').
30 
31 SourceFiles
32  shellSurfaces.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef shellSurfaces_H
37 #define shellSurfaces_H
38 
39 #include "searchableSurface.H"
40 #include "Tuple2.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class searchableSurfaces;
48 
49 /*---------------------------------------------------------------------------*\
50  Class shellSurfaces Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class shellSurfaces
54 {
55 public:
56 
57  // Public data types
58 
59  //- Volume refinement controls
60  enum refineMode
61  {
62  INSIDE, // Refine all inside shell
63  OUTSIDE, // ,, outside
64  DISTANCE // Refine based on distance to shell
65  };
66 
67 
68 private:
69 
70  // Private data
71 
72  //- Reference to all geometry.
74 
75  //- Indices of surfaces that are shells
77 
78  //- Per shell whether to refine inside or outside
80 
81  //- Per shell the list of ranges
83 
84  //- Per shell per distance the refinement level
86 
87 
88  // Gap level refinement
89 
90  //- Per shell, per region the small-gap level specification
92 
93  //- Per shell, per region the small-gap level specification
95 
96 
97  // Private data
98 
99  //- refineMode names
101 
102 
103  // Private Member Functions
104 
105  //- Helper function for initialisation of levels
106  void setAndCheckLevels
107  (
108  const label shellI,
109  const List<Tuple2<scalar, label> >&
110  );
111 
112  //- Helper function for checking of gap information
113  void checkGapLevels
114  (
115  const dictionary&,
116  const label shellI,
117  const List<FixedList<label, 3> >& levels
118  );
119 
120  void orient();
121 
122  //- Find first shell with a level higher than maxLevel
123  void findHigherLevel
124  (
125  const pointField& pt,
126  const label shellI,
128  ) const;
129 
130  //- Update highest min gap level
131  void findHigherGapLevel
132  (
133  const pointField& pt,
134  const labelList& ptLevel,
135  const label shellI,
136  labelList& gapShell,
137  List<FixedList<label, 3> >& gapInfo,
138  List<volumeType>& gapMode
139  ) const;
140 
141  //- Find first shell with a level lower or equal to minLevel. Update
142  // minLevel and shell.
143  void findLevel
144  (
145  const pointField& pt,
146  const label shellI,
147  labelList& minLevel,
148  labelList& shell
149  ) const;
150 
151 public:
152 
153  // Constructors
154 
155  //- Construct from geometry and dictionary
157  (
158  const searchableSurfaces& allGeometry,
159  const dictionary& shellsDict
160  );
161 
162 
163  // Member Functions
164 
165  // Access
166 
167  //- Indices of surfaces that are shells
168  const labelList& shells() const
169  {
170  return shells_;
171  }
172 
173 
174  // Query
175 
176  //- Highest shell level
177  label maxLevel() const;
178 
179  //- Highest shell gap level
180  labelList maxGapLevel() const;
181 
182  //- Find shell level higher than ptLevel
183  void findHigherLevel
184  (
185  const pointField& pt,
186  const labelList& ptLevel,
188  ) const;
189 
190  //- Find a shell whose minimum gap level is >= ptLevel
191  void findHigherGapLevel
192  (
193  const pointField& pt,
194  const labelList& ptLevel,
195  labelList& gapShell,
196  List<FixedList<label, 3> >& gapInfo,
197  List<volumeType>& gapMode
198  ) const;
199 
200  //- Find a shell whose minimum gap level is >= ptLevel. gapInfo
201  // is (0 0 0) if no shell found
202  void findHigherGapLevel
203  (
204  const pointField& pt,
205  const labelList& ptLevel,
206  List<FixedList<label, 3> >& gapInfo,
207  List<volumeType>& gapMode
208  ) const;
209 
210  //- Find first shell (or -1) with level equal or lower than ptLevel.
211  void findLevel
212  (
213  const pointField& pt,
214  const labelList& ptLevel,
215  labelList& shell
216  ) const;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Foam::shellSurfaces::setAndCheckLevels
void setAndCheckLevels(const label shellI, const List< Tuple2< scalar, label > > &)
Helper function for initialisation of levels.
Definition: shellSurfaces.C:61
Foam::shellSurfaces::refineMode
refineMode
Volume refinement controls.
Definition: shellSurfaces.H:59
Foam::shellSurfaces::shells
const labelList & shells() const
Indices of surfaces that are shells.
Definition: shellSurfaces.H:167
searchableSurface.H
Foam::shellSurfaces::distances_
List< scalarField > distances_
Per shell the list of ranges.
Definition: shellSurfaces.H:81
Tuple2.H
Foam::shellSurfaces::findLevel
void findLevel(const pointField &pt, const label shellI, labelList &minLevel, labelList &shell) const
Find first shell with a level lower or equal to minLevel. Update.
Definition: shellSurfaces.C:453
Foam::shellSurfaces::DISTANCE
@ DISTANCE
Definition: shellSurfaces.H:63
Foam::shellSurfaces::maxGapLevel
labelList maxGapLevel() const
Highest shell gap level.
Definition: shellSurfaces.C:752
Foam::shellSurfaces::OUTSIDE
@ OUTSIDE
Definition: shellSurfaces.H:62
Foam::shellSurfaces::shells_
labelList shells_
Indices of surfaces that are shells.
Definition: shellSurfaces.H:75
Foam::shellSurfaces::modes_
List< refineMode > modes_
Per shell whether to refine inside or outside.
Definition: shellSurfaces.H:78
Foam::shellSurfaces
Encapsulates queries for volume refinement ('refine all cells within shell').
Definition: shellSurfaces.H:52
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::shellSurfaces::allGeometry_
const searchableSurfaces & allGeometry_
Reference to all geometry.
Definition: shellSurfaces.H:72
Foam::shellSurfaces::extendedGapLevel_
List< List< FixedList< label, 3 > > > extendedGapLevel_
Per shell, per region the small-gap level specification.
Definition: shellSurfaces.H:90
Foam::shellSurfaces::orient
void orient()
Definition: shellSurfaces.C:185
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::shellSurfaces::extendedGapMode_
List< List< volumeType > > extendedGapMode_
Per shell, per region the small-gap level specification.
Definition: shellSurfaces.H:93
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::shellSurfaces::findHigherGapLevel
void findHigherGapLevel(const pointField &pt, const labelList &ptLevel, const label shellI, labelList &gapShell, List< FixedList< label, 3 > > &gapInfo, List< volumeType > &gapMode) const
Update highest min gap level.
Definition: shellSurfaces.C:387
Foam::shellSurfaces::levels_
labelListList levels_
Per shell per distance the refinement level.
Definition: shellSurfaces.H:84
Foam::shellSurfaces::findHigherLevel
void findHigherLevel(const pointField &pt, const label shellI, labelList &maxLevel) const
Find first shell with a level higher than maxLevel.
Definition: shellSurfaces.C:267
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::searchableSurfaces
Container for searchableSurfaces.
Definition: searchableSurfaces.H:53
Foam::FixedList< label, 3 >
Foam::shellSurfaces::refineModeNames_
static const NamedEnum< refineMode, 3 > refineModeNames_
refineMode names
Definition: shellSurfaces.H:99
Foam::shellSurfaces::checkGapLevels
void checkGapLevels(const dictionary &, const label shellI, const List< FixedList< label, 3 > > &levels)
Helper function for checking of gap information.
Definition: shellSurfaces.C:146
Foam::Tuple2
A 2-tuple for storing two objects of different types.
Definition: Tuple2.H:47
Foam::shellSurfaces::INSIDE
@ INSIDE
Definition: shellSurfaces.H:61
Foam::shellSurfaces::shellSurfaces
shellSurfaces(const searchableSurfaces &allGeometry, const dictionary &shellsDict)
Construct from geometry and dictionary.
Definition: shellSurfaces.C:580
Foam::shellSurfaces::maxLevel
label maxLevel() const
Highest shell level.
Definition: shellSurfaces.C:741
Foam::NamedEnum< refineMode, 3 >