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
60 
61  //- Database
62  const Time& runTime_;
63 
64  //- Points supporting the mesh
66 
67  //- Cell shapes
69 
70  //- Boundary faces
72 
73  //- Boundary patch types
75 
76  //- Default boundary patch name
78 
79  //- Default boundary patch types
81 
82  //- Boundary patch names
84 
85  //- Boundary patch physical types
87 
88  //- Point labels (SAMM point numbering is not necessarily contiguous)
90 
91  //- Point labels (SAMM point numbering is not necessarily contiguous)
93 
94  //- List of faces for every cell
96 
97  //- Global face list for polyMesh
99 
100  //- Cells as polyhedra for polyMesh
102 
103  //- Number of internal faces for polyMesh
105 
106  //- Polyhedral mesh boundary patch start indices
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
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();
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
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 // ************************************************************************* //
Foam::sammMesh::tetWedgePtr_
static const cellModel * tetWedgePtr_
Definition: sammMesh.H:125
Foam::sammMesh::nInternalFaces_
label nInternalFaces_
Number of internal faces for polyMesh.
Definition: sammMesh.H:103
Foam::sammMesh::readBoundary
void readBoundary()
Read the boundary file.
Foam::sammMesh::createBoundaryFaces
void createBoundaryFaces()
Create boundary faces from the quads.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::sammMesh::polyBoundaryPatches
List< polyPatch * > polyBoundaryPatches(const polyMesh &)
Add polyhedral boundary.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::sammMesh::createPolyMeshData
void createPolyMeshData()
Make polyhedral mesh data (packing)
Foam::sammMesh::operator=
void operator=(const sammMesh &)
Disallow default bitwise assignment.
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::sammMesh::cellPolys_
cellList cellPolys_
Cells as polyhedra for polyMesh.
Definition: sammMesh.H:100
Foam::sammMesh::cellShapes_
cellShapeList cellShapes_
Cell shapes.
Definition: sammMesh.H:67
Foam::sammMesh::unknownPtr_
static const cellModel * unknownPtr_
Pointers to cell models.
Definition: sammMesh.H:119
Foam::sammMesh::casePrefix_
fileName casePrefix_
Name of the case.
Definition: sammMesh.H:58
Foam::sammMesh::sammTrim1Ptr_
static const cellModel * sammTrim1Ptr_
Definition: sammMesh.H:127
Foam::sammMesh::boundary_
faceListList boundary_
Boundary faces.
Definition: sammMesh.H:70
Foam::sammMesh::sammTrim2Ptr_
static const cellModel * sammTrim2Ptr_
Definition: sammMesh.H:128
polyPatchList.H
Foam::sammMesh::sammTrim3Ptr_
static const cellModel * sammTrim3Ptr_
Definition: sammMesh.H:129
Foam::sammMesh
A messy mesh class which supports the possibility of creating a shapeMesh for regular Samm meshes (no...
Definition: sammMesh.H:53
Foam::sammMesh::patchNames_
wordList patchNames_
Boundary patch names.
Definition: sammMesh.H:82
Foam::sammMesh::starPointLabelLookup_
labelList starPointLabelLookup_
Point labels (SAMM point numbering is not necessarily contiguous)
Definition: sammMesh.H:88
Foam::sammMesh::isShapeMesh_
bool isShapeMesh_
Can the mesh be treated as a shapeMesh?
Definition: sammMesh.H:114
polyMesh.H
Foam::sammMesh::pyrPtr_
static const cellModel * pyrPtr_
Definition: sammMesh.H:123
Foam::sammMesh::wedgePtr_
static const cellModel * wedgePtr_
Definition: sammMesh.H:121
Foam::sammMesh::tetPtr_
static const cellModel * tetPtr_
Definition: sammMesh.H:124
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::sammMesh::defaultFacesName_
word defaultFacesName_
Default boundary patch name.
Definition: sammMesh.H:76
Foam::sammMesh::addRegularCell
void addRegularCell(const labelList &labels, const label nCreatedCells)
Foam::sammMesh::cellFaces_
faceListList cellFaces_
List of faces for every cell.
Definition: sammMesh.H:94
Foam::sammMesh::pointCellsPtr_
labelListList * pointCellsPtr_
Point-cell addressing. Used for topological analysis.
Definition: sammMesh.H:111
Foam::sammMesh::runTime_
const Time & runTime_
Database.
Definition: sammMesh.H:61
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::sammMesh::createPolyCells
void createPolyCells()
Make polyhedral cells and global faces if the mesh is polyhedral.
Foam::sammMesh::calcPointCells
void calcPointCells() const
Calculate pointCells.
Foam::sammMesh::patchPhysicalTypes_
wordList patchPhysicalTypes_
Boundary patch physical types.
Definition: sammMesh.H:85
Foam::sammMesh::fixCollapsedEdges
void fixCollapsedEdges()
Check and correct collapsed edges on faces.
Foam::sammMesh::points_
pointField points_
Points supporting the mesh.
Definition: sammMesh.H:64
Foam::sammMesh::sammEqualFace
bool sammEqualFace(const face &boundaryFace, const face &cellFace) const
Specialist version of face comparison to deal with.
Foam::sammMesh::addSAMMcell
void addSAMMcell(const label typeFlag, const labelList &globalLabels, const label nCreatedCells)
cellList.H
Foam::sammMesh::sammTrim8Ptr_
static const cellModel * sammTrim8Ptr_
Definition: sammMesh.H:132
Foam::sammMesh::readCells
void readCells()
Read the cells file.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::sammMesh::defaultFacesType_
word defaultFacesType_
Default boundary patch types.
Definition: sammMesh.H:79
Foam::sammMesh::~sammMesh
~sammMesh()
Destructor.
Foam::sammMesh::fillSammCellShapeTable
void fillSammCellShapeTable()
Fill SAMM lookup tables.
Foam::sammMesh::prismPtr_
static const cellModel * prismPtr_
Definition: sammMesh.H:122
Foam::sammMesh::shapeFaceLookup
static const label shapeFaceLookup[19][9]
Definition: sammMesh.H:134
Foam::sammMesh::readCouples
void readCouples()
Read couples.
Foam::sammMesh::pointCells
const labelListList & pointCells() const
Foam::sammMesh::meshFaces_
faceList meshFaces_
Global face list for polyMesh.
Definition: sammMesh.H:97
Foam::List< cellShape >
Foam::sammMesh::polyBoundaryPatchStartIndices_
labelList polyBoundaryPatchStartIndices_
Polyhedral mesh boundary patch start indices.
Definition: sammMesh.H:106
Foam::sammMesh::writeMesh
void writeMesh()
Write mesh.
cellShape.H
Foam::sammMesh::sammMesh
sammMesh(const sammMesh &)
Disallow default bitwise copy construct.
Foam::sammMesh::hexPtr_
static const cellModel * hexPtr_
Definition: sammMesh.H:120
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::sammMesh::sammShapeLookup
static List< const cellModel * > sammShapeLookup
SAMM addressing data.
Definition: sammMesh.H:138
Foam::cellModel
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:64
Foam::sammMesh::purgeCellShapes
void purgeCellShapes()
Purge cell shapes.
Foam::sammMesh::createPolyBoundary
void createPolyBoundary()
Make polyhedral boundary from shape boundary.
Foam::sammMesh::starCellLabelLookup_
labelList starCellLabelLookup_
Point labels (SAMM point numbering is not necessarily contiguous)
Definition: sammMesh.H:91
Foam::sammMesh::sammAddressingTable
static List< const label * > sammAddressingTable
Definition: sammMesh.H:139
Foam::sammMesh::readPoints
void readPoints(const scalar scaleFactor)
Read the points file.
Foam::sammMesh::patchTypes_
wordList patchTypes_
Boundary patch types.
Definition: sammMesh.H:73
Foam::sammMesh::sammTrim5Ptr_
static const cellModel * sammTrim5Ptr_
Definition: sammMesh.H:131
Foam::sammMesh::sammTrim4Ptr_
static const cellModel * sammTrim4Ptr_
Definition: sammMesh.H:130
Foam::sammMesh::fillSammAddressingTable
void fillSammAddressingTable()