From bf7a7232748f9071047c39840ff2c7d06fa57402 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 7 Mar 2024 14:52:10 -0700 Subject: [PATCH] Add the missing variants of TpetraWrappers::SparseMatrix::set(). --- .../trilinos_tpetra_sparse_matrix.templates.h | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) 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( -- 2.39.5