createShellMesh.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::createShellMesh
28 
29 Description
30  Creates mesh by extruding a patch.
31 
32 SourceFiles
33  createShellMesh.C
34 
35  Extrudes into thickness direction.
36  - bottom faces originate from reversed original faces (have turning index)
37  - top faces originate from original faces (no turning index)
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef createShellMesh_H
42 #define createShellMesh_H
43 
44 #include "primitiveFacePatch.H"
45 #include "bitSet.H"
46 #include "labelPair.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class mapPolyMesh;
55 class polyTopoChange;
56 class globalMeshData;
57 
58 /*---------------------------------------------------------------------------*\
59  Class createShellMesh Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class createShellMesh
63 {
64  // Private data
65 
66  //- Reference to patch to extrude
67  const primitiveFacePatch& patch_;
68 
69  //- Per point on face the region
70  const faceList& pointRegions_;
71 
72  //- From region to original patch point
73  const labelList& regionPoints_;
74 
75 
76  labelList cellToFaceMap_;
77 
78  labelList faceToFaceMap_;
79 
80  labelList faceToEdgeMap_;
81 
82  labelList pointToPointMap_;
83 
84 
85  // Private Member Functions
86 
87  static void syncEdges
88  (
89  const globalMeshData&,
90  const labelList&,
91  const labelList&,
92  const bitSet& sameEdgeOrientation,
93  const bool syncNonCollocated,
94 
95  bitSet& isChangedEdge,
96  DynamicList<label>& changedEdges,
97  labelPairList& allEdgeData
98  );
99 
100 
101  //- No copy construct
102  createShellMesh(const createShellMesh&) = delete;
103 
104  //- No copy assignment
105  void operator=(const createShellMesh&) = delete;
106 
107 
108 public:
109 
110  //- Runtime type information
111  ClassName("createShellMesh");
112 
113 
114  // Constructors
115 
116  //- Construct from mesh.
118  (
119  const primitiveFacePatch& patch,
120  const faceList& pointRegions,
121  const labelList& regionPoints
122  );
123 
124 
125  // Member Functions
126 
127 
128  // Access
129 
130  //- From region cell to patch face. Consecutively added so
131  // cell at layerI is at patchFacei*nLayers+layerI
132  const labelList& cellToFaceMap() const
133  {
134  return cellToFaceMap_;
135  }
136 
137  //- From region face to patch face. Contains turning index:
138  // > 0 : face in same orientation as patch face. face will
139  // be in top patch
140  // < 0 : face in opposite orientation as patch face. face will
141  // be in bottom patch
142  // = 0 : for all side faces
143  const labelList& faceToFaceMap() const
144  {
145  return faceToFaceMap_;
146  }
147 
148  //- From region side-face to patch edge. -1 for non-edge faces.
149  const labelList& faceToEdgeMap() const
150  {
151  return faceToEdgeMap_;
152  }
153 
154  //- From region point to patch point.
155  const labelList& pointToPointMap() const
156  {
157  return pointToPointMap_;
158  }
159 
160 
161  // Other
162 
163  //- Helper: calculate point regions. The point region is the
164  // same on all faces connected to a point if they can be
165  // reached through a face-edge-face walk without crossing
166  // the nonManifoldEdge.
167  // syncNonCollocated = true: edges connected through cyclic become
168  // single region. false: kept separate.
169  // pointGlobalRegions : non-compact. Guaranteed to be the same
170  // across processors.
171  // pointLocalRegions : compact.
172  // localToGlobalRegion : local to global region.
173  static void calcPointRegions
174  (
175  const globalMeshData& globalData,
176  const primitiveFacePatch& patch,
177  const bitSet& nonManifoldEdge,
178  const bool syncNonCollocated,
179  faceList& pointGlobalRegions,
180  faceList& pointLocalRegions,
181  labelList& localToGlobalRegion
182  );
183 
184  //- Play commands into polyTopoChange to create layer mesh.
185  void setRefinement
186  (
187  const pointField& firstLayerThickness,
188  const scalar expansionRatio,
189  const label nLayers,
190  const labelList& topPatchID,
191  const labelList& bottomPatchID,
192  const labelListList& extrudeEdgePatches,
193  polyTopoChange& meshMod
194  );
195 
196  //- Update any locally stored mesh information.
197  void updateMesh(const mapPolyMesh&);
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::createShellMesh::faceToEdgeMap
const labelList & faceToEdgeMap() const
From region side-face to patch edge. -1 for non-edge faces.
Definition: createShellMesh.H:148
Foam::createShellMesh::pointToPointMap
const labelList & pointToPointMap() const
From region point to patch point.
Definition: createShellMesh.H:154
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:64
Foam::DynamicList< label >
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:100
primitiveFacePatch.H
Foam::createShellMesh::faceToFaceMap
const labelList & faceToFaceMap() const
From region face to patch face. Contains turning index:
Definition: createShellMesh.H:142
bitSet.H
Foam::createShellMesh::updateMesh
void updateMesh(const mapPolyMesh &)
Update any locally stored mesh information.
Definition: createShellMesh.C:909
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:62
Foam::Field< vector >
Foam::globalMeshData
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Definition: globalMeshData.H:106
Foam::createShellMesh::setRefinement
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.
Definition: createShellMesh.C:449
Foam::createShellMesh::cellToFaceMap
const labelList & cellToFaceMap() const
From region cell to patch face. Consecutively added so.
Definition: createShellMesh.H:131
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::createShellMesh::calcPointRegions
static void calcPointRegions(const globalMeshData &globalData, const primitiveFacePatch &patch, const bitSet &nonManifoldEdge, const bool syncNonCollocated, faceList &pointGlobalRegions, faceList &pointLocalRegions, labelList &localToGlobalRegion)
Helper: calculate point regions. The point region is the.
Definition: createShellMesh.C:157
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:102
Foam::createShellMesh
Creates mesh by extruding a patch.
Definition: createShellMesh.H:61
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::createShellMesh::ClassName
ClassName("createShellMesh")
Runtime type information.
labelPair.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:90