From: Wolfgang Bangerth Date: Thu, 7 Mar 2024 21:52:10 +0000 (-0700) Subject: Add the missing variants of TpetraWrappers::SparseMatrix::set(). X-Git-Tag: v9.6.0-rc1~494^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf7a7232748f9071047c39840ff2c7d06fa57402;p=dealii.git Add the missing variants of TpetraWrappers::SparseMatrix::set(). --- diff --git a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h index 1c7a911970..59914a70cf 100644 --- a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h @@ -1040,7 +1040,7 @@ namespace LinearAlgebra template - inline void + void SparseMatrix::set( const std::vector &indices, const FullMatrix &values, @@ -1060,6 +1060,49 @@ namespace LinearAlgebra + template + void + SparseMatrix::set( + const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &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 + void + SparseMatrix::set( + const size_type row, + const std::vector &col_indices, + const std::vector &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 void SparseMatrix::add(