diff --git a/dune/vtk/pvdwriter.hh b/dune/vtk/pvdwriter.hh index a752176e7dcab82580d7a7003ad8a5c0021f83c7..c5345b44ff3c08264efff1b9f0c1275dbda2cf24 100644 --- a/dune/vtk/pvdwriter.hh +++ b/dune/vtk/pvdwriter.hh @@ -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> diff --git a/dune/vtk/pvdwriter.impl.hh b/dune/vtk/pvdwriter.impl.hh index fd43b803343be5ed3e213d1e3e63d31ef9b22e0e..669a894da8c0c6a6c11a46276a495db01c6b95b7 100644 --- a/dune/vtk/pvdwriter.impl.hh +++ b/dune/vtk/pvdwriter.impl.hh @@ -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(); diff --git a/dune/vtk/vtktimeserieswriter.hh b/dune/vtk/vtktimeserieswriter.hh index da15804ba374c1126dd32f5be37fada05f3074d4..13e8507c0dccdda3a50ce064876afdf253f89cb2 100644 --- a/dune/vtk/vtktimeserieswriter.hh +++ b/dune/vtk/vtktimeserieswriter.hh @@ -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_; diff --git a/dune/vtk/vtktimeserieswriter.impl.hh b/dune/vtk/vtktimeserieswriter.impl.hh index 3b886ec0de9ec079ff2a3d832376db8ba9aae41a..4e53490c9d495ab167556dd032b19008e6b1d0e4 100644 --- a/dune/vtk/vtktimeserieswriter.impl.hh +++ b/dune/vtk/vtktimeserieswriter.impl.hh @@ -118,6 +118,7 @@ void VtkTimeseriesWriter<W> assert(ec == 0); } timesteps_.clear(); + initialized_ = false; } } // end namespace Dune diff --git a/src/pvdwriter.cc b/src/pvdwriter.cc index 7d35be694b7677a24e00ea680763eb82e4353a37..2c466ed138bf1578077139e5e0c37a51c26337ae 100644 --- a/src/pvdwriter.cc +++ b/src/pvdwriter.cc @@ -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"); } }