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

STARCDMeshReader.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::meshReaders::STARCD
00027 
00028 Description
00029     Read pro-STAR vrt/cel/bnd files.
00030     The protected data in meshReader are filled.
00031 
00032     Starting with pro-STAR version 4, the files have become easier to read.
00033     - vertices are space-delimited.
00034     - the cell format is logical.
00035     - trimmed and degenerate cells are saved as polyhedral.
00036     - the boundaries corresponds to cells and their faces.
00037 
00038 SourceFiles
00039     STARCDMeshReader.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef STARCDMeshReader_H
00044 #define STARCDMeshReader_H
00045 
00046 # include "meshReader.H"
00047 # include "boundaryRegion.H"
00048 # include "cellShape.H"
00049 # include "IFstream.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 namespace meshReaders
00057 {
00058 
00059 /*---------------------------------------------------------------------------*\
00060                     Class meshReaders::STARCD Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class STARCD
00064 :
00065     public meshReader
00066 {
00067 
00068 protected:
00069 
00070     // Protected Data
00071 
00072         static const char* defaultBoundaryName;
00073         static const char* defaultSolidBoundaryName;
00074 
00075         //- Face addressing from pro-STAR faces -> OpenFOAM faces
00076         static const int starToFoamFaceAddr[4][6];
00077 
00078         //- Cell shapes
00079         cellShapeList cellShapes_;
00080 
00081         //- Point labels (imported Point numbering not necessarily contiguous)
00082         labelList mapToFoamPointId_;
00083 
00084         //- Cell labels (imported Cell numbering not necessarily contiguous)
00085         labelList mapToFoamCellId_;
00086 
00087         //- Boundary region data
00088         boundaryRegion boundaryRegion_;
00089 
00090 
00091     // Protected Member Functions
00092 
00093         //- Disallow default bitwise copy construct
00094         STARCD(const STARCD&);
00095 
00096         //- Disallow default bitwise assignment
00097         void operator=(const STARCD&);
00098 
00099         //- Read the mesh from the file(s)
00100         virtual bool readGeometry(const scalar scaleFactor = 1.0);
00101 
00102         //- Read points from file
00103         void readPoints(const fileName&, const scalar scaleFactor);
00104 
00105         //- Read cell connectivities from file
00106         virtual void readCells(const fileName&);
00107 
00108         //- Remove unused points
00109         void cullPoints();
00110 
00111         //- Read boundary (cell/face) definitions
00112         void readBoundary(const fileName&);
00113 
00114         //- Read auxiliary data from constant/{boundaryRegion,cellTable}
00115         void readAux(const objectRegistry&);
00116 
00117         //- Read and discard to newline
00118         static void readToNewline(IFstream&);
00119 
00120         //- Read header
00121         static bool readHeader(IFstream&, word fileSignature);
00122 
00123 
00124 protected:
00125 
00126         enum cellType
00127         {
00128             starcdFluidType   = 1,
00129             starcdSolidType   = 2,
00130             starcdBaffleType  = 3,
00131             starcdShellType   = 4,
00132             starcdLineType    = 5,
00133             starcdPointType   = 6
00134         };
00135 
00136         enum shapeType
00137         {
00138             starcdPoint = 1,
00139             starcdLine  = 2,
00140             starcdShell = 3,
00141             starcdHex   = 11,
00142             starcdPrism = 12,
00143             starcdTet   = 13,
00144             starcdPyr   = 14,
00145             starcdPoly  = 255
00146         };
00147 
00148 
00149 public:
00150 
00151     // Static data
00152 
00153         //- Keep solids (default false)
00154         static bool keepSolids;
00155 
00156 
00157     // Constructors
00158 
00159         //- Construct from case name
00160         STARCD
00161         (
00162             const fileName& prefix,
00163             const objectRegistry&,
00164             const scalar scaleFactor = 1.0
00165         );
00166 
00167 
00168     //- Destructor
00169     virtual ~STARCD();
00170 };
00171 
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 } // End namespace meshReaders
00176 } // End namespace Foam
00177 
00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00179 
00180 #endif
00181 
00182 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd