Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::fileFormats::FIRECore
28
29Description
30 Core routines used when reading/writing AVL/FIRE files.
31
32SourceFiles
33 FIRECore.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef FIRECore_H
38#define FIRECore_H
39
40#include "point.H"
41#include "labelList.H"
42#include "pointField.H"
43#include "IOstreams.H"
44#include "Enum.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50// forward declarations
51class polyMesh;
52
53namespace fileFormats
54{
56/*---------------------------------------------------------------------------*\
57 Class fileFormats::FIRECore Declaration
58\*---------------------------------------------------------------------------*/
59
60class FIRECore
61{
62public:
63
64 // Public Data, Declarations
65
66 //- Selection Types
68 {
69 cellSelection = 2,
71 };
72
73 //- Shape-Type for FIRE (FLMA) files
74 enum shapeType
75 {
82 firePrism = 8
83 };
84
85 //- Enumeration defining the file extensions for 3D types
86 enum fileExt3d
94
95 //- Integer type (binary format)
96 typedef int32_t fireInt_t;
97
98 //- Float type (binary format)
99 typedef double fireReal_t;
100
101
102protected:
103
104 // Protected Data
105
107
108
109 // Protected Member Functions
110
111 //- Construct null
112 FIRECore() = default;
113
114
115 //- Read points.
116 // This is the first thing to do when reading FPMA,FPMB,FLMA files.
117 // Return the number of points read.
118 //
119 // The file format is as follows:
120 // \verbatim
121 // NUMBER_OF_VERTICES
122 // x0 y0 z0 x1 y1 z1 ... xN-1 yN-1 zN-1
123 // \endverbatim
124 static label readPoints(ISstream&, pointField&);
125
126public:
127
128 // Public Member Functions
129
130 //- Resolve base file-name for the given file-type
132 (
133 const fileName& baseName,
134 const enum fileExt3d
135 );
136
137
138 //- Get an integer (ascii or binary)
139 static label getFireLabel(ISstream&);
140
141 //- Get an point x/y/z (ascii or binary)
142 static point getFirePoint(ISstream&);
143
144 //- Extract a string (ascii or binary)
145 static std::string getFireString(ISstream&);
146
147
148 //- Write an integer (ascii or binary)
149 static void putFireLabel(OSstream&, const label);
150
151 //- Write multiple integers (ascii or binary)
152 static void putFireLabels(OSstream&, const labelUList&);
153
154 //- Write an on-the-fly list of integers (ascii or binary)
155 static void putFireLabels
156 (
157 OSstream&,
158 const label count,
159 const label start
160 );
161
162
163 //- Write a point x/y/z (ascii or binary)
164 static void putFirePoint(OSstream&, const point&);
165
166 //- Write a string (ascii or binary)
167 static void putFireString(OSstream&, const std::string&);
168
169};
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174} // End namespace fileFormats
175} // End namespace Foam
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
Generic input stream using a standard (STL) stream.
Definition ISstream.H:54
Generic output stream using a standard (STL) stream.
Definition OSstream.H:53
selectionType
Selection Types.
Definition FIRECore.H:65
static const Enum< fileExt3d > file3dExtensions
Definition FIRECore.H:111
static std::string getFireString(ISstream &)
Extract a string (ascii or binary).
Definition FIRECore.C:133
double fireReal_t
Float type (binary format).
Definition FIRECore.H:104
static void putFireLabel(OSstream &, const label)
Write an integer (ascii or binary).
Definition FIRECore.C:199
shapeType
Shape-Type for FIRE (FLMA) files.
Definition FIRECore.H:74
static fileName fireFileName(const fileName &baseName, const enum fileExt3d)
Resolve base file-name for the given file-type.
Definition FIRECore.C:72
static point getFirePoint(ISstream &)
Get an point x/y/z (ascii or binary).
Definition FIRECore.C:103
static void putFireString(OSstream &, const std::string &)
Write a string (ascii or binary).
Definition FIRECore.C:339
fileExt3d
Enumeration defining the file extensions for 3D types.
Definition FIRECore.H:88
static void putFireLabels(OSstream &, const labelUList &)
Write multiple integers (ascii or binary).
Definition FIRECore.C:224
static label readPoints(ISstream &, pointField &)
Read points.
Definition FIRECore.C:41
int32_t fireInt_t
Integer type (binary format).
Definition FIRECore.H:99
FIRECore()=default
Construct null.
static void putFirePoint(OSstream &, const point &)
Write a point x/y/z (ascii or binary).
Definition FIRECore.C:308
static label getFireLabel(ISstream &)
Get an integer (ascii or binary).
Definition FIRECore.C:81
A class for handling file names.
Definition fileName.H:75
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Namespace to isolate specifics for file formats, and some common utilities.
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition point.H:37
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75