diff --git a/src/output/GnuplotWriter.cpp b/src/output/GnuplotWriter.cpp index 436ae7ffa22d7f3aaa20cbd44e2331393958823c..f503c996c3f86a383f2d12fa95185fd1fe205578 100644 --- a/src/output/GnuplotWriter.cpp +++ b/src/output/GnuplotWriter.cpp @@ -102,8 +102,8 @@ GnuplotWriter::_writeCellValue(const CellValue<DataType>& cell_value, CellId cel template <typename DataType, ItemType item_type> void GnuplotWriter::_writeValue(const ItemValue<DataType, item_type>& item_value, - CellId cell_id, - NodeId node_id, + [[maybe_unused]] CellId cell_id, + [[maybe_unused]] NodeId node_id, std::ostream& fout) const { if constexpr (item_type == ItemType::cell) { diff --git a/src/output/WriterBase.cpp b/src/output/WriterBase.cpp index 0359cf7b3d33c8aa9fb33f8b62c671425e5958ba..4a26605cd330301ddf2fc3346c544228c34f4f9b 100644 --- a/src/output/WriterBase.cpp +++ b/src/output/WriterBase.cpp @@ -172,7 +172,7 @@ WriterBase::getLastTime() const } WriterBase::WriterBase(const std::string& base_filename, const double& time_period) - : m_base_filename{base_filename}, m_time_period{time_period} + : m_base_filename{base_filename}, m_time_period{time_period}, m_next_time{0} {} void @@ -183,7 +183,8 @@ WriterBase::writeIfNeeded(const std::vector<std::shared_ptr<const NamedDiscreteF if (time == last_time) return; // output already performed - if (time >= last_time + m_time_period) { + if (time >= m_next_time) { + m_next_time += m_time_period; this->write(named_discrete_function_list, time); m_saved_times.push_back(time); } diff --git a/src/output/WriterBase.hpp b/src/output/WriterBase.hpp index 6e9a08ad123361178327ddb984e5a3da5bdfa909..babdec90733416cf9007e55c9652f2c380d8899d 100644 --- a/src/output/WriterBase.hpp +++ b/src/output/WriterBase.hpp @@ -13,6 +13,7 @@ class WriterBase : public IWriter protected: const std::string m_base_filename; const double m_time_period; + mutable double m_next_time; mutable std::vector<double> m_saved_times;