initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / conversion / meshReader / starcd / STARCDMeshReader.H
blobf4886664d3b503914f318aae89f64a1a1ff46a78
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::meshReaders::STARCD
28 Description
29     Read pro-STAR vrt/cel/bnd files.
30     The protected data in meshReader are filled.
32     Starting with pro-STAR version 4, the files have become easier to read.
33     - vertices are space-delimited.
34     - the cell format is logical.
35     - trimmed and degenerate cells are saved as polyhedral.
36     - the boundaries corresponds to cells and their faces.
38 SourceFiles
39     STARCDMeshReader.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef STARCDMeshReader_H
44 #define STARCDMeshReader_H
46 # include "meshReader.H"
47 # include "boundaryRegion.H"
48 # include "cellShape.H"
49 # include "IFstream.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 namespace meshReaders
59 /*---------------------------------------------------------------------------*\
60                     Class meshReaders::STARCD Declaration
61 \*---------------------------------------------------------------------------*/
63 class STARCD
65     public meshReader
68 protected:
70     // Protected Data
72         static const char* defaultBoundaryName;
73         static const char* defaultSolidBoundaryName;
75         //- Face addressing from pro-STAR faces -> OpenFOAM faces
76         static const int starToFoamFaceAddr[4][6];
78         //- Cell shapes
79         cellShapeList cellShapes_;
81         //- Point labels (imported Point numbering not necessarily contiguous)
82         labelList mapToFoamPointId_;
84         //- Cell labels (imported Cell numbering not necessarily contiguous)
85         labelList mapToFoamCellId_;
87         //- Boundary region data
88         boundaryRegion boundaryRegion_;
91     // Protected Member Functions
93         //- Disallow default bitwise copy construct
94         STARCD(const STARCD&);
96         //- Disallow default bitwise assignment
97         void operator=(const STARCD&);
99         //- Read the mesh from the file(s)
100         virtual bool readGeometry(const scalar scaleFactor = 1.0);
102         //- Read points from file
103         void readPoints(const fileName&, const scalar scaleFactor);
105         //- Read cell connectivities from file
106         virtual void readCells(const fileName&);
108         //- Remove unused points
109         void cullPoints();
111         //- Read boundary (cell/face) definitions
112         void readBoundary(const fileName&);
114         //- Read auxiliary data from constant/{boundaryRegion,cellTable}
115         void readAux(const objectRegistry&);
117         //- Read and discard to newline
118         static void readToNewline(IFstream&);
120         //- Read header
121         static bool readHeader(IFstream&, word fileSignature);
124 protected:
126         enum cellType
127         {
128             starcdFluidType   = 1,
129             starcdSolidType   = 2,
130             starcdBaffleType  = 3,
131             starcdShellType   = 4,
132             starcdLineType    = 5,
133             starcdPointType   = 6
134         };
136         enum shapeType
137         {
138             starcdPoint = 1,
139             starcdLine  = 2,
140             starcdShell = 3,
141             starcdHex   = 11,
142             starcdPrism = 12,
143             starcdTet   = 13,
144             starcdPyr   = 14,
145             starcdPoly  = 255
146         };
149 public:
151     // Static data
153         //- Keep solids (default false)
154         static bool keepSolids;
157     // Constructors
159         //- Construct from case name
160         STARCD
161         (
162             const fileName& prefix,
163             const objectRegistry&,
164             const scalar scaleFactor = 1.0
165         );
168     //- Destructor
169     virtual ~STARCD();
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 } // End namespace meshReaders
176 } // End namespace Foam
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 #endif
182 // ************************************************************************* //