Merge branch 'master' of github.com:OpenCFD/OpenFOAM-2.0.x
[OpenFOAM-2.0.x.git] / src / conversion / meshReader / starcd / STARCDMeshReader.H
blobb18647fc12220a02fdc05bee3c243da5af34b115
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2011 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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::meshReaders::STARCD
27 Description
28     Read pro-STAR vrt/cel/bnd files.
29     The protected data in meshReader are filled.
31     Starting with pro-STAR version 4, the files have become easier to read.
32     - vertices are space-delimited.
33     - the cell format is logical.
34     - trimmed and degenerate cells are saved as polyhedral.
35     - the boundaries corresponds to cells and their faces.
37 SourceFiles
38     STARCDMeshReader.C
40 \*---------------------------------------------------------------------------*/
42 #ifndef STARCDMeshReader_H
43 #define STARCDMeshReader_H
45 # include "meshReader.H"
46 # include "boundaryRegion.H"
47 # include "cellShape.H"
48 # include "IFstream.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 namespace Foam
55 namespace meshReaders
58 /*---------------------------------------------------------------------------*\
59                     Class meshReaders::STARCD Declaration
60 \*---------------------------------------------------------------------------*/
62 class STARCD
64     public meshReader
67 protected:
69     // Protected Data
71         static const char* const defaultBoundaryName;
72         static const char* const defaultSolidBoundaryName;
74         //- Face addressing from pro-STAR faces -> OpenFOAM faces
75         static const int starToFoamFaceAddr[4][6];
77         //- Cell shapes
78         cellShapeList cellShapes_;
80         //- Point labels (imported Point numbering not necessarily contiguous)
81         labelList mapToFoamPointId_;
83         //- Cell labels (imported Cell numbering not necessarily contiguous)
84         labelList mapToFoamCellId_;
86         //- Boundary region data
87         boundaryRegion boundaryRegion_;
90     // Protected Member Functions
92         //- Disallow default bitwise copy construct
93         STARCD(const STARCD&);
95         //- Disallow default bitwise assignment
96         void operator=(const STARCD&);
98         //- Read the mesh from the file(s)
99         virtual bool readGeometry(const scalar scaleFactor = 1.0);
101         //- Read points from file
102         void readPoints(const fileName&, const scalar scaleFactor);
104         //- Read cell connectivities from file
105         virtual void readCells(const fileName&);
107         //- Remove unused points
108         void cullPoints();
110         //- Read boundary (cell/face) definitions
111         void readBoundary(const fileName&);
113         //- Read auxiliary data from constant/{boundaryRegion,cellTable}
114         void readAux(const objectRegistry&);
116         //- Read and discard to newline
117         static void readToNewline(IFstream&);
119         //- Read header
120         static bool readHeader(IFstream&, word fileSignature);
123 protected:
125         enum cellType
126         {
127             starcdFluidType   = 1,
128             starcdSolidType   = 2,
129             starcdBaffleType  = 3,
130             starcdShellType   = 4,
131             starcdLineType    = 5,
132             starcdPointType   = 6
133         };
135         enum shapeType
136         {
137             starcdPoint = 1,
138             starcdLine  = 2,
139             starcdShell = 3,
140             starcdHex   = 11,
141             starcdPrism = 12,
142             starcdTet   = 13,
143             starcdPyr   = 14,
144             starcdPoly  = 255
145         };
148 public:
150     // Static data
152         //- Keep solids (default false)
153         static bool keepSolids;
156     // Constructors
158         //- Construct from case name
159         STARCD
160         (
161             const fileName& prefix,
162             const objectRegistry&,
163             const scalar scaleFactor = 1.0
164         );
167     //- Destructor
168     virtual ~STARCD();
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace meshReaders
175 } // End namespace Foam
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 #endif
181 // ************************************************************************* //