OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

sammMesh.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::sammMesh
00027 
00028 Description
00029     A messy mesh class which supports the possibility of creating a shapeMesh
00030     for regular Samm meshes (no arbitrary interfaces or collapsed SAMM cells).
00031     If any of these special feateres exist, the mesh is created as polyMesh
00032 
00033 SourceFiles
00034     sammMesh.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef sammMesh_H
00039 #define sammMesh_H
00040 
00041 #include "polyMesh.H"
00042 #include "cellShape.H"
00043 #include "cellList.H"
00044 #include "polyPatchList.H"
00045 
00046 #ifndef namespaceFoam
00047 #define namespaceFoam
00048     using namespace Foam;
00049 #endif
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 // Forward declaration of classes
00054 
00055 /*---------------------------------------------------------------------------*\
00056                            Class sammMesh Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class sammMesh
00060 {
00061     // Private data
00062 
00063         //- Name of the case
00064         fileName casePrefix_;
00065 
00066         //- Database
00067         const Time& runTime_;
00068 
00069         //- Points supporting the mesh
00070         pointField points_;
00071 
00072         //- Cell shapes
00073         cellShapeList cellShapes_;
00074 
00075         //- Boundary faces
00076         faceListList boundary_;
00077 
00078         //- Boundary patch types
00079         wordList patchTypes_;
00080 
00081         //- Default boundary patch name
00082         word defaultFacesName_;
00083 
00084         //- Default boundary patch types
00085         word defaultFacesType_;
00086 
00087         //- Boundary patch names
00088         wordList patchNames_;
00089 
00090         //- Boundary patch physical types
00091         wordList patchPhysicalTypes_;
00092 
00093         //- Point labels (SAMM point numbering is not necessarily contiguous)
00094         labelList starPointLabelLookup_;
00095 
00096         //- Point labels (SAMM point numbering is not necessarily contiguous)
00097         labelList starCellLabelLookup_;
00098 
00099         //- List of faces for every cell
00100         faceListList cellFaces_;
00101 
00102         //- Global face list for polyMesh
00103         faceList meshFaces_;
00104 
00105         //- Cells as polyhedra for polyMesh
00106         cellList cellPolys_;
00107 
00108         //- Number of internal faces for polyMesh
00109         label nInternalFaces_;
00110 
00111         //- Polyhedral mesh boundary patch start indices
00112         labelList polyBoundaryPatchStartIndices_;
00113 
00114         //- Point-cell addressing. Used for topological analysis
00115         // Warning. This point cell addressing list potentially contains
00116         // duplicate cell entries. Use additional checking
00117         mutable labelListList* pointCellsPtr_;
00118 
00119         //- Can the mesh be treated as a shapeMesh?
00120         bool isShapeMesh_;
00121 
00122     // Private static data members
00123 
00124         //- Pointers to cell models
00125         static const cellModel* unknownPtr_;
00126         static const cellModel* hexPtr_;
00127         static const cellModel* wedgePtr_;
00128         static const cellModel* prismPtr_;
00129         static const cellModel* pyrPtr_;
00130         static const cellModel* tetPtr_;
00131         static const cellModel* tetWedgePtr_;
00132 
00133         static const cellModel* sammTrim1Ptr_;
00134         static const cellModel* sammTrim2Ptr_;
00135         static const cellModel* sammTrim3Ptr_;
00136         static const cellModel* sammTrim4Ptr_;
00137         static const cellModel* sammTrim5Ptr_;
00138         static const cellModel* sammTrim8Ptr_;
00139 
00140         static const label shapeFaceLookup[19][9];
00141 
00142 
00143         //- SAMM addressing data
00144         static List<const cellModel*> sammShapeLookup;
00145         static List<const label*> sammAddressingTable;
00146 
00147     // Private Member Functions
00148 
00149         //- Disallow default bitwise copy construct
00150         sammMesh(const sammMesh&);
00151 
00152         //- Disallow default bitwise assignment
00153         void operator=(const sammMesh&);
00154 
00155 
00156         //- Fill SAMM lookup tables
00157         void fillSammCellShapeTable();
00158         void fillSammAddressingTable();
00159 
00160 
00161         //- Read the points file
00162         void readPoints(const scalar scaleFactor);
00163 
00164 
00165         //- Read the cells file
00166         void readCells();
00167 
00168         void addRegularCell
00169         (
00170             const labelList& labels,
00171             const label nCreatedCells
00172         );
00173 
00174         void addSAMMcell
00175         (
00176             const label typeFlag,
00177             const labelList& globalLabels,
00178             const label nCreatedCells
00179         );
00180 
00181 
00182         //- Read the boundary file
00183         void readBoundary();
00184 
00185 
00186         //- Check and correct collapsed edges on faces
00187         // Note. If a collapsed edge is found, the mesh is no longer shapeMesh
00188         void fixCollapsedEdges();
00189 
00190         //- Read couples
00191         void readCouples();
00192 
00193         //- Calculate pointCells
00194         void calcPointCells() const;
00195 
00196         const labelListList& pointCells() const;
00197 
00198         //- Create boundary faces from the quads
00199         void createBoundaryFaces();
00200 
00201         //- Specialist version of face comparison to deal with
00202         // PROSTAR boundary format idiosyncracies
00203         bool sammEqualFace
00204         (
00205             const face& boundaryFace,
00206             const face& cellFace
00207         ) const;
00208 
00209         //- Purge cell shapes
00210         void purgeCellShapes();
00211 
00212         //- Make polyhedral cells and global faces if the mesh is polyhedral
00213         void createPolyCells();
00214 
00215         //- Make polyhedral boundary from shape boundary
00216         // (adds more faces to the face list)
00217         void createPolyBoundary();
00218 
00219         //- Make polyhedral mesh data (packing)
00220         void createPolyMeshData();
00221 
00222         //- Add polyhedral boundary
00223         List<polyPatch* > polyBoundaryPatches(const polyMesh&);
00224 
00225 
00226 public:
00227 
00228     // Static data members
00229 
00230 
00231     // Constructors
00232 
00233         //- Construct from case name
00234         sammMesh
00235         (
00236             const fileName& prefix,
00237             const Time& rt,
00238             const scalar scaleFactor
00239         );
00240 
00241 
00242     // Destructor
00243 
00244         ~sammMesh();
00245 
00246 
00247     // Member Functions
00248 
00249         //- Write mesh
00250         void writeMesh();
00251 
00252     // Member Operators
00253 
00254     // Friend Functions
00255 
00256     // Friend Operators
00257 
00258     // IOstream Operators
00259     // Ostream Operator
00260 };
00261 
00262 
00263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00264 
00265 #endif
00266 
00267 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd