]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add the missing variants of TpetraWrappers::SparseMatrix::set().
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 7 Mar 2024 21:52:10 +0000 (14:52 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 8 Mar 2024 03:37:43 +0000 (20:37 -0700)
include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h

index 1c7a9119706fc069bbe2a81bb801b8f9b13a0366..59914a70cf3f77aa45624a23a6590f435fb02b9b 100644 (file)
@@ -1040,7 +1040,7 @@ namespace LinearAlgebra
 
 
     template <typename Number, typename MemorySpace>
-    inline void
+    void
     SparseMatrix<Number, MemorySpace>::set(
       const std::vector<size_type> &indices,
       const FullMatrix<Number>     &values,
@@ -1060,6 +1060,49 @@ namespace LinearAlgebra
 
 
 
+    template <typename Number, typename MemorySpace>
+    void
+    SparseMatrix<Number, MemorySpace>::set(
+      const std::vector<size_type> &row_indices,
+      const std::vector<size_type> &col_indices,
+      const FullMatrix<Number>     &full_matrix,
+      const bool                    elide_zero_values)
+    {
+      Assert(row_indices.size() == full_matrix.m(),
+             ExcDimensionMismatch(row_indices.size(), full_matrix.m()));
+      Assert(col_indices.size() == full_matrix.n(),
+             ExcDimensionMismatch(col_indices.size(), full_matrix.n()));
+
+      for (size_type i = 0; i < row_indices.size(); ++i)
+        set(row_indices[i],
+            col_indices.size(),
+            col_indices.data(),
+            &full_matrix(i, 0),
+            elide_zero_values);
+    }
+
+
+
+    template <typename Number, typename MemorySpace>
+    void
+    SparseMatrix<Number, MemorySpace>::set(
+      const size_type               row,
+      const std::vector<size_type> &col_indices,
+      const std::vector<Number>    &values,
+      const bool                    elide_zero_values)
+    {
+      Assert(col_indices.size() == values.size(),
+             ExcDimensionMismatch(col_indices.size(), values.size()));
+
+      set(row,
+          col_indices.size(),
+          col_indices.data(),
+          &values[0],
+          elide_zero_values);
+    }
+
+
+
     template <typename Number, typename MemorySpace>
     void
     SparseMatrix<Number, MemorySpace>::add(

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.