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 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 "point.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  {
71  NONE
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  {
91  BOUNDARY
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  point zoneInsidePoint_;
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,
145  const point& zoneInsidePoints,
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 
177  const areaSelectionAlgo& zoneInside() const
178  {
179  return zoneInside_;
180  }
181 
182  //- Get specified inside locations for surfaces with a cellZone
183  const point& zoneInsidePoint() const
184  {
185  return zoneInsidePoint_;
186  }
187 
188  //- How to handle face of surfaces with a faceZone
189  const faceZoneType& faceType() const
190  {
191  return faceType_;
192  }
193 
194 
195  // Query
196 
197  //- Get indices of unnamed surfaces (surfaces without faceZoneName)
199  (
200  const PtrList<surfaceZonesInfo>& surfList
201  );
202 
203  //- Get indices of named surfaces (surfaces with faceZoneName)
205  (
206  const PtrList<surfaceZonesInfo>& surfList
207  );
208 
209  //- Get indices of named surfaces without a cellZone
211  (
212  const PtrList<surfaceZonesInfo>& surfList
213  );
214 
215  //- Get indices of surfaces with a cellZone that are closed and
216  // have 'inside' or 'outside' selection.
218  (
219  const PtrList<surfaceZonesInfo>& surfList,
220  const searchableSurfaces& allGeometry,
221  const labelList& surfaces
222  );
223 
224  //- Get indices of surfaces with a cellZone that are unclosed
226  (
227  const PtrList<surfaceZonesInfo>& surfList,
228  const searchableSurfaces& allGeometry,
229  const labelList& surfaces
230  );
231 
232  //- Get indices of surfaces with a cellZone that are closed.
234  (
235  const PtrList<surfaceZonesInfo>& surfList,
236  const searchableSurfaces& allGeometry,
237  const labelList& surfaces
238  );
239 
240  //- Get indices of surfaces with a cellZone that have 'insidePoint'
241  // section.
243  (
244  const PtrList<surfaceZonesInfo>& surfList
245  );
246 
247  static label addCellZone
248  (
249  const word& name,
250  const labelList& addressing,
251  polyMesh& mesh
252  );
253 
255  (
256  const PtrList<surfaceZonesInfo>& surfList,
257  const labelList& namedSurfaces,
258  polyMesh& mesh
259  );
260 
261  static label addFaceZone
262  (
263  const word& name,
264  const labelList& addressing,
265  const boolList& flipMap,
266  polyMesh& mesh
267  );
268 
270  (
271  const PtrList<surfaceZonesInfo>& surfList,
272  const labelList& namedSurfaces,
273  polyMesh& mesh
274  );
275 };
276 
277 
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
279 
280 } // End namespace Foam
281 
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283 
284 #endif
285 
286 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Foam::Enum< areaSelectionAlgo >
Foam::surfaceZonesInfo::faceZoneType
faceZoneType
What to do with faceZone faces.
Definition: surfaceZonesInfo.H:86
boolList.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::surfaceZonesInfo::faceType
const faceZoneType & faceType() const
How to handle face of surfaces with a faceZone.
Definition: surfaceZonesInfo.H:188
Foam::surfaceZonesInfo::getInsidePointNamedSurfaces
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have 'insidePoint'.
Definition: surfaceZonesInfo.C:401
Foam::surfaceZonesInfo::SINGLE
Definition: surfaceZonesInfo.H:79
Foam::surfaceZonesInfo::faceZoneNames
const wordList & faceZoneNames() const
Per 'interface' surface : empty or names of faceZones to put.
Definition: surfaceZonesInfo.H:164
point.H
Foam::surfaceZonesInfo::getNamedSurfaces
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
Definition: surfaceZonesInfo.C:263
Foam::surfaceZonesInfo::clone
autoPtr< surfaceZonesInfo > clone() const
Return clone.
Definition: surfaceZonesInfo.H:152
Foam::surfaceZonesInfo::INSIDE
Definition: surfaceZonesInfo.H:67
Foam::surfaceZonesInfo::getAllClosedNamedSurfaces
static labelList getAllClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed.
Definition: surfaceZonesInfo.C:373
Foam::surfaceZonesInfo::REGION
Definition: surfaceZonesInfo.H:80
Foam::surfaceZonesInfo::NOZONE
Definition: surfaceZonesInfo.H:78
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
regionNames
wordList regionNames
Definition: getAllRegionOptions.H:37
Foam::surfaceZonesInfo::getStandaloneNamedSurfaces
static labelList getStandaloneNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces without a cellZone.
Definition: surfaceZonesInfo.C:288
Foam::surfaceZonesInfo::BOUNDARY
Definition: surfaceZonesInfo.H:90
labelList.H
Foam::searchableSurface
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Definition: searchableSurface.H:69
Foam::surfaceZonesInfo::areaSelectionAlgo
areaSelectionAlgo
Types of selection of area.
Definition: surfaceZonesInfo.H:65
Foam::surfaceZonesInfo::OUTSIDE
Definition: surfaceZonesInfo.H:68
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::surfaceZonesInfo
Definition: surfaceZonesInfo.H:60
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::surfaceZonesInfo::INSIDEPOINT
Definition: surfaceZonesInfo.H:69
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::surfaceZonesInfo::faceZoneNamingNames
static const Enum< faceZoneNaming > faceZoneNamingNames
Definition: surfaceZonesInfo.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::surfaceZonesInfo::getClosedNamedSurfaces
static labelList getClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed and.
Definition: surfaceZonesInfo.C:314
Foam::surfaceZonesInfo::getUnclosedNamedSurfaces
static labelList getUnclosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are unclosed.
Definition: surfaceZonesInfo.C:346
Foam::surfaceZonesInfo::getUnnamedSurfaces
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
Definition: surfaceZonesInfo.C:242
Foam::surfaceZonesInfo::BAFFLE
Definition: surfaceZonesInfo.H:89
Foam::surfaceZonesInfo::faceZoneTypeNames
static const Enum< faceZoneType > faceZoneTypeNames
Definition: surfaceZonesInfo.H:93
Foam::surfaceZonesInfo::zoneInside
const areaSelectionAlgo & zoneInside() const
Definition: surfaceZonesInfo.H:176
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::surfaceZonesInfo::faceZoneNaming
faceZoneNaming
How to generate faceZone name.
Definition: surfaceZonesInfo.H:76
Foam::Vector< scalar >
Foam::List< word >
Foam::surfaceZonesInfo::zoneInsidePoint
const point & zoneInsidePoint() const
Get specified inside locations for surfaces with a cellZone.
Definition: surfaceZonesInfo.H:182
Foam::surfaceZonesInfo::NONE
Definition: surfaceZonesInfo.H:70
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
PtrList.H
Foam::surfaceZonesInfo::addFaceZonesToMesh
static labelListList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
Definition: surfaceZonesInfo.C:543
word.H
Foam::surfaceZonesInfo::areaSelectionAlgoNames
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
Definition: surfaceZonesInfo.H:73
Foam::surfaceZonesInfo::surfaceZonesInfo
surfaceZonesInfo(const searchableSurface &surface, const dictionary &surfacesDict, const wordList &regionNames)
Construct from surfaces and dictionary and fully resolved.
Definition: surfaceZonesInfo.C:77
Foam::surfaceZonesInfo::cellZoneName
const word & cellZoneName() const
Per 'interface' surface : empty or name of cellZone to put.
Definition: surfaceZonesInfo.H:171
Foam::surfaceZonesInfo::addCellZone
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)
Definition: surfaceZonesInfo.C:427
Foam::surfaceZonesInfo::addCellZonesToMesh
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
Definition: surfaceZonesInfo.C:458
Foam::surfaceZonesInfo::addFaceZone
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
Definition: surfaceZonesInfo.C:510
Enum.H
Foam::surfaceZonesInfo::INTERNAL
Definition: surfaceZonesInfo.H:88