sammMesh.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::sammMesh
26 
27 Description
28  A messy mesh class which supports the possibility of creating a shapeMesh
29  for regular Samm meshes (no arbitrary interfaces or collapsed SAMM cells).
30  If any of these special features exist, the mesh is created as polyMesh
31 
32 SourceFiles
33  sammMesh.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef sammMesh_H
38 #define sammMesh_H
39 
40 #include "polyMesh.H"
41 #include "cellShape.H"
42 #include "cellList.H"
43 #include "polyPatchList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class sammMesh Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class sammMesh
55 {
56  // Private Data
57 
58  //- Name of the case
59  fileName casePrefix_;
60 
61  //- Database
62  const Time& runTime_;
63 
64  //- Points supporting the mesh
65  pointField points_;
66 
67  //- Cell shapes
68  cellShapeList cellShapes_;
69 
70  //- Boundary faces
71  faceListList boundary_;
72 
73  //- Boundary patch types
74  wordList patchTypes_;
75 
76  //- Default boundary patch name
77  word defaultFacesName_;
78 
79  //- Default boundary patch types
80  word defaultFacesType_;
81 
82  //- Boundary patch names
83  wordList patchNames_;
84 
85  //- Boundary patch physical types
86  wordList patchPhysicalTypes_;
87 
88  //- Point labels (SAMM point numbering is not necessarily contiguous)
89  labelList starPointLabelLookup_;
90 
91  //- Point labels (SAMM point numbering is not necessarily contiguous)
92  labelList starCellLabelLookup_;
93 
94  //- List of faces for every cell
95  faceListList cellFaces_;
96 
97  //- Global face list for polyMesh
98  faceList meshFaces_;
99 
100  //- Cells as polyhedra for polyMesh
101  cellList cellPolys_;
102 
103  //- Number of internal faces for polyMesh
104  label nInternalFaces_;
105 
106  //- Polyhedral mesh boundary patch start indices
107  labelList polyBoundaryPatchStartIndices_;
108 
109  //- Point-cell addressing. Used for topological analysis
110  // Warning. This point cell addressing list potentially contains
111  // duplicate cell entries. Use additional checking
112  mutable labelListList* pointCellsPtr_;
113 
114  //- Can the mesh be treated as a shapeMesh?
115  bool isShapeMesh_;
116 
117  // Private static data members
118 
119  //- Pointers to cell models
120  static const cellModel* unknownPtr_;
121  static const cellModel* hexPtr_;
122  static const cellModel* wedgePtr_;
123  static const cellModel* prismPtr_;
124  static const cellModel* pyrPtr_;
125  static const cellModel* tetPtr_;
126  static const cellModel* tetWedgePtr_;
127 
128  static const cellModel* sammTrim1Ptr_;
129  static const cellModel* sammTrim2Ptr_;
130  static const cellModel* sammTrim3Ptr_;
131  static const cellModel* sammTrim4Ptr_;
132  static const cellModel* sammTrim5Ptr_;
133  static const cellModel* sammTrim8Ptr_;
134 
135  static const label shapeFaceLookup[19][9];
136 
137 
138  //- SAMM addressing data
139  static List<const cellModel*> sammShapeLookup;
140  static List<const label*> sammAddressingTable;
141 
142  // Private Member Functions
143 
144  //- Fill SAMM lookup tables
145  void fillSammCellShapeTable();
146  void fillSammAddressingTable();
147 
148 
149  //- Read the points file
150  void readPoints(const scalar scaleFactor);
151 
152 
153  //- Read the cells file
154  void readCells();
155 
156  void addRegularCell
157  (
158  const labelList& labels,
159  const label nCreatedCells
160  );
161 
162  void addSAMMcell
163  (
164  const label typeFlag,
165  const labelList& globalLabels,
166  const label nCreatedCells
167  );
168 
169 
170  //- Read the boundary file
171  void readBoundary();
172 
173 
174  //- Check and correct collapsed edges on faces
175  // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
176  void fixCollapsedEdges();
177 
178  //- Read couples
179  void readCouples();
180 
181  //- Calculate pointCells
182  void calcPointCells() const;
183 
184  const labelListList& pointCells() const;
185 
186  //- Create boundary faces from the quads
187  void createBoundaryFaces();
188 
189  //- Specialist version of face comparison to deal with
190  // PROSTAR boundary format idiosyncracies
191  bool sammEqualFace
192  (
193  const face& boundaryFace,
194  const face& cellFace
195  ) const;
196 
197  //- Purge cell shapes
198  void purgeCellShapes();
199 
200  //- Make polyhedral cells and global faces if the mesh is polyhedral
201  void createPolyCells();
202 
203  //- Make polyhedral boundary from shape boundary
204  // (adds more faces to the face list)
205  void createPolyBoundary();
206 
207  //- Make polyhedral mesh data (packing)
208  void createPolyMeshData();
209 
210  //- Add polyhedral boundary
211  List<polyPatch* > polyBoundaryPatches(const polyMesh&);
212 
213 
214 public:
215 
216  // Constructors
217 
218  //- Construct from case name
219  sammMesh
220  (
221  const fileName& prefix,
222  const Time& rt,
223  const scalar scaleFactor
224  );
225 
226  //- Disallow default bitwise copy construction
227  sammMesh(const sammMesh&) = delete;
228 
229 
230  //- Destructor
231  ~sammMesh();
232 
233 
234  // Member Functions
235 
236  //- Write mesh
237  void writeMesh();
238 
239 
240  // Member Operators
241 
242  //- Disallow default bitwise assignment
243  void operator=(const sammMesh&) = delete;
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace Foam
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
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 class for handling file names.
Definition: fileName.H:79
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
A class for handling words, derived from string.
Definition: word.H:59
void operator=(const sammMesh &)=delete
Disallow default bitwise assignment.
A messy mesh class which supports the possibility of creating a shapeMesh for regular Samm meshes (no...
Definition: sammMesh.H:53
~sammMesh()
Destructor.
sammMesh(const fileName &prefix, const Time &rt, const scalar scaleFactor)
Construct from case name.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:64
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void writeMesh()
Write mesh.
Namespace for OpenFOAM.