FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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