STARCDMeshReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::meshReaders::STARCD
26 
27 Description
28  Read pro-STAR vrt/cel/bnd files.
29  The protected data in meshReader are filled.
30 
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.
36 
37 SourceFiles
38  STARCDMeshReader.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef STARCDMeshReader_H
43 #define STARCDMeshReader_H
44 
45 # include "meshReader.H"
46 # include "boundaryRegion.H"
47 # include "cellShape.H"
48 # include "IFstream.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 namespace meshReaders
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class meshReaders::STARCD Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class STARCD
63 :
64  public meshReader
65 {
66 
67 protected:
68 
69  // Protected Data
70 
71  static const char* const defaultBoundaryName;
72  static const char* const defaultSolidBoundaryName;
73 
74  //- Face addressing from pro-STAR faces -> OpenFOAM faces
75  static const int starToFoamFaceAddr[4][6];
76 
77  //- Cell shapes
79 
80  //- Point labels (imported Point numbering not necessarily contiguous)
82 
83  //- Cell labels (imported Cell numbering not necessarily contiguous)
85 
86  //- Boundary region data
88 
89 
90  // Protected Member Functions
91 
92  //- Disallow default bitwise copy construct
93  STARCD(const STARCD&);
94 
95  //- Disallow default bitwise assignment
96  void operator=(const STARCD&);
97 
98  //- Read the mesh from the file(s)
99  virtual bool readGeometry(const scalar scaleFactor = 1.0);
100 
101  //- Read points from file
102  void readPoints(const fileName&, const scalar scaleFactor);
103 
104  //- Read cell connectivities from file
105  virtual void readCells(const fileName&);
106 
107  //- Remove unused points
108  void cullPoints();
109 
110  //- Read boundary (cell/face) definitions
111  void readBoundary(const fileName&);
112 
113  //- Read auxiliary data from constant/{boundaryRegion,cellTable}
114  void readAux(const objectRegistry&);
115 
116  //- Read and discard to newline
117  static void readToNewline(IFstream&);
118 
119  //- Read header
120  static bool readHeader(IFstream&, word fileSignature);
121 
122 
123 protected:
124 
125  enum cellType
126  {
132  starcdPointType = 6
133  };
134 
135  enum shapeType
136  {
140  starcdHex = 11,
142  starcdTet = 13,
143  starcdPyr = 14,
144  starcdPoly = 255
145  };
146 
147 
148 public:
149 
150  // Static data
151 
152  //- Keep solids (default false)
153  static bool keepSolids;
154 
155 
156  // Constructors
157 
158  //- Construct from case name
159  STARCD
160  (
161  const fileName& prefix,
162  const objectRegistry&,
163  const scalar scaleFactor = 1.0
164  );
165 
166 
167  //- Destructor
168  virtual ~STARCD();
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace meshReaders
175 } // End namespace Foam
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
Foam::meshReaders::STARCD::readToNewline
static void readToNewline(IFstream &)
Read and discard to newline.
Definition: STARCDMeshReader.C:57
Foam::meshReaders::STARCD::starcdPointType
@ starcdPointType
Definition: STARCDMeshReader.H:131
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::IFstream
Input from file stream.
Definition: IFstream.H:81
Foam::meshReaders::STARCD::readCells
virtual void readCells(const fileName &)
Read cell connectivities from file.
Definition: STARCDMeshReader.C:244
Foam::boundaryRegion
The boundaryRegion persistent data saved as a Map<dictionary>.
Definition: boundaryRegion.H:70
Foam::meshReaders::STARCD::cullPoints
void cullPoints()
Remove unused points.
Definition: STARCDMeshReader.C:982
Foam::meshReaders::STARCD::starcdPoint
@ starcdPoint
Definition: STARCDMeshReader.H:136
Foam::meshReaders::STARCD::defaultBoundaryName
static const char *const defaultBoundaryName
Definition: STARCDMeshReader.H:70
Foam::meshReaders::STARCD::starcdTet
@ starcdTet
Definition: STARCDMeshReader.H:141
Foam::meshReaders::STARCD::STARCD
STARCD(const STARCD &)
Disallow default bitwise copy construct.
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::meshReaders::STARCD::~STARCD
virtual ~STARCD()
Destructor.
Definition: STARCDMeshReader.C:1075
Foam::meshReaders::STARCD::readHeader
static bool readHeader(IFstream &, word fileSignature)
Read header.
Definition: STARCDMeshReader.C:68
Foam::meshReaders::STARCD::starcdFluidType
@ starcdFluidType
Definition: STARCDMeshReader.H:126
Foam::meshReaders::STARCD::starcdShellType
@ starcdShellType
Definition: STARCDMeshReader.H:129
Foam::meshReaders::STARCD::starcdLine
@ starcdLine
Definition: STARCDMeshReader.H:137
Foam::meshReaders::STARCD::mapToFoamCellId_
labelList mapToFoamCellId_
Cell labels (imported Cell numbering not necessarily contiguous)
Definition: STARCDMeshReader.H:83
Foam::meshReaders::STARCD::starcdPoly
@ starcdPoly
Definition: STARCDMeshReader.H:143
Foam::meshReaders::STARCD::starcdBaffleType
@ starcdBaffleType
Definition: STARCDMeshReader.H:128
Foam::meshReaders::STARCD::cellType
cellType
Definition: STARCDMeshReader.H:124
Foam::meshReaders::STARCD::starToFoamFaceAddr
static const int starToFoamFaceAddr[4][6]
Face addressing from pro-STAR faces -> OpenFOAM faces.
Definition: STARCDMeshReader.H:74
Foam::meshReaders::STARCD::readGeometry
virtual bool readGeometry(const scalar scaleFactor=1.0)
Read the mesh from the file(s)
Definition: STARCDMeshReader.C:1042
Foam::meshReaders::STARCD::readPoints
void readPoints(const fileName &, const scalar scaleFactor)
Read points from file.
Definition: STARCDMeshReader.C:119
Foam::meshReaders::STARCD::starcdPrism
@ starcdPrism
Definition: STARCDMeshReader.H:140
Foam::meshReaders::STARCD::starcdPyr
@ starcdPyr
Definition: STARCDMeshReader.H:142
IFstream.H
Foam::meshReaders::STARCD::mapToFoamPointId_
labelList mapToFoamPointId_
Point labels (imported Point numbering not necessarily contiguous)
Definition: STARCDMeshReader.H:80
Foam::meshReaders::STARCD::cellShapes_
cellShapeList cellShapes_
Cell shapes.
Definition: STARCDMeshReader.H:77
Foam::meshReaders::STARCD::starcdShell
@ starcdShell
Definition: STARCDMeshReader.H:138
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshReaders::STARCD::starcdLineType
@ starcdLineType
Definition: STARCDMeshReader.H:130
Foam::meshReaders::STARCD::readBoundary
void readBoundary(const fileName &)
Read boundary (cell/face) definitions.
Definition: STARCDMeshReader.C:635
Foam::meshReaders::STARCD::boundaryRegion_
boundaryRegion boundaryRegion_
Boundary region data.
Definition: STARCDMeshReader.H:86
Foam::meshReader
This class supports creating polyMeshes with baffles.
Definition: meshReader.H:73
Foam::meshReaders::STARCD::starcdSolidType
@ starcdSolidType
Definition: STARCDMeshReader.H:127
Foam::meshReaders::STARCD::defaultSolidBoundaryName
static const char *const defaultSolidBoundaryName
Definition: STARCDMeshReader.H:71
Foam::List< cellShape >
Foam::meshReaders::STARCD::keepSolids
static bool keepSolids
Keep solids (default false)
Definition: STARCDMeshReader.H:152
Foam::meshReaders::STARCD::shapeType
shapeType
Definition: STARCDMeshReader.H:134
Foam::meshReaders::STARCD::readAux
void readAux(const objectRegistry &)
Read auxiliary data from constant/{boundaryRegion,cellTable}.
Definition: STARCDMeshReader.C:98
cellShape.H
Foam::meshReaders::STARCD::starcdHex
@ starcdHex
Definition: STARCDMeshReader.H:139
meshReader.H
Foam::meshReaders::STARCD
Read pro-STAR vrt/cel/bnd files. The protected data in meshReader are filled.
Definition: STARCDMeshReader.H:61
boundaryRegion.H
Foam::meshReaders::STARCD::operator=
void operator=(const STARCD &)
Disallow default bitwise assignment.