ensightGeoFile.C
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 OpenFOAM Foundation
9 Copyright (C) 2016-2022 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
27\*---------------------------------------------------------------------------*/
28
29#include "ensightGeoFile.H"
30#include "foamVersion.H"
31
32// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33
34void Foam::ensightGeoFile::initialize()
35{
37
38 // Description line 1
39 write("Ensight Geometry File");
40 newline();
41
42 // Description line 2
43 write(string("Written by OpenFOAM " + std::to_string(foamVersion::api)));
44 newline();
45
46 write("node id assign");
47 newline();
48
49 write("element id assign");
50 newline();
51}
52
53
54// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55
57(
58 const fileName& pathname,
60)
61:
62 ensightFile(pathname, format)
63{
64 initialize();
65}
66
67
69(
70 const fileName& path,
71 const fileName& name,
73)
74:
76{
77 initialize();
78}
79
80
81// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82
84{
85 writeString(key);
86 newline();
87
88 return *this;
89}
90
91
92//
93// Convenience Output Methods
94//
95
97(
98 const label index,
99 const string& description
100)
101{
102 beginPart(index);
103 writeString(description);
104 newline();
105}
106
107
109{
110 writeString(ensightFile::coordinates);
111 newline();
112
113 write(npoints);
114 newline();
115}
116
117
118// ************************************************************************* //
streamFormat
Data format (ascii | binary)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ensight output with specialized write() for strings, integers and floats. Correctly handles binary wr...
Definition: ensightFile.H:55
Ostream & writeBinaryHeader()
Write "C Binary" string for binary files (eg, geometry/measured)
Definition: ensightFile.C:339
static const char *const coordinates
The keyword "coordinates".
Definition: ensightFile.H:88
void newline()
Add carriage return to ascii stream.
Definition: ensightFile.C:304
Specialized Ensight output with extra geometry file header.
virtual Ostream & writeKeyword(const keyType &key)
Write keyword with trailing newline.
void beginCoordinates(const label npoints)
Begin a "coordinates" block.
void beginPart(const label index, const string &description)
Begin a "part" (0-based index), with a description.
A class for handling file names.
Definition: fileName.H:76
A class for handling keywords in dictionaries.
Definition: keyType.H:71
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
runTime write()
word format(conversionProperties.get< word >("format"))