]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Augment assertions in TrilinosWrappers::*::SparseMatrix::add(). 16766/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 20 Mar 2024 17:31:14 +0000 (11:31 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 20 Mar 2024 17:32:55 +0000 (11:32 -0600)
include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h
source/lac/trilinos_sparse_matrix.cc

index 59914a70cf3f77aa45624a23a6590f435fb02b9b..8d1e237a1eae26cc996095895b3e3c92edddd14e 100644 (file)
@@ -1114,6 +1114,8 @@ namespace LinearAlgebra
       const bool /*col_indices_are_sorted*/)
     {
       AssertIndexRange(row, this->m());
+      for (size_t n = 0; n < n_cols; ++n)
+        AssertIndexRange(col_indices[n], this->n());
 
       // If the matrix is marked as compressed, we need to
       // call resumeFill() first.
@@ -1145,7 +1147,6 @@ namespace LinearAlgebra
               if (values[i] != 0)
                 {
                   AssertIsFinite(values[i]);
-                  AssertIndexRange(col_indices[i], n());
                   AssertIndexRange(n_columns, n_zero_entries);
                   col_indices_array[n_columns] = col_indices[i];
                   values_array[n_columns]      = values[i];
@@ -1157,7 +1158,6 @@ namespace LinearAlgebra
         for (size_t i = 0; i < n_cols; ++i)
           {
             AssertIsFinite(values[i]);
-            AssertIndexRange(col_indices[i], n());
             col_indices_array[i] = col_indices[i];
             values_array[i]      = values[i];
           }
index 6341c867f2ec0ec9e2476de0b7281de752ec9650..1902bcf489f25a73cd80279c71433783b72b84d8 100644 (file)
@@ -1599,6 +1599,9 @@ namespace TrilinosWrappers
                     const bool /*col_indices_are_sorted*/)
   {
     AssertIndexRange(row, this->m());
+    for (size_type n = 0; n < n_cols; ++n)
+      AssertIndexRange(col_indices[n], this->n());
+
     int ierr;
     if (last_action == Insert)
       {

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.