Loading...
Searching...
No Matches
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-2025 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(
41:
42 fmtType_(fmtType),
43 precision_(IOstream::defaultPrecision())
44{}
45
46
48(
50 unsigned prec
52:
53 fmtType_(fmtType),
54 precision_(prec)
55{}
56
57
58// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
59
63 return vtk::newFormatter(os, fmtType_, precision_);
64}
65
66
67// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68
70{
71 return fmtType_;
72}
73
74
75inline const Foam::word&
77{
78 return
79 (
84}
85
88{
89 return (fmtType_ == formatType::HDF_FORMAT);
90}
91
92
94{
95 return
96 (
97 fmtType_ == formatType::LEGACY_ASCII
98 || fmtType_ == formatType::LEGACY_BINARY
99 );
100}
101
103inline bool Foam::vtk::outputOptions::xml() const noexcept
104{
105 return (!legacy() && !is_hdf());
106}
107
108
110{
111 return
113 fmtType_ == formatType::APPEND_BASE64
114 || fmtType_ == formatType::APPEND_BINARY
115 );
116}
117
120{
121 return !append();
122}
123
126{
127 return !(unsigned(fmtType_) & 0x0F);
128}
129
130
131inline unsigned Foam::vtk::outputOptions::precision() const noexcept
132{
133 return precision_;
134}
135
136
137// ************************************************************************* //
An IOstream is an abstract base class for all input/output systems; be they streams,...
Definition IOstream.H:85
static unsigned int defaultPrecision() noexcept
Return the default precision.
Definition IOstream.H:437
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
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 is_hdf() const noexcept
True if HDF file format was requested [ADVANCED USAGE].
bool legacy() const noexcept
True if writer uses legacy file format.
outputOptions() noexcept
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.
const word & ext(vtk::fileTag contentType) const
The file extension (legacy or xml) for the given content-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:66
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").
autoPtr< vtk::formatter > newFormatter(std::ostream &os, unsigned prec=IOstream::defaultPrecision())
Return a default asciiFormatter.
fileTag
Some common XML tags for vtk files.
formatType
The output format type for file contents.
Definition foamVtkCore.H:89
@ APPEND_BASE64
XML append base64, appendBase64Formatter.
Definition foamVtkCore.H:92
@ APPEND_BINARY
XML append raw binary, appendRawFormatter.
Definition foamVtkCore.H:93
@ LEGACY_ASCII
Legacy ASCII, legacyAsciiFormatter.
Definition foamVtkCore.H:94
@ LEGACY_BINARY
Legacy raw binary, legacyRawFormatter.
Definition foamVtkCore.H:95
@ HDF_FORMAT
VTKHDF format.
Definition foamVtkCore.H:96
const Foam::Enum< fileTag > fileExtension
File extension (without ".") for some vtk XML file content types.
const direction noexcept
Definition scalarImpl.H:265