From: Daniel Arndt Date: Tue, 20 Feb 2024 14:29:16 +0000 (-0500) Subject: Let clear_rows take an ArrayView argument X-Git-Tag: relicensing~14^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7097570e229fe0247d9dc3c2f203db50a8280c1e;p=dealii.git Let clear_rows take an ArrayView argument --- diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index dd5a750ec1..eaf5e17c15 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -577,8 +577,8 @@ namespace PETScWrappers * the diagonal entries, you have to set them by hand. */ void - clear_rows(const std::vector &rows, - const PetscScalar new_diag_value = 0); + clear_rows(const ArrayView &rows, + const PetscScalar new_diag_value = 0); /** * Same as clear_rows(), except that the function also zeros the columns. diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 8bcda46bb1..487340f56e 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -1344,8 +1344,8 @@ namespace TrilinosWrappers * starting to clear rows. */ void - clear_rows(const std::vector &rows, - const TrilinosScalar new_diag_value = 0); + clear_rows(const ArrayView &rows, + const TrilinosScalar new_diag_value = 0); /** * Sets an internal flag so that all operations performed by the matrix, diff --git a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.h b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.h index a32c520d51..120e6bd350 100644 --- a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.h @@ -727,8 +727,8 @@ namespace LinearAlgebra * starting to clear rows. */ void - clear_rows(const std::vector &rows, - const Number new_diag_value = 0); + clear_rows(const ArrayView &rows, + const Number new_diag_value = 0); /** * Release all memory and return to a state just like after having called 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 2c3d9ab827..fae4292018 100644 --- a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h @@ -1010,7 +1010,7 @@ namespace LinearAlgebra SparseMatrix::clear_row(const size_type row, const Number new_diag_value) { - clear_rows(std::vector(1, row), new_diag_value); + clear_rows(ArrayView{&row, 1}, new_diag_value); } @@ -1018,8 +1018,8 @@ namespace LinearAlgebra template void SparseMatrix::clear_rows( - const std::vector &rows, - const Number new_diag_value) + const ArrayView &rows, + const Number new_diag_value) { // If the matrix is marked as compressed, we need to // call resumeFill() first. diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index 2475988e23..7df1d3ad0c 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -154,8 +154,8 @@ namespace PETScWrappers void - MatrixBase::clear_rows(const std::vector &rows, - const PetscScalar new_diag_value) + MatrixBase::clear_rows(const ArrayView &rows, + const PetscScalar new_diag_value) { assert_is_compressed(); diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index ef9cedaa83..0084e185af 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -1152,8 +1152,8 @@ namespace TrilinosWrappers void - SparseMatrix::clear_rows(const std::vector &rows, - const TrilinosScalar new_diag_value) + SparseMatrix::clear_rows(const ArrayView &rows, + const TrilinosScalar new_diag_value) { for (const auto row : rows) clear_row(row, new_diag_value);