Loading...
Searching...
No Matches
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-2024 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// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33
35(
37 const fileName& pathname,
39)
40:
41 ensightFile(append, pathname, fmt)
42{
44 {
45 writeBinaryHeader(); // Mandatory for geometry files
46 }
47}
48
49
51(
53 const fileName& path,
54 const fileName& name,
56)
57:
58 ensightFile(append, path, name, fmt)
59{
61 {
62 writeBinaryHeader(); // Mandatory for geometry files
63 }
64}
65
66
67// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
68
70{
71 writeString(key);
72 newline();
73
74 return *this;
76
77
78//
79// Convenience Output Methods
80//
81
83{
84 // Description line 1
85 writeString("Ensight Geometry File");
86 newline();
87
88 // Description line 2
89 writeString("Written by OpenFOAM " + std::to_string(foamVersion::api));
90 newline();
91
92 writeString("node id assign");
93 newline();
94
95 writeString("element id assign");
96 newline();
97}
98
99
100// ************************************************************************* //
streamFormat
Data format (ascii | binary | coherent).
appendType
File appending (NO_APPEND | APPEND_APP | APPEND_ATE).
bool is_appending() const noexcept
True if opened in append mode and file already existed.
Definition OFstream.H:191
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
void writeString(const char *str, size_t len)
Write character/string content as "%79s" or as binary (max 80 chars).
void writeBinaryHeader()
Write "C Binary" string for binary files (eg, geometry/measured).
void newline()
Add carriage return to ascii stream.
virtual Ostream & writeKeyword(const keyType &key) override
Write keyword with trailing newline.
void beginGeometry()
Start of geometry information.
ensightGeoFile(const ensightGeoFile &)=delete
No copy construct.
A class for handling file names.
Definition fileName.H:75
A class for handling keywords in dictionaries.
Definition keyType.H:69
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
auto & name
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127