From: Martin Kronbichler Date: Fri, 15 Mar 2024 09:02:57 +0000 (+0100) Subject: dealii::Vector: Simplify reset of vector size X-Git-Tag: v9.6.0-rc1~481^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e36b25987bced5349d99c464c1d39ed3c1e0f280;p=dealii.git dealii::Vector: Simplify reset of vector size --- diff --git a/include/deal.II/lac/vector.templates.h b/include/deal.II/lac/vector.templates.h index c46c3b6cc0..21707800d5 100644 --- a/include/deal.II/lac/vector.templates.h +++ b/include/deal.II/lac/vector.templates.h @@ -1092,27 +1092,15 @@ Vector::do_reinit(const size_type new_size, const bool omit_zeroing_entries, const bool reset_partitioner) { - if (new_size <= size()) + if (new_size == 0) { - if (new_size == 0) - { - values.clear(); - } - else - { - values.resize_fast(new_size); - if (!omit_zeroing_entries) - values.fill(); - } + values.clear(); } else { - // otherwise size() < new_size and we must allocate - AlignedVector new_values; - new_values.resize_fast(new_size); + values.resize_fast(new_size); if (!omit_zeroing_entries) - new_values.fill(); - new_values.swap(values); + values.fill(); } if (reset_partitioner)