]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid dynamic memory allocation when we know that we won't need it. 16405/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 2 Jan 2024 18:24:20 +0000 (11:24 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 2 Jan 2024 18:24:20 +0000 (11:24 -0700)
source/lac/trilinos_sparse_matrix.cc

index 231e9e3f836567f6156029846da8bdf6e3e11391..8da0925382015ec02cb221a2d52d6eb6a18b9c2b 100644 (file)
@@ -1424,9 +1424,9 @@ namespace TrilinosWrappers
     TrilinosWrappers::types::int_type        n_columns;
 
     boost::container::small_vector<TrilinosScalar, 200> local_value_array(
-      n_cols);
+      elide_zero_values ? n_cols : 0);
     boost::container::small_vector<TrilinosWrappers::types::int_type, 200>
-      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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.