From 614f9c50f1ea0974fdb94bf4a810db403ef0601a Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 20 Feb 2024 09:30:40 -0500 Subject: [PATCH] Fix compiling clear_rows with newer Trilinos versions --- .../trilinos_tpetra_sparse_matrix.templates.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 fae4292018..3195d7c1c3 100644 --- a/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_sparse_matrix.templates.h @@ -1040,15 +1040,22 @@ namespace LinearAlgebra { size_t nnz = matrix->getNumEntriesInLocalRow(local_row); col_indices_vector.resize(nnz); - Teuchos::ArrayView col_indices(col_indices_vector); values_vector.resize(nnz); +# if DEAL_II_TRILINOS_VERSION_GTE(13, 2, 0) + typename MatrixType::nonconst_local_inds_host_view_type + col_indices(col_indices_vector.data(), nnz); + typename MatrixType::nonconst_values_host_view_type values( + values_vector.data(), nnz); +# else + Teuchos::ArrayView col_indices(col_indices_vector); Teuchos::ArrayView values(values_vector); - +# endif matrix->getLocalRowCopy(local_row, col_indices, values, nnz); - const size_t diag_index = - std::find(col_indices.begin(), col_indices.end(), local_row) - - col_indices.begin(); + const size_t diag_index = std::find(col_indices_vector.begin(), + col_indices_vector.end(), + local_row) - + col_indices_vector.begin(); for (size_t j = 0; j < nnz; ++j) if (diag_index != j || new_diag_value == 0) -- 2.39.5