surfaceZonesInfo.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) 2014 OpenFOAM Foundation
9  Copyright (C) 2015,2023 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::surfaceZonesInfo
29 
30 Description
31 
32 SourceFiles
33  surfaceZonesInfo.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef surfaceZonesInfo_H
38 #define surfaceZonesInfo_H
39 
40 #include "Enum.H"
41 #include "pointField.H"
42 #include "word.H"
43 #include "PtrList.H"
44 #include "labelList.H"
45 #include "boolList.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class searchableSurface;
53 class searchableSurfaces;
54 class polyMesh;
55 class dictionary;
56 
57 /*---------------------------------------------------------------------------*\
58  Class surfaceZonesInfo Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class surfaceZonesInfo
62 {
63 public:
64 
65  //- Types of selection of area
67  {
69  OUTSIDE,
72  };
73 
75 
76  //- How to generate faceZone name
77  enum faceZoneNaming
78  {
81  REGION
82  };
83 
85 
86  //- What to do with faceZone faces
87  enum faceZoneType
88  {
89  INTERNAL,
92  };
93 
95 
96 
97 private:
98 
99  // Private data
100 
101  //- Per 'interface' surface : names of faceZones to put faces into
102  wordList faceZoneNames_;
103 
104  //- Per 'interface' surface : name of cellZone to put cells into
105  word cellZoneName_;
106 
107  //- Per 'interface' surface : (only used if surface is closed)
108  // How to select zone cells : surface inside or outside or given
109  // inside location.
110  areaSelectionAlgo zoneInside_;
111 
112  //- If zoneInside=location gives the corresponding inside point
113  pointField zoneInsidePoints_;
114 
115  //- Per 'interface' surface :
116  // What to do with outside
117  faceZoneType faceType_;
118 
119 
120  // Private Member Functions
121 
122  //- No copy assignment
123  void operator=(const surfaceZonesInfo&) = delete;
124 
125 
126 public:
127 
128  // Constructors
129 
130  //- Construct from surfaces and dictionary and fully resolved
131  // region names (for optional automatic faceZone naming)
133  (
134  const searchableSurface& surface,
135  const dictionary& surfacesDict,
136  const wordList& regionNames
137  );
138 
139  //- Construct from components
141  (
142  const wordList& faceZoneNames,
143  const word& cellZoneNames,
146  const faceZoneType& faceType
147  );
148 
149  //- Copy constructor
151 
152  //- Return clone
154  {
155  return autoPtr<surfaceZonesInfo>::New(*this);
156  }
157 
158 
159  // Member Functions
160 
161  // Access
162 
163  //- Per 'interface' surface : empty or names of faceZones to put
164  // faces into (according to region)
165  const wordList& faceZoneNames() const
166  {
167  return faceZoneNames_;
168  }
169 
170  //- Per 'interface' surface : empty or name of cellZone to put
171  // cells into
172  const word& cellZoneName() const
173  {
174  return cellZoneName_;
175  }
176 
178  {
179  return zoneInside_;
180  }
181 
182  //- Get specified inside location for surfaces with a cellZone
183  const point zoneInsidePoint() const
184  {
185  return zoneInsidePoints_[0];
186  }
187 
188  //- Get specified inside locations for surfaces with a cellZone
189  const pointField& zoneInsidePoints() const
190  {
191  return zoneInsidePoints_;
192  }
193 
194  //- How to handle face of surfaces with a faceZone
195  const faceZoneType& faceType() const
196  {
197  return faceType_;
198  }
199 
200 
201  // Query
203  //- Get indices of unnamed surfaces (surfaces without faceZoneName)
205  (
206  const PtrList<surfaceZonesInfo>& surfList
207  );
208 
209  //- Get indices of named surfaces (surfaces with faceZoneName)
211  (
212  const PtrList<surfaceZonesInfo>& surfList
213  );
214 
215  //- Get indices of named surfaces without a cellZone
217  (
218  const PtrList<surfaceZonesInfo>& surfList
219  );
220 
221  //- Get indices of surfaces with a cellZone that are closed and
222  // have 'inside' or 'outside' selection.
224  (
225  const PtrList<surfaceZonesInfo>& surfList,
226  const searchableSurfaces& allGeometry,
227  const labelList& surfaces
228  );
229 
230  //- Get indices of surfaces with a cellZone that are unclosed
232  (
233  const PtrList<surfaceZonesInfo>& surfList,
234  const searchableSurfaces& allGeometry,
235  const labelList& surfaces
236  );
237 
238  //- Get indices of surfaces with a cellZone that are closed.
240  (
241  const PtrList<surfaceZonesInfo>& surfList,
242  const searchableSurfaces& allGeometry,
243  const labelList& surfaces
244  );
245 
246  //- Get indices of surfaces with a cellZone that have 'insidePoint'
247  // section.
249  (
250  const PtrList<surfaceZonesInfo>& surfList
251  );
252 
253  static label addCellZone
254  (
255  const word& name,
256  const labelList& addressing,
257  polyMesh& mesh
258  );
259 
261  (
262  const PtrList<surfaceZonesInfo>& surfList,
263  const labelList& namedSurfaces,
264  polyMesh& mesh
265  );
266 
267  static label addFaceZone
268  (
269  const word& name,
270  const labelList& addressing,
271  const boolList& flipMap,
272  polyMesh& mesh
273  );
274 
276  (
277  const PtrList<surfaceZonesInfo>& surfList,
278  const labelList& namedSurfaces,
279  polyMesh& mesh
280  );
281 };
282 
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 } // End namespace Foam
287 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 #endif
291 
292 // ************************************************************************* //
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
const areaSelectionAlgo & zoneInside() const
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const point zoneInsidePoint() const
Get specified inside location for surfaces with a cellZone.
static labelListList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
const word & cellZoneName() const
Per &#39;interface&#39; surface : empty or name of cellZone to put.
static const Enum< faceZoneNaming > faceZoneNamingNames
autoPtr< surfaceZonesInfo > clone() const
Return clone.
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static const Enum< faceZoneType > faceZoneTypeNames
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
wordList regionNames
static labelList getStandaloneNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces without a cellZone.
static labelList getUnclosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are unclosed.
static labelList getAllClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
const faceZoneType & faceType() const
How to handle face of surfaces with a faceZone.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have &#39;insidePoint&#39;.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
const wordList surface
Standard surface field types (scalar, vector, tensor, etc)
const pointField & zoneInsidePoints() const
Get specified inside locations for surfaces with a cellZone.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const wordList & faceZoneNames() const
Per &#39;interface&#39; surface : empty or names of faceZones to put.
surfaceZonesInfo(const searchableSurface &surface, const dictionary &surfacesDict, const wordList &regionNames)
Construct from surfaces and dictionary and fully resolved.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
faceZoneNaming
How to generate faceZone name.
static labelList getClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed and.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
faceZoneType
What to do with faceZone faces.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
areaSelectionAlgo
Types of selection of area.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
Namespace for OpenFOAM.
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)