1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A messy mesh class which supports the possibility of creating a shapeMesh
30 for regular Samm meshes (no arbitrary interfaces or collapsed SAMM cells).
31 If any of these special feateres exist, the mesh is created as polyMesh
36 \*---------------------------------------------------------------------------*/
42 #include "cellShape.H"
44 #include "polyPatchList.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
55 /*---------------------------------------------------------------------------*\
56 Class sammMesh Declaration
57 \*---------------------------------------------------------------------------*/
69 //- Points supporting the mesh
73 cellShapeList cellShapes_;
76 faceListList boundary_;
78 //- Boundary patch types
81 //- Default boundary patch name
82 word defaultFacesName_;
84 //- Default boundary patch types
85 word defaultFacesType_;
87 //- Boundary patch names
90 //- Boundary patch physical types
91 wordList patchPhysicalTypes_;
93 //- Point labels (SAMM point numbering is not necessarily contiguous)
94 labelList starPointLabelLookup_;
96 //- Point labels (SAMM point numbering is not necessarily contiguous)
97 labelList starCellLabelLookup_;
99 //- List of faces for every cell
100 faceListList cellFaces_;
102 //- Global face list for polyMesh
105 //- Cells as polyhedra for polyMesh
108 //- Number of internal faces for polyMesh
109 label nInternalFaces_;
111 //- Polyhedral mesh boundary patch start indices
112 labelList polyBoundaryPatchStartIndices_;
114 //- Point-cell addressing. Used for topological analysis
115 // Warning. This point cell addressing list potentially contains
116 // duplicate cell entries. Use additional checking
117 mutable labelListList* pointCellsPtr_;
119 //- Can the mesh be treated as a shapeMesh?
122 // Private static data members
124 //- Pointers to cell models
125 static const cellModel* unknownPtr_;
126 static const cellModel* hexPtr_;
127 static const cellModel* wedgePtr_;
128 static const cellModel* prismPtr_;
129 static const cellModel* pyrPtr_;
130 static const cellModel* tetPtr_;
131 static const cellModel* tetWedgePtr_;
133 static const cellModel* sammTrim1Ptr_;
134 static const cellModel* sammTrim2Ptr_;
135 static const cellModel* sammTrim3Ptr_;
136 static const cellModel* sammTrim4Ptr_;
137 static const cellModel* sammTrim5Ptr_;
138 static const cellModel* sammTrim8Ptr_;
140 static const label shapeFaceLookup[19][9];
143 //- SAMM addressing data
144 static List<const cellModel*> sammShapeLookup;
145 static List<const label*> sammAddressingTable;
147 // Private Member Functions
149 //- Disallow default bitwise copy construct
150 sammMesh(const sammMesh&);
152 //- Disallow default bitwise assignment
153 void operator=(const sammMesh&);
156 //- Fill SAMM lookup tables
157 void fillSammCellShapeTable();
158 void fillSammAddressingTable();
161 //- Read the points file
162 void readPoints(const scalar scaleFactor);
165 //- Read the cells file
170 const labelList& labels,
171 const label nCreatedCells
176 const label typeFlag,
177 const labelList& globalLabels,
178 const label nCreatedCells
182 //- Read the boundary file
186 //- Check and correct collapsed edges on faces
187 // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
188 void fixCollapsedEdges();
193 //- Calculate pointCells
194 void calcPointCells() const;
196 const labelListList& pointCells() const;
198 //- Create boundary faces from the quads
199 void createBoundaryFaces();
201 //- Specialist version of face comparison to deal with
202 // PROSTAR boundary format idiosyncracies
205 const face& boundaryFace,
209 //- Purge cell shapes
210 void purgeCellShapes();
212 //- Make polyhedral cells and global faces if the mesh is polyhedral
213 void createPolyCells();
215 //- Make polyhedral boundary from shape boundary
216 // (adds more faces to the face list)
217 void createPolyBoundary();
219 //- Make polyhedral mesh data (packing)
220 void createPolyMeshData();
222 //- Add polyhedral boundary
223 List<polyPatch* > polyBoundaryPatches(const polyMesh&);
228 // Static data members
233 //- Construct from case name
236 const fileName& prefix,
238 const scalar scaleFactor
258 // IOstream Operators
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 // ************************************************************************* //