Commit 13ce7b24 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

cleanup pvdwriter interface

parent 6d5cc076
......@@ -29,7 +29,7 @@ namespace Dune
}
/// Write the attached data to the file
void write (double time, std::string const& fn) const;
void writeTimestep (double time, std::string const& fn) const;
/// Attach point data to the writer, \see VtkFunction for possible arguments
template <class Function, class... Args>
......
......@@ -9,7 +9,7 @@ namespace Dune {
template <class W>
void PvdWriter<W>
::write (double time, std::string const& fn) const
::writeTimestep (double time, std::string const& fn) const
{
auto p = filesystem::path(fn);
auto name = p.stem();
......
......@@ -53,7 +53,7 @@ namespace Dune
}
/// Write the attached data to the file with \ref Vtk::FormatTypes and \ref Vtk::DataTypes
void writeTimestep (double time, std::string const& fn);
void writeTimestep (double time, std::string const& fn) const;
/// Writes all timesteps to single timeseries file.
// NOTE: requires an aforging call to \ref writeTimestep
......@@ -79,10 +79,10 @@ namespace Dune
VtkWriter vtkWriter_;
filesystem::path tmpDir_;
bool initialized_ = false;
mutable bool initialized_ = false;
// block size of attached data
std::vector<std::uint64_t> blocks_;
mutable std::vector<std::uint64_t> blocks_;
mutable std::string filenameMesh_;
mutable std::vector<std::pair<double, std::string>> timesteps_;
......
......@@ -118,6 +118,7 @@ void VtkTimeseriesWriter<W>
assert(ec == 0);
}
timesteps_.clear();
initialized_ = false;
}
} // end namespace Dune
......@@ -44,7 +44,7 @@ void write (std::string prefix, GridView const& gridView)
pvdWriter.addPointData(p1Analytic, "p1");
pvdWriter.addCellData(p1Analytic, "p0");
for (double t = 0.0; t < 10.0; t += 1.0) {
pvdWriter.write(t, prefix + "_" + std::to_string(GridView::dimensionworld) + "d_ascii.vtu");
pvdWriter.writeTimestep(t, prefix + "_" + std::to_string(GridView::dimensionworld) + "d_ascii.vtu");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment