initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / conversion / sammToFoam / sammMesh.H
blobebf13da96c1b533b71933bfce966540e67a4cbbc
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::sammMesh
28 Description
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
33 SourceFiles
34     sammMesh.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef sammMesh_H
39 #define sammMesh_H
41 #include "polyMesh.H"
42 #include "cellShape.H"
43 #include "cellList.H"
44 #include "polyPatchList.H"
46 #ifndef namespaceFoam
47 #define namespaceFoam
48     using namespace Foam;
49 #endif
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
55 /*---------------------------------------------------------------------------*\
56                            Class sammMesh Declaration
57 \*---------------------------------------------------------------------------*/
59 class sammMesh
61     // Private data
63         //- Name of the case
64         fileName casePrefix_;
66         //- Database
67         const Time& runTime_;
69         //- Points supporting the mesh
70         pointField points_;
72         //- Cell shapes
73         cellShapeList cellShapes_;
75         //- Boundary faces
76         faceListList boundary_;
78         //- Boundary patch types
79         wordList patchTypes_;
81         //- Default boundary patch name
82         word defaultFacesName_;
84         //- Default boundary patch types
85         word defaultFacesType_;
87         //- Boundary patch names
88         wordList patchNames_;
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
103         faceList meshFaces_;
105         //- Cells as polyhedra for polyMesh
106         cellList cellPolys_;
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?
120         bool isShapeMesh_;
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
166         void readCells();
168         void addRegularCell
169         (
170             const labelList& labels,
171             const label nCreatedCells
172         );
174         void addSAMMcell
175         (
176             const label typeFlag,
177             const labelList& globalLabels,
178             const label nCreatedCells
179         );
182         //- Read the boundary file
183         void readBoundary();
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();
190         //- Read couples
191         void readCouples();
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
203         bool sammEqualFace
204         (
205             const face& boundaryFace,
206             const face& cellFace
207         ) const;
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&);
226 public:
228     // Static data members
231     // Constructors
233         //- Construct from case name
234         sammMesh
235         (
236             const fileName& prefix,
237             const Time& rt,
238             const scalar scaleFactor
239         );
242     // Destructor
244         ~sammMesh();
247     // Member Functions
249         //- Write mesh
250         void writeMesh();
252     // Member Operators
254     // Friend Functions
256     // Friend Operators
258     // IOstream Operators
259     // Ostream Operator
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 #endif
267 // ************************************************************************* //