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-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
30 inline bool Foam::vtk::seriesWriter::empty() const noexcept
31 {
32  return entries_.empty();
33 }
34 
35 
36 inline Foam::label Foam::vtk::seriesWriter::size() const noexcept
37 {
38  return entries_.size();
39 }
40 
41 
43 {
44  entries_.clear();
45  existing_.clear();
46 }
47 
48 
50 {
51  // Strip out path before saving
52  return appendCheck(fileNameInstant(inst.value(), inst.name().name()));
53 }
54 
55 
57 {
58  // Strip out path before saving
59  inst.name().remove_path();
60 
61  return appendCheck(inst);
62 }
63 
64 
66 (
67  scalar timeValue,
68  const fileName& file
69 )
70 {
71  // Strip out path before saving
72  return appendCheck(fileNameInstant(timeValue, file.name()));
73 }
74 
75 
77 (
78  scalar timeValue,
79  fileName&& file
80 )
81 {
82  // Strip out path before saving
83  file.remove_path();
84 
85  return appendCheck(fileNameInstant(timeValue, std::move(file)));
86 }
87 
88 
89 inline void Foam::vtk::seriesWriter::print(Ostream& os) const
90 {
91  seriesWriter::print(os, entries_);
92 }
93 
94 
95 inline void Foam::vtk::seriesWriter::write(const fileName& seriesName) const
96 {
97  seriesWriter::write(seriesName, entries_);
98 }
99 
100 
101 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:72
label size() const noexcept
The number of data sets.
bool remove_path()
Remove leading path, return true if string changed.
Definition: stringI.H:79
scalar value() const noexcept
The value (const access)
Definition: Instant.H:134
void clear()
Clear entries.
const T & name() const noexcept
The name/key (const access)
Definition: Instant.H:144
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:192
OBJstream os(runTime.globalPath()/outputName)
bool empty() const noexcept
True if there are no data sets.
static Ostream & print(Ostream &os, const fileName &seriesName, const UList< instant > &series, const char sep='_')
Print file series (JSON format) for specified time instances.
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
A tuple of scalar value and key. The value often corresponds to a time value, thus the naming of the ...
Definition: Instant.H:45
Instant< fileName > fileNameInstant
A tuple of value and fileName.
bool append(const fileNameInstant &inst)
Append the specified file instant.