STARCDMeshReader.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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  //- Read the mesh from the file(s)
93  virtual bool readGeometry(const scalar scaleFactor = 1.0);
94 
95  //- Read points from file
96  void readPoints(const fileName&, const scalar scaleFactor);
97 
98  //- Read cell connectivities from file
99  virtual void readCells(const fileName&);
100 
101  //- Remove unused points
102  void cullPoints();
103 
104  //- Read boundary (cell/face) definitions
105  void readBoundary(const fileName&);
106 
107  //- Read auxiliary data from constant/{boundaryRegion,cellTable}
108  void readAux(const objectRegistry&);
109 
110  //- Read and discard to newline
111  static void readToNewline(IFstream&);
112 
113  //- Read header
114  static bool readHeader(IFstream&, word fileSignature);
115 
116 
117 protected:
118 
119  enum cellType
120  {
125  starcdLineType = 5,
127  };
128 
129  enum shapeType
130  {
134  starcdHex = 11,
136  starcdTet = 13,
137  starcdPyr = 14,
139  };
140 
141 
142 public:
143 
144  // Static data
145 
146  //- Keep solids (default false)
147  static bool keepSolids;
148 
149 
150  // Constructors
151 
152  //- Construct from case name
153  STARCD
154  (
155  const fileName& prefix,
156  const objectRegistry&,
157  const scalar scaleFactor = 1.0
158  );
159 
160  //- Disallow default bitwise copy construction
161  STARCD(const STARCD&) = delete;
162 
163 
164  //- Destructor
165  virtual ~STARCD();
166 
167 
168  // Member Operators
169 
170  //- Disallow default bitwise assignment
171  void operator=(const STARCD&) = delete;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace meshReaders
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Input from file stream.
Definition: IFstream.H:85
The boundaryRegion persistent data saved as a Map<dictionary>.
A class for handling file names.
Definition: fileName.H:82
This class supports creating polyMeshes with baffles.
Definition: meshReader.H:73
Read pro-STAR vrt/cel/bnd files. The protected data in meshReader are filled.
static const int starToFoamFaceAddr[4][6]
Face addressing from pro-STAR faces -> OpenFOAM faces.
STARCD(const fileName &prefix, const objectRegistry &, const scalar scaleFactor=1.0)
Construct from case name.
virtual ~STARCD()
Destructor.
void operator=(const STARCD &)=delete
Disallow default bitwise assignment.
labelList mapToFoamPointId_
Point labels (imported Point numbering not necessarily contiguous)
boundaryRegion boundaryRegion_
Boundary region data.
static bool readHeader(IFstream &, word fileSignature)
Read header.
static bool keepSolids
Keep solids (default false)
virtual bool readGeometry(const scalar scaleFactor=1.0)
Read the mesh from the file(s)
void cullPoints()
Remove unused points.
static const char *const defaultBoundaryName
void readBoundary(const fileName &)
Read boundary (cell/face) definitions.
void readPoints(const fileName &, const scalar scaleFactor)
Read points from file.
cellShapeList cellShapes_
Cell shapes.
virtual void readCells(const fileName &)
Read cell connectivities from file.
static const char *const defaultSolidBoundaryName
labelList mapToFoamCellId_
Cell labels (imported Cell numbering not necessarily contiguous)
static void readToNewline(IFstream &)
Read and discard to newline.
void readAux(const objectRegistry &)
Read auxiliary data from constant/{boundaryRegion,cellTable}.
Registry of regIOobjects.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.