foamVtkOutputOptionsI.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-2022 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
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29
31:
32 fmtType_(formatType::INLINE_ASCII),
33 precision_(IOstream::defaultPrecision())
34{}
35
36
38(
39 enum vtk::formatType fmtType
40)
41:
42 fmtType_(fmtType),
43 precision_(IOstream::defaultPrecision())
44{}
45
46
48(
49 enum vtk::formatType fmtType,
50 unsigned prec
51)
52:
53 fmtType_(fmtType),
54 precision_(prec)
55{}
56
57
58// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
59
62{
63 return vtk::newFormatter(os, fmtType_, precision_);
64}
65
66
67// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68
70{
71 return fmtType_;
72}
73
74
76{
77 return
78 (
79 legacy()
81 : vtk::fileExtension[contentType]
82 );
83}
84
85
87{
88 return
89 (
90 fmtType_ == formatType::LEGACY_ASCII
91 || fmtType_ == formatType::LEGACY_BINARY
92 );
93}
94
95
97{
98 return !legacy();
99}
100
101
103{
104 return
105 (
106 fmtType_ == formatType::APPEND_BASE64
107 || fmtType_ == formatType::APPEND_BINARY
108 );
109}
110
111
113{
114 return !append();
115}
116
117
119{
120 return !(unsigned(fmtType_) & 0x0F);
121}
122
123
125{
126 return precision_;
127}
128
129
130// ************************************************************************* //
An IOstream is an abstract base class for all input/output systems; be they streams,...
Definition: IOstream.H:82
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
word ext() const
File extension for current format type.
bool insitu() const noexcept
True if output format does not use an append mode.
autoPtr< formatter > newFormatter(std::ostream &os) const
Return new formatter based on the selected output options.
bool legacy() const noexcept
True if writer uses legacy file format.
outputOptions()
Default construct - XML insitu ASCII format with default precision.
bool append() const noexcept
True if output format uses an append mode.
bool xml() const noexcept
True if writer uses XML file format (non-legacy)
vtk::formatType fmt() const noexcept
The output format type.
bool ascii() const noexcept
True if output format is ASCII.
unsigned precision() const noexcept
Return the ASCII write precision.
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
const word fileExtension
Legacy file extension ("vtk")
fileTag
Some common XML tags for vtk files.
Definition: foamVtkCore.H:114
formatType
The output format type for file contents.
Definition: foamVtkCore.H:66
@ APPEND_BASE64
XML append base64, appendBase64Formatter.
@ APPEND_BINARY
XML append raw binary, appendRawFormatter.
@ INLINE_ASCII
XML inline ASCII, asciiFormatter.
@ LEGACY_ASCII
Legacy ASCII, legacyAsciiFormatter.
@ LEGACY_BINARY
Legacy raw binary, legacyRawFormatter.
autoPtr< vtk::formatter > newFormatter(std::ostream &os, unsigned prec=IOstream::defaultPrecision())
Return a default asciiFormatter.
Definition: foamVtkOutput.C:48
const Foam::Enum< fileTag > fileExtension
File extension (without ".") for some vtk XML file content types.
const direction noexcept
Definition: Scalar.H:223