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 -------------------------------------------------------------------------------
11 License
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;
75 }
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 // ************************************************************************* //
A variant of OFstream with specialised handling for Ensight writing of strings, integers and floats (...
Definition: ensightFile.H:47
void writeBinaryHeader()
Write "C Binary" string for binary files (eg, geometry/measured)
Definition: ensightFile.C:437
bool is_appending() const noexcept
True if opened in append mode and file already existed.
Definition: OFstream.H:191
A class for handling file names.
Definition: fileName.H:72
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
void beginGeometry()
Start of geometry information.
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual Ostream & writeKeyword(const keyType &key) override
Write keyword with trailing newline.
appendType
File appending (NO_APPEND | APPEND_APP | APPEND_ATE)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:103
streamFormat
Data format (ascii | binary)
ensightGeoFile(const ensightGeoFile &)=delete
No copy construct.