AC3DsurfaceFormatCore.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fileFormats::AC3DsurfaceFormatCore
29
30Description
31 Internal class used by the AC3DsurfaceFormat
32
33SourceFiles
34 AC3DsurfaceFormatCore.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef AC3DsurfaceFormatCore_H
39#define AC3DsurfaceFormatCore_H
40
41#include "Fstream.H"
42#include "surfZone.H"
43#include "StringStream.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49namespace fileFormats
50{
51
52/*---------------------------------------------------------------------------*\
53 Class fileFormats::AC3DsurfaceFormatCore Declaration
54\*---------------------------------------------------------------------------*/
57{
58protected:
59
60 // Protected Static Member Functions
61
62 //- Read a type from string
63 template<class Type>
64 static Type parse(const string& str)
65 {
66 IStringStream is(str);
67
68 Type t;
69 is >> t;
70
71 return t;
72 }
73
74 //- Read cmd, args from IFstream
75 // The cmd is the content up to the first space, args is the balance
76 // of the line (after the space).
77 // \return if the command was read
78 static bool readCmd(IFstream& is, string& cmd, string& args);
79
80 //- Read up to a line starting with cmd. Sets args to rest of line.
81 //
82 // \return true if found, false if stream is not good anymore.
83 static bool cueTo(IFstream&, const string& cmd, string& args);
84
85 //- Like cueTo(), but FatalError if not found.
86 // \return the command args on success
87 static string cueToOrDie
88 (
89 IFstream&,
90 const string& cmd,
91 const string& errorMsg=string::null
92 );
93
94 //- Write header with materials for each zone
95 static void writeHeader(Ostream& os, const UList<surfZone>& zones);
96};
97
98
99// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
101} // End namespace fileFormats
102} // End namespace Foam
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106#endif
107
108// ************************************************************************* //
Input/output from string buffers.
Input from file stream, using an ISstream.
Definition: IFstream.H:57
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:112
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
Internal class used by the AC3DsurfaceFormat.
static Type parse(const string &str)
Read a type from string.
static string cueToOrDie(IFstream &, const string &cmd, const string &errorMsg=string::null)
Like cueTo(), but FatalError if not found.
static void writeHeader(Ostream &os, const UList< surfZone > &zones)
Write header with materials for each zone.
static bool cueTo(IFstream &, const string &cmd, string &args)
Read up to a line starting with cmd. Sets args to rest of line.
static bool readCmd(IFstream &is, string &cmd, string &args)
Read cmd, args from IFstream.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Foam::argList args(argc, argv)