1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
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
35 \*---------------------------------------------------------------------------*/
41 #include "cellShape.H"
43 #include "polyPatchList.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Forward declaration of classes
54 /*---------------------------------------------------------------------------*\
55 Class sammMesh Declaration
56 \*---------------------------------------------------------------------------*/
68 //- Points supporting the mesh
72 cellShapeList cellShapes_;
75 faceListList boundary_;
77 //- Boundary patch types
80 //- Default boundary patch name
81 word defaultFacesName_;
83 //- Default boundary patch types
84 word defaultFacesType_;
86 //- Boundary patch names
89 //- Boundary patch physical types
90 wordList patchPhysicalTypes_;
92 //- Point labels (SAMM point numbering is not necessarily contiguous)
93 labelList starPointLabelLookup_;
95 //- Point labels (SAMM point numbering is not necessarily contiguous)
96 labelList starCellLabelLookup_;
98 //- List of faces for every cell
99 faceListList cellFaces_;
101 //- Global face list for polyMesh
104 //- Cells as polyhedra for polyMesh
107 //- Number of internal faces for polyMesh
108 label nInternalFaces_;
110 //- Polyhedral mesh boundary patch start indices
111 labelList polyBoundaryPatchStartIndices_;
113 //- Point-cell addressing. Used for topological analysis
114 // Warning. This point cell addressing list potentially contains
115 // duplicate cell entries. Use additional checking
116 mutable labelListList* pointCellsPtr_;
118 //- Can the mesh be treated as a shapeMesh?
121 // Private static data members
123 //- Pointers to cell models
124 static const cellModel* unknownPtr_;
125 static const cellModel* hexPtr_;
126 static const cellModel* wedgePtr_;
127 static const cellModel* prismPtr_;
128 static const cellModel* pyrPtr_;
129 static const cellModel* tetPtr_;
130 static const cellModel* tetWedgePtr_;
132 static const cellModel* sammTrim1Ptr_;
133 static const cellModel* sammTrim2Ptr_;
134 static const cellModel* sammTrim3Ptr_;
135 static const cellModel* sammTrim4Ptr_;
136 static const cellModel* sammTrim5Ptr_;
137 static const cellModel* sammTrim8Ptr_;
139 static const label shapeFaceLookup[19][9];
142 //- SAMM addressing data
143 static List<const cellModel*> sammShapeLookup;
144 static List<const label*> sammAddressingTable;
146 // Private Member Functions
148 //- Disallow default bitwise copy construct
149 sammMesh(const sammMesh&);
151 //- Disallow default bitwise assignment
152 void operator=(const sammMesh&);
155 //- Fill SAMM lookup tables
156 void fillSammCellShapeTable();
157 void fillSammAddressingTable();
160 //- Read the points file
161 void readPoints(const scalar scaleFactor);
164 //- Read the cells file
169 const labelList& labels,
170 const label nCreatedCells
175 const label typeFlag,
176 const labelList& globalLabels,
177 const label nCreatedCells
181 //- Read the boundary file
185 //- Check and correct collapsed edges on faces
186 // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
187 void fixCollapsedEdges();
192 //- Calculate pointCells
193 void calcPointCells() const;
195 const labelListList& pointCells() const;
197 //- Create boundary faces from the quads
198 void createBoundaryFaces();
200 //- Specialist version of face comparison to deal with
201 // PROSTAR boundary format idiosyncracies
204 const face& boundaryFace,
208 //- Purge cell shapes
209 void purgeCellShapes();
211 //- Make polyhedral cells and global faces if the mesh is polyhedral
212 void createPolyCells();
214 //- Make polyhedral boundary from shape boundary
215 // (adds more faces to the face list)
216 void createPolyBoundary();
218 //- Make polyhedral mesh data (packing)
219 void createPolyMeshData();
221 //- Add polyhedral boundary
222 List<polyPatch* > polyBoundaryPatches(const polyMesh&);
227 // Static data members
232 //- Construct from case name
235 const fileName& prefix,
237 const scalar scaleFactor
256 // IOstream Operators
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 // ************************************************************************* //