STARCDCore.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-2018 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::fileFormats::STARCDCore
26 
27 Description
28  Core routines used when reading/writing pro-STAR vrt/cel/bnd files.
29 
30 SourceFiles
31  STARCDCore.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef STARCDCore_H
36 #define STARCDCore_H
37 
38 #include "IFstream.H"
39 #include "pointField.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 namespace fileFormats
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class fileFormats::STARCDCore Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class STARCDCore
54 {
55 protected:
56 
57  // Protected Member Functions
58 
59  //- Read header
60  static bool readHeader(IFstream&, const word& fileSignature);
61 
62  //- Write header for fileType (CELL|VERTEX|BOUNDARY)
63  static void writeHeader(Ostream&, const word& fileType);
64 
65 
66 protected:
67 
68  enum cellType
69  {
75  starcdPointType = 6
76  };
77 
78  enum shapeType
79  {
83  starcdHex = 11,
85  starcdTet = 13,
86  starcdPyr = 14,
87  starcdPoly = 255
88  };
89 
90 
91 public:
92 
93  // Public Member Functions
94 
95  //- Read points from a (.vrt) file
96  // The file format is as follows:
97  // \verbatim
98  // Line 1:
99  // PROSTAR_VERTEX newline
100  //
101  // Line 2:
102  // {version} 0 0 0 0 0 0 0 newline
103  //
104  // Body:
105  // {vertexId} {x} {y} {z} newline
106  // \endverbatim
107  static bool readPoints(IFstream&, pointField&, labelList& ids);
108 
109  //- Write header and points to (.vrt) file
110  static void writePoints(Ostream&, const pointField&);
111 
112 
113  // Constructors
114 
115  //- Construct null
116  STARCDCore();
117 
118 };
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 } // End namespace fileFormats
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
static void writeHeader(Ostream &, const word &fileType)
Write header for fileType (CELL|VERTEX|BOUNDARY)
Definition: STARCDCore.C:75
static bool readHeader(IFstream &, const word &fileSignature)
Read header.
Definition: STARCDCore.C:41
STARCDCore()
Construct null.
Definition: STARCDCore.C:34
static void writePoints(Ostream &, const pointField &)
Write header and points to (.vrt) file.
Definition: STARCDCore.C:138
A class for handling words, derived from string.
Definition: word.H:59
Core routines used when reading/writing pro-STAR vrt/cel/bnd files.
Definition: STARCDCore.H:52
fileType
Enumeration of file types.
Definition: fileName.H:66
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Input from file stream.
Definition: IFstream.H:81
static bool readPoints(IFstream &, pointField &, labelList &ids)
Read points from a (.vrt) file.
Definition: STARCDCore.C:96
Namespace for OpenFOAM.