STARCDCore.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::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 // ************************************************************************* //
Foam::fileFormats::STARCDCore::starcdPyr
@ starcdPyr
Definition: STARCDCore.H:85
Foam::fileFormats::STARCDCore::starcdShellType
@ starcdShellType
Definition: STARCDCore.H:72
Foam::fileFormats::STARCDCore::readPoints
static bool readPoints(IFstream &, pointField &, labelList &ids)
Read points from a (.vrt) file.
Definition: STARCDCore.C:96
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileFormats::STARCDCore::writePoints
static void writePoints(Ostream &, const pointField &)
Write header and points to (.vrt) file.
Definition: STARCDCore.C:138
Foam::IFstream
Input from file stream.
Definition: IFstream.H:81
Foam::fileFormats::STARCDCore::starcdLineType
@ starcdLineType
Definition: STARCDCore.H:73
Foam::fileFormats::STARCDCore::starcdFluidType
@ starcdFluidType
Definition: STARCDCore.H:69
Foam::fileFormats::STARCDCore
Core routines used when reading/writing pro-STAR vrt/cel/bnd files.
Definition: STARCDCore.H:52
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fileFormats::STARCDCore::starcdPoly
@ starcdPoly
Definition: STARCDCore.H:86
IFstream.H
Foam::fileFormats::STARCDCore::starcdPrism
@ starcdPrism
Definition: STARCDCore.H:83
Foam::fileFormats::STARCDCore::cellType
cellType
Definition: STARCDCore.H:67
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fileFormats::STARCDCore::readHeader
static bool readHeader(IFstream &, const word &fileSignature)
Read header.
Definition: STARCDCore.C:41
Foam::fileFormats::STARCDCore::starcdShell
@ starcdShell
Definition: STARCDCore.H:81
Foam::fileFormats::STARCDCore::starcdPoint
@ starcdPoint
Definition: STARCDCore.H:79
pointField.H
Foam::fileFormats::STARCDCore::starcdPointType
@ starcdPointType
Definition: STARCDCore.H:74
Foam::fileFormats::STARCDCore::STARCDCore
STARCDCore()
Construct null.
Definition: STARCDCore.C:34
Foam::fileFormats::STARCDCore::writeHeader
static void writeHeader(Ostream &, const word &fileType)
Write header for fileType (CELL|VERTEX|BOUNDARY)
Definition: STARCDCore.C:75
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::fileFormats::STARCDCore::starcdTet
@ starcdTet
Definition: STARCDCore.H:84
Foam::fileFormats::STARCDCore::starcdSolidType
@ starcdSolidType
Definition: STARCDCore.H:70
Foam::fileFormats::STARCDCore::shapeType
shapeType
Definition: STARCDCore.H:77
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::fileFormats::STARCDCore::starcdLine
@ starcdLine
Definition: STARCDCore.H:80
Foam::fileFormats::STARCDCore::starcdHex
@ starcdHex
Definition: STARCDCore.H:82
Foam::fileFormats::STARCDCore::starcdBaffleType
@ starcdBaffleType
Definition: STARCDCore.H:71