From 75b36e5e4d5aca925037d4a001b66326075c5bed Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 Jan 2024 11:24:20 -0700 Subject: [PATCH] Avoid dynamic memory allocation when we know that we won't need it. --- source/lac/trilinos_sparse_matrix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 231e9e3f83..8da0925382 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -1424,9 +1424,9 @@ namespace TrilinosWrappers TrilinosWrappers::types::int_type n_columns; boost::container::small_vector local_value_array( - n_cols); + elide_zero_values ? n_cols : 0); boost::container::small_vector - local_index_array(n_cols); + local_index_array(elide_zero_values ? n_cols : 0); // If we don't elide zeros, the pointers are already available... need to // cast to non-const pointers as that is the format taken by Trilinos (but -- 2.39.5