sammMesh.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 | Copyright (C) 2011-2015 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 feateres 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  //- Disallow default bitwise copy construct
145  sammMesh(const sammMesh&);
146 
147  //- Disallow default bitwise assignment
148  void operator=(const sammMesh&);
149 
150 
151  //- Fill SAMM lookup tables
152  void fillSammCellShapeTable();
153  void fillSammAddressingTable();
154 
155 
156  //- Read the points file
157  void readPoints(const scalar scaleFactor);
158 
159 
160  //- Read the cells file
161  void readCells();
162 
163  void addRegularCell
164  (
165  const labelList& labels,
166  const label nCreatedCells
167  );
168 
169  void addSAMMcell
170  (
171  const label typeFlag,
172  const labelList& globalLabels,
173  const label nCreatedCells
174  );
175 
176 
177  //- Read the boundary file
178  void readBoundary();
179 
180 
181  //- Check and correct collapsed edges on faces
182  // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
183  void fixCollapsedEdges();
184 
185  //- Read couples
186  void readCouples();
187 
188  //- Calculate pointCells
189  void calcPointCells() const;
190 
191  const labelListList& pointCells() const;
192 
193  //- Create boundary faces from the quads
194  void createBoundaryFaces();
195 
196  //- Specialist version of face comparison to deal with
197  // PROSTAR boundary format idiosyncracies
198  bool sammEqualFace
199  (
200  const face& boundaryFace,
201  const face& cellFace
202  ) const;
203 
204  //- Purge cell shapes
205  void purgeCellShapes();
206 
207  //- Make polyhedral cells and global faces if the mesh is polyhedral
208  void createPolyCells();
209 
210  //- Make polyhedral boundary from shape boundary
211  // (adds more faces to the face list)
212  void createPolyBoundary();
213 
214  //- Make polyhedral mesh data (packing)
215  void createPolyMeshData();
216 
217  //- Add polyhedral boundary
218  List<polyPatch* > polyBoundaryPatches(const polyMesh&);
219 
220 
221 public:
222 
223  // Constructors
224 
225  //- Construct from case name
226  sammMesh
227  (
228  const fileName& prefix,
229  const Time& rt,
230  const scalar scaleFactor
231  );
232 
233 
234  //- Destructor
235  ~sammMesh();
236 
237 
238  // Member Functions
239 
240  //- Write mesh
241  void writeMesh();
242 };
243 
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
A messy mesh class which supports the possibility of creating a shapeMesh for regular Samm meshes (no...
Definition: sammMesh.H:53
A class for handling words, derived from string.
Definition: word.H:59
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
Namespace for OpenFOAM.
void writeMesh()
Write mesh.
~sammMesh()
Destructor.
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
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
A class for handling file names.
Definition: fileName.H:69