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-2019 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().removePath();
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.removePath();
84 
85  return appendCheck(fileNameInstant(timeValue, std::move(file)));
86 }
87 
88 
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 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::fileName::name
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:199
Foam::vtk::seriesWriter::print
static Ostream & print(Ostream &os, const fileName &seriesName, const UList< instant > &series, const char sep='_')
Print file series (JSON format) for specified time instances.
Definition: foamVtkSeriesWriter.C:151
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fileNameInstant
Instant< fileName > fileNameInstant
A tuple of value and fileName.
Definition: fileNameInstant.H:44
Foam::vtk::seriesWriter::write
static void write(const fileName &base, const UList< instant > &series, const char sep='_')
Write file series (JSON format) to disk, for specified instances.
Definition: foamVtkSeriesWriter.C:233
Foam::Instant::name
const T & name() const
The name/key (const access)
Definition: Instant.H:111
Foam::vtk::seriesWriter::size
label size() const noexcept
The number of data sets.
Definition: foamVtkSeriesWriterI.H:36
Foam::vtk::seriesWriter::empty
bool empty() const noexcept
True if there are no data sets.
Definition: foamVtkSeriesWriterI.H:30
Foam::Instant::value
scalar value() const
The value (const access)
Definition: Instant.H:99
Foam::vtk::seriesWriter::clear
void clear()
Clear entries.
Definition: foamVtkSeriesWriterI.H:42
Foam::vtk::seriesWriter::append
bool append(const fileNameInstant &inst)
Append the specified file instant.
Definition: foamVtkSeriesWriterI.H:49
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::Instant
A tuple of value and key. The value often corresponds to a time value, thus the naming of the class....
Definition: Instant.H:53
Foam::fileName::removePath
bool removePath()
Remove leading path, returning true if string changed.
Definition: fileNameI.H:243