From: Niklas Fehn Date: Fri, 18 Oct 2019 12:44:50 +0000 (+0200) Subject: use Utilities::needed_digits() in write_vtu_with_pvtu_record() X-Git-Tag: v9.2.0-rc1~967^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c42033eb0a62e5bf6330a2249051b356d671bd0f;p=dealii.git use Utilities::needed_digits() in write_vtu_with_pvtu_record() --- 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 =