From c42033eb0a62e5bf6330a2249051b356d671bd0f Mon Sep 17 00:00:00 2001 From: Niklas Fehn Date: Fri, 18 Oct 2019 14:44:50 +0200 Subject: [PATCH] use Utilities::needed_digits() in write_vtu_with_pvtu_record() --- source/base/data_out_base.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index af277a330e..666acafb9c 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7560,8 +7560,11 @@ DataOutInterface::write_vtu_with_pvtu_record( const unsigned int n_files_written = (n_groups == 0 || n_groups > n_ranks) ? n_ranks : n_groups; + AssertThrow(n_files_written >= 1, ExcMessage("Logical error.")); + // the "-1" is needed since we use C++ style counting starting with 0, so + // writing 10 files means the filename runs from 0 to 9 const unsigned int n_digits = - static_cast(std::ceil(std::log10(std::fabs(n_files_written)))); + Utilities::needed_digits(std::max(0, int(n_files_written) - 1)); const unsigned int color = rank % n_files_written; const std::string filename = -- 2.39.5