FIRECore.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fileFormats::FIRECore
28 
29 Description
30  Core routines used when reading/writing AVL/FIRE files.
31 
32 SourceFiles
33  FIRECore.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef FIRECore_H
38 #define FIRECore_H
39 
40 #include "point.H"
41 #include "string.H"
42 #include "labelList.H"
43 #include "pointField.H"
44 #include "IOstreams.H"
45 #include "Enum.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 // forward declarations
52 class polyMesh;
53 
54 namespace fileFormats
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class fileFormats::FIRECore Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class FIRECore
62 {
63 public:
64 
65  // Public Data, Declarations
66 
67  //- Selection Types
68  enum selectionType
69  {
71  faceSelection = 3
72  };
73 
74  //- Shape-Type for FIRE (FLMA) files
75  enum shapeType
76  {
77  fireLine = 1,
78  fireTri = 2,
79  fireQuad = 3,
80  fireTet = 4,
81  fireHex = 5,
82  firePyr = 6,
83  firePrism = 8
84  };
85 
86  //- Enumeration defining the file extensions for 3D types
87  enum fileExt3d
88  {
93  };
94 
95 
96  //- Integer type (binary format)
97  typedef int32_t fireInt_t;
98 
99  //- Float type (binary format)
100  typedef double fireReal_t;
101 
102 
103 protected:
104 
105  // Protected Data
106 
107  static const Enum<fileExt3d> file3dExtensions;
108 
109 
110  // Protected Member Functions
111 
112  //- Construct null
113  FIRECore() = default;
114 
115 
116  //- Read points.
117  // This is the first thing to do when reading FPMA,FPMB,FLMA files.
118  // Return the number of points read.
119  //
120  // The file format is as follows:
121  // \verbatim
122  // NUMBER_OF_VERTICES
123  // x0 y0 z0 x1 y1 z1 ... xN-1 yN-1 zN-1
124  // \endverbatim
125  static label readPoints(ISstream&, pointField&);
126 
127 public:
128 
129  // Public Member Functions
130 
131  //- Resolve base file-name for the given file-type
132  static fileName fireFileName
133  (
134  const fileName& baseName,
135  const enum fileExt3d
136  );
137 
138 
139  //- Get an integer (ascii or binary)
140  static label getFireLabel(ISstream&);
141 
142  //- Get an point x/y/z (ascii or binary)
143  static point getFirePoint(ISstream&);
144 
145  //- Extract a string (ascii or binary)
146  static std::string getFireString(ISstream&);
147 
148 
149  //- Write an integer (ascii or binary)
150  static void putFireLabel(OSstream&, const label);
151 
152  //- Write multiple integers (ascii or binary)
153  static void putFireLabels(OSstream&, const labelUList&);
154 
155  //- Write an on-the-fly list of integers (ascii or binary)
156  static void putFireLabels
157  (
158  OSstream&,
159  const label count,
160  const label start
161  );
162 
163 
164  //- Write a point x/y/z (ascii or binary)
165  static void putFirePoint(OSstream&, const point&);
166 
167  //- Write a string (ascii or binary)
168  static void putFireString(OSstream&, const std::string&);
169 
170 };
171 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 } // End namespace fileFormats
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
Foam::fileFormats::FIRECore::selectionType
selectionType
Selection Types.
Definition: FIRECore.H:67
Foam::Enum< fileExt3d >
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::fileFormats::FIRECore::fireFileName
static fileName fireFileName(const fileName &baseName, const enum fileExt3d)
Resolve base file-name for the given file-type.
Definition: FIRECore.C:79
point.H
Foam::fileFormats::FIRECore::POLY_BINARY
Definition: FIRECore.H:89
Foam::fileFormats::FIRECore::putFirePoint
static void putFirePoint(OSstream &, const point &)
Write a point x/y/z (ascii or binary)
Definition: FIRECore.C:305
Foam::fileFormats::FIRECore::cellSelection
Definition: FIRECore.H:69
Foam::fileFormats::FIRECore::fireTri
Definition: FIRECore.H:77
Foam::ISstream
Generic input stream using a standard (STL) stream.
Definition: ISstream.H:55
string.H
Foam::fileFormats::FIRECore::fireQuad
Definition: FIRECore.H:78
Foam::faceSelection
Face selection method for createBaffles.
Definition: faceSelection.H:58
Foam::fileFormats::FIRECore::fireHex
Definition: FIRECore.H:80
Foam::fileFormats::FIRECore::POLY_BINARY_Z
Definition: FIRECore.H:91
labelList.H
Foam::Field< vector >
Foam::fileFormats::FIRECore::FIRECore
FIRECore()=default
Construct null.
Foam::OSstream
Generic output stream using a standard (STL) stream.
Definition: OSstream.H:54
Foam::fileFormats::FIRECore::getFireString
static std::string getFireString(ISstream &)
Extract a string (ascii or binary)
Definition: FIRECore.C:138
Foam::fileFormats::FIRECore::getFirePoint
static point getFirePoint(ISstream &)
Get an point x/y/z (ascii or binary)
Definition: FIRECore.C:109
Foam::fileFormats::FIRECore::fireLine
Definition: FIRECore.H:76
Foam::fileFormats::FIRECore::putFireString
static void putFireString(OSstream &, const std::string &)
Write a string (ascii or binary)
Definition: FIRECore.C:334
Foam::fileFormats::FIRECore::firePrism
Definition: FIRECore.H:82
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileFormats::FIRECore::fireInt_t
int32_t fireInt_t
Integer type (binary format)
Definition: FIRECore.H:96
pointField.H
Foam::fileFormats::FIRECore::POLY_ASCII
Definition: FIRECore.H:88
Foam::fileFormats::FIRECore::putFireLabels
static void putFireLabels(OSstream &, const labelUList &)
Write multiple integers (ascii or binary)
Definition: FIRECore.C:225
Foam::fileFormats::FIRECore::fireTet
Definition: FIRECore.H:79
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition: BitOps.H:77
Foam::Vector< scalar >
Foam::fileFormats::FIRECore::firePyr
Definition: FIRECore.H:81
Foam::fileFormats::FIRECore::fileExt3d
fileExt3d
Enumeration defining the file extensions for 3D types.
Definition: FIRECore.H:86
Foam::UList< label >
Foam::fileFormats::FIRECore::shapeType
shapeType
Shape-Type for FIRE (FLMA) files.
Definition: FIRECore.H:74
Foam::fileFormats::FIRECore
Core routines used when reading/writing AVL/FIRE files.
Definition: FIRECore.H:60
Foam::fileFormats::FIRECore::fireReal_t
double fireReal_t
Float type (binary format)
Definition: FIRECore.H:99
Foam::fileFormats::FIRECore::getFireLabel
static label getFireLabel(ISstream &)
Get an integer (ascii or binary)
Definition: FIRECore.C:88
Foam::fileFormats::FIRECore::POLY_ASCII_Z
Definition: FIRECore.H:90
Foam::fileFormats::FIRECore::file3dExtensions
static const Enum< fileExt3d > file3dExtensions
Definition: FIRECore.H:106
Foam::fileFormats::FIRECore::putFireLabel
static void putFireLabel(OSstream &, const label)
Write an integer (ascii or binary)
Definition: FIRECore.C:202
Foam::fileFormats::FIRECore::readPoints
static label readPoints(ISstream &, pointField &)
Read points.
Definition: FIRECore.C:48
Enum.H