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