meshingSurface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
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::meshingSurface
26 
27 Description
28  Attributes of a surface geometry file (e.g. OBJ, STL) that are used in
29  the configuration of mesh input files, (e.g. blockMeshDict,
30  snappyHexMeshDict).
31 
32 SourceFiles
33  meshingSurface.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef meshingSurface_H
38 #define meshingSurface_H
39 
40 #include "Time.H"
41 #include "boundBox.H"
42 #include "NamedEnum.H"
43 #include "triSurfaceMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class meshingSurface Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class meshingSurface
55 {
56 public:
57 
58  // Static Data Members
59 
60  //- Type of surface
61  enum class surfaceType
62  {
63  wall, // Solid wall boundary
64  external, // External domain boundary
65  cellZone, // Surface defining a cellZone
66  rotatingZone, // Surface defining a rotatingZone
67  baffle // Zero-thickness wall
68  };
69 
70 
71 private:
72 
73  // Private Data
74 
75  //- Path to surface file
76  fileName path_;
77 
78  //- Surface file name
79  fileName file_;
80 
81  //- Surfaces names, without file extensions
82  word name_;
83 
84  //- Type of surface: wall, external, cellZone, rotatingZone, baffle
85  surfaceType type_;
86 
87  //- Bounding boxes of the surface
88  boundBox boundBox_;
89 
90  //- Is the surface closed?
91  bool closed_;
92 
93  //- Number of disconnected parts
94  label nParts_;
95 
96  //- List of regions
97  List<word> regions_;
98 
99  //- List of inlet regions
100  List<word> inletRegions_;
101 
102  //- List of outlet regions
103  List<word> outletRegions_;
104 
105 
106  // Private Member Functions
107 
108  //- Returns the number of disconnected regions in a surface
109  label nSurfaceParts(const triSurfaceMesh& surf);
110 
111 
112 public:
113 
114  // Static Data Members
115 
116  //- Enumeration names for surfaceTypes
118 
119 
120  // Constructors
121 
122  //- Construct null
123  meshingSurface();
124 
125  //- Construct from components
126  meshingSurface(const fileName& file, const Time& time);
127 
128  //- Disallow default bitwise copy construction
129  meshingSurface(const meshingSurface&) = delete;
130 
131 
132  //- Destructor
133  ~meshingSurface();
134 
135 
136  // Member Functions
137 
138  //- Path to the surface file
139  const fileName& path() const
140  {
141  return path_;
142  }
143 
144  //- Surface file name
145  const fileName& file() const
146  {
147  return file_;
148  }
149 
150  //- Surface name, without file extension
151  const word& name() const
152  {
153  return name_;
154  }
155 
156  //- Surface type
157  const surfaceType& type() const
158  {
159  return type_;
160  }
161 
162  //- Return non-const access to the surface type
163  surfaceType& type()
164  {
165  return type_;
166  }
167 
168  //- Surface bounding box
169  const boundBox& bb() const
170  {
171  return boundBox_;
172  }
173 
174  //- Is the surface closed?
175  bool closed() const
176  {
177  return closed_;
178  }
179 
180  //- Return the number of disconnected surfaces
181  label nParts() const
182  {
183  return nParts_;
184  }
185 
186  //- Surface geometry regions
187  const List<word>& regions() const
188  {
189  return regions_;
190  }
191 
192  //- Inlet regions
193  const List<word>& inletRegions() const
194  {
195  return inletRegions_;
196  }
197 
198  //- Inlet regions
200  {
201  return inletRegions_;
202  }
203 
204  //- Outlet regions
205  const List<word>& outletRegions() const
206  {
207  return outletRegions_;
208  }
209 
210  //- Outlet regions
212  {
213  return outletRegions_;
214  }
215 
216  // Check the file extension of surface geometry files
217  static bool isSurfaceExt(const fileName& file);
218 
219 
220  // Member Operators
221 
222  //- Disallow default bitwise assignment
223  void operator=(const meshingSurface&) = delete;
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:59
A class for handling file names.
Definition: fileName.H:82
Attributes of a surface geometry file (e.g. OBJ, STL) that are used in the configuration of mesh inpu...
meshingSurface()
Construct null.
const List< word > & inletRegions() const
Inlet regions.
const boundBox & bb() const
Surface bounding box.
const fileName & file() const
Surface file name.
void operator=(const meshingSurface &)=delete
Disallow default bitwise assignment.
surfaceType
Type of surface.
const fileName & path() const
Path to the surface file.
const List< word > & regions() const
Surface geometry regions.
label nParts() const
Return the number of disconnected surfaces.
const List< word > & outletRegions() const
Outlet regions.
static const NamedEnum< surfaceType, 5 > surfaceTypeNames
Enumeration names for surfaceTypes.
static bool isSurfaceExt(const fileName &file)
const surfaceType & type() const
Surface type.
const word & name() const
Surface name, without file extension.
~meshingSurface()
Destructor.
bool closed() const
Is the surface closed?
A surface geometry formed of discrete facets, e.g. triangles and/or quadrilaterals,...
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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