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 Star meshes (no arbitrary interfaces or collapsed SAMM cells).
30 If any of these special feateres exist, the mesh is created as polyMesh
39 mergeCoupleFacePoints.C
47 \*---------------------------------------------------------------------------*/
53 #include "cellShape.H"
55 #include "polyPatchList.H"
56 #include "coupledFacePair.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 /*---------------------------------------------------------------------------*\
68 Class starMesh Declaration
69 \*---------------------------------------------------------------------------*/
81 //- Points supporting the mesh
85 cellShapeList cellShapes_;
88 faceListList boundary_;
90 //- Boundary patch types
93 //- Default boundary patch name
94 word defaultFacesName_;
96 //- Default boundary patch types
97 word defaultFacesType_;
99 //- Boundary patch names
100 wordList patchNames_;
102 //- Boundary patch physical types
103 wordList patchPhysicalTypes_;
105 //- Point labels (STAR point numbering is not necessarily contiguous)
106 labelList starPointLabelLookup_;
108 //- STAR point number for a given vertex
109 labelList starPointID_;
111 //- STAR Cell number for a given cell
112 labelList starCellID_;
114 //- Cell labels (STAR cell numbering is not necessarily contiguous)
115 labelList starCellLabelLookup_;
117 //- STAR Cell permutation label
118 labelList starCellPermutation_;
120 //- List of faces for every cell
121 faceListList cellFaces_;
123 //- Cell ID for every boundary face. Used in two-tier boundary
125 labelListList boundaryCellIDs_;
127 //- Cell face ID for every boundary face. Used in two-tier boundary
129 labelListList boundaryCellFaceIDs_;
131 //- Global face list for polyMesh
134 //- Cells as polyhedra for polyMesh
137 //- Number of internal faces for polyMesh
138 label nInternalFaces_;
140 //- Polyhedral mesh boundary patch start indices
141 labelList polyBoundaryPatchStartIndices_;
143 //- Point-cell addressing. Used for topological analysis
144 // Warning. This point cell addressing list potentially contains
145 // duplicate cell entries. Use additional checking
146 mutable labelListList* pointCellsPtr_;
148 //- List of face couples
149 PtrList<coupledFacePair> couples_;
151 //- Can the mesh be treated as a shapeMesh?
154 // Private static data members
156 //- Error on unity small tolerance
157 static const scalar smallMergeTol_;
159 //- Couple match relative point merge tolerance
160 static const scalar cpMergePointTol_;
162 //- Pointers to cell models
163 static const cellModel* unknownPtr_;
164 static const cellModel* tetPtr_;
165 static const cellModel* pyrPtr_;
166 static const cellModel* tetWedgePtr_;
167 static const cellModel* prismPtr_;
168 static const cellModel* wedgePtr_;
169 static const cellModel* hexPtr_;
171 static const cellModel* sammTrim1Ptr_;
172 static const cellModel* sammTrim2Ptr_;
173 static const cellModel* sammTrim3Ptr_;
174 static const cellModel* sammTrim4Ptr_;
175 static const cellModel* sammTrim5Ptr_;
176 static const cellModel* sammTrim8Ptr_;
178 //- Regular addressing data
179 static const label regularAddressingTable[6][8];
181 //- SAMM addressing data
182 static const label sammAddressingTable[9][12];
184 static const label sammFacePermutationTable[24][8];
186 static const label shapeFaceLookup[19][9];
189 // Private Member Functions
191 //- Disallow default bitwise copy construct
192 starMesh(const starMesh&);
194 //- Disallow default bitwise assignment
195 void operator=(const starMesh&);
198 //- read fixed format vertex label
199 static label readVtxLabel(IFstream&);
201 //- read fixed format vertex coordinate component
202 static scalar readVtxCmpt(IFstream&);
205 static void readToNl(IFstream&);
207 //- Read the points file
208 void readPoints(const scalar scaleFactor);
210 //- Read the cells file
215 const labelList& labels,
216 const label nCreatedCells
221 const labelList& labels,
222 const label nCreatedCells
225 //- Read the boundary file
228 //- Check and correct collapsed edges on faces
229 // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
230 void fixCollapsedEdges();
235 //- Create couple matches
236 void createCoupleMatches();
238 //- Calculate pointCells
239 void calcPointCells() const;
241 const labelListList& pointCells() const;
243 //- Mark boundary faces from the quads
244 void markBoundaryFaces();
246 //- Collect boundary faces from the quads
247 void collectBoundaryFaces();
249 //- Specialist version of face comparison to deal with
250 // PROSTAR boundary format idiosyncracies
253 const face& boundaryFace,
257 //- Merge couple face points
258 void mergeCoupleFacePoints();
260 //- Point indexing structure used by sort to keep track of
268 //- Purge cell shapes
269 void purgeCellShapes();
271 //- Make polyhedral cells and global faces if the mesh is polyhedral
272 void createPolyCells();
274 //- Make polyhedral boundary from shape boundary
275 // (adds more faces to the face list)
276 void createPolyBoundary();
278 //- Make polyhedral mesh data (packing)
279 void createPolyMeshData();
281 //- Add polyhedral boundary
282 List<polyPatch*> polyBoundaryPatches(const polyMesh&);
284 //- Clear extra storage before creation of the mesh to remove
286 void clearExtraStorage();
293 //- Construct from case name
296 const fileName& prefix,
298 const scalar scaleFactor
313 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 // ************************************************************************* //