createShellMesh.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) 2011-2019 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::createShellMesh
26 
27 Description
28  Creates mesh by extruding a patch.
29 
30 SourceFiles
31  createShellMesh.C
32 
33  Extrudes into thickness direction.
34  - bottom faces originate from reversed original faces (have turning index)
35  - top faces originate from original faces (no turning index)
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef createShellMesh_H
40 #define createShellMesh_H
41 
42 #include "primitiveFacePatch.H"
43 #include "PackedBoolList.H"
44 #include "labelPair.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 class mapPolyMesh;
53 class polyTopoChange;
54 class globalMeshData;
55 
56 /*---------------------------------------------------------------------------*\
57  Class createShellMesh Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class createShellMesh
61 {
62  // Private Data
63 
64  //- Reference to patch to extrude
65  const primitiveFacePatch& patch_;
66 
67  //- Per point on face the region
68  const faceList& pointRegions_;
69 
70  //- From region to original patch point
71  const labelList& regionPoints_;
72 
73 
74  labelList cellToFaceMap_;
75 
76  labelList faceToFaceMap_;
77 
78  labelList faceToEdgeMap_;
79 
80  labelList pointToPointMap_;
81 
82 
83  // Private Member Functions
84 
85  static void syncEdges
86  (
87  const globalMeshData&,
88  const labelList&,
89  const labelList&,
90  const PackedBoolList& sameEdgeOrientation,
91  const bool syncNonCollocated,
92 
93  PackedBoolList& isChangedEdge,
94  DynamicList<label>& changedEdges,
95  labelPairList& allEdgeData
96  );
97 
98 
99 public:
100 
101  //- Runtime type information
102  ClassName("createShellMesh");
103 
104 
105  // Constructors
106 
107  //- Construct from mesh.
109  (
110  const primitiveFacePatch& patch,
111  const faceList& pointRegions,
112  const labelList& regionPoints
113  );
114 
115  //- Disallow default bitwise copy construction
116  createShellMesh(const createShellMesh&) = delete;
117 
118 
119  // Member Functions
120 
121 
122  // Access
123 
124  //- From region cell to patch face. Consecutively added so
125  // cell at layerI is at patchFacei*nLayers+layerI
126  const labelList& cellToFaceMap() const
127  {
128  return cellToFaceMap_;
129  }
130 
131  //- From region face to patch face. Contains turning index:
132  // > 0 : face in same orientation as patch face. face will
133  // be in top patch
134  // < 0 : face in opposite orientation as patch face. face will
135  // be in bottom patch
136  // = 0 : for all side faces
137  const labelList& faceToFaceMap() const
138  {
139  return faceToFaceMap_;
140  }
141 
142  //- From region side-face to patch edge. -1 for non-edge faces.
143  const labelList& faceToEdgeMap() const
144  {
145  return faceToEdgeMap_;
146  }
147 
148  //- Disallow default bitwise assignment
149  void operator=(const createShellMesh&) = delete;
150 
151 
152  //- From region point to patch point.
153  const labelList& pointToPointMap() const
154  {
155  return pointToPointMap_;
156  }
157 
158 
159  // Other
160 
161  //- Helper: calculate point regions. The point region is the
162  // same on all faces connected to a point if they can be
163  // reached through a face-edge-face walk without crossing
164  // the nonManifoldEdge.
165  // syncNonCollocated = true: edges connected through cyclic become
166  // single region. false: kept separate.
167  // pointGlobalRegions : non-compact. Guaranteed to be the same
168  // across processors.
169  // pointLocalRegions : compact.
170  // localToGlobalRegion : local to global region.
171  static void calcPointRegions
172  (
173  const globalMeshData& globalData,
174  const primitiveFacePatch& patch,
175  const PackedBoolList& nonManifoldEdge,
176  const bool syncNonCollocated,
177  faceList& pointGlobalRegions,
178  faceList& pointLocalRegions,
179  labelList& localToGlobalRegion
180  );
181 
182  //- Play commands into polyTopoChange to create layer mesh.
183  void setRefinement
184  (
185  const pointField& firstLayerThickness,
186  const scalar expansionRatio,
187  const label nLayers,
188  const labelList& topPatchID,
189  const labelList& bottomPatchID,
190  const labelListList& extrudeEdgePatches,
191  polyTopoChange& meshMod
192  );
193 
194 
195  // Member Operators
196 
197  //- Update any locally stored mesh information.
198  void updateMesh(const mapPolyMesh&);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const PackedBoolList &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
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
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
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
createShellMesh(const primitiveFacePatch &patch, const faceList &pointRegions, const labelList &regionPoints)
Construct from mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
void operator=(const createShellMesh &)=delete
Disallow default bitwise assignment.
A list of faces which address into the list of points.
const labelList & cellToFaceMap() const
From region cell to patch face. Consecutively added so.
const labelList & faceToFaceMap() const
From region face to patch face. Contains turning index:
Creates mesh by extruding a patch.
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
A bit-packed bool list.
ClassName("createShellMesh")
Runtime type information.
const labelList & pointToPointMap() const
From region point to patch point.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void setRefinement(const pointField &firstLayerThickness, const scalar expansionRatio, const label nLayers, const labelList &topPatchID, const labelList &bottomPatchID, const labelListList &extrudeEdgePatches, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layer mesh.
Namespace for OpenFOAM.