Loading...
Searching...
No Matches
foamVtkSeriesWriterI.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) 2018-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
32 extType_(endingType::SERIES)
33{}
34
35
36// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39{
40 return entries_.empty();
41}
42
44inline Foam::label Foam::vtk::seriesWriter::size() const noexcept
45{
46 return entries_.size();
47}
48
51{
52 return (extType_ == endingType::JSON);
53}
54
55
56inline bool Foam::vtk::seriesWriter::json(bool on) noexcept
58 bool old(extType_ == endingType::JSON);
59 extType_ = (on ? endingType::JSON : endingType::SERIES);
60 return old;
61}
62
63
65{
66 entries_.clear();
67 existing_.clear();
68}
69
70
72{
73 // Strip out path before saving
74 return appendCheck(fileNameInstant(inst.value(), inst.name().name()));
75}
76
77
79{
80 // Strip out path before saving
81 inst.name().remove_path();
82
83 return appendCheck(inst);
84}
85
86
88(
89 scalar timeValue,
90 const fileName& file
92{
93 // Strip out path before saving
94 return appendCheck(fileNameInstant(timeValue, file.name()));
95}
96
97
99(
100 scalar timeValue,
101 fileName&& file
102)
103{
104 // Strip out path before saving
105 file.remove_path();
106
107 return appendCheck(fileNameInstant(timeValue, std::move(file)));
108}
109
110
111inline void Foam::vtk::seriesWriter::print(Ostream& os) const
112{
113 seriesWriter::print(os, entries_);
114}
115
116
117// ************************************************************************* //
scalar value() const noexcept
The value (const access).
Definition Instant.H:139
const T & name() const noexcept
The name/key (const access).
Definition Instant.H:149
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A class for handling file names.
Definition fileName.H:75
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition fileNameI.H:192
bool append(const fileNameInstant &inst)
Append the specified file instant.
bool empty() const noexcept
True if there are no data sets.
bool json() const noexcept
Preferred extension is "json" instead of "series".
label size() const noexcept
The number of data sets.
void clear()
Clear entries.
seriesWriter() noexcept
Construct an empty series (.series ending).
static Ostream & print(Ostream &os, const fileName &seriesName, const UList< instant > &series, const char sep='_')
Print file series (JSON format) for specified time instances.
OBJstream os(runTime.globalPath()/outputName)
Instant< fileName > fileNameInstant
A tuple of value and fileName.
const direction noexcept
Definition scalarImpl.H:265