From: Sebastian Kinnewig Date: Fri, 2 Feb 2024 10:35:56 +0000 (+0100) Subject: Make TpetraWrapps::Vector compatible with BlockVectorBase. X-Git-Tag: relicensing~25^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56cb89850f196d5d92b6a098dd6531614c2ed5c3;p=dealii.git Make TpetraWrapps::Vector compatible with BlockVectorBase. --- diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index 0b9a2d3c16..6018ff6fa0 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -208,6 +208,34 @@ namespace LinearAlgebra << "An error with error number " << arg1 << " occurred while calling a Trilinos function"); + /* + * Access to a an element that is not (locally-)owned. + * + * @ingroup Exceptions + */ + DeclException4( + ExcAccessToNonLocalElement, + size_type, + size_type, + size_type, + size_type, + << "You are trying to access element " << arg1 + << " of a distributed vector, but this element is not stored " + << "on the current processor. Note: There are " << arg2 + << " elements stored " + << "on the current processor from within the range [" << arg3 << ',' + << arg4 << "] but Trilinos vectors need not store contiguous " + << "ranges on each processor, and not every element in " + << "this range may in fact be stored locally." + << "\n\n" + << "A common source for this kind of problem is that you " + << "are passing a 'fully distributed' vector into a function " + << "that needs read access to vector elements that correspond " + << "to degrees of freedom on ghost cells (or at least to " + << "'locally active' degrees of freedom that are not also " + << "'locally owned'). You need to pass a vector that has these " + << "elements as ghost entries."); + private: /** * Point to the vector we are referencing. @@ -261,6 +289,8 @@ namespace LinearAlgebra using real_type = typename numbers::NumberTraits::real_type; using size_type = types::global_dof_index; using reference = internal::VectorReference; + using const_reference = + const internal::VectorReference; using MapType = Tpetra::Map; using VectorType = Tpetra:: diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index db6cc93ed5..c48c17e7de 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -182,6 +182,7 @@ namespace LinearAlgebra 0, 0, Utilities::Trilinos::tpetra_comm_self())); has_ghost = false; compressed = true; + nonlocal_vector.reset(); } @@ -1066,6 +1067,7 @@ namespace LinearAlgebra } + template MPI_Comm Vector::mpi_comm() const diff --git a/source/lac/trilinos_tpetra_block_sparse_matrix.cc b/source/lac/trilinos_tpetra_block_sparse_matrix.cc index fafcebe325..283dad3bda 100644 --- a/source/lac/trilinos_tpetra_block_sparse_matrix.cc +++ b/source/lac/trilinos_tpetra_block_sparse_matrix.cc @@ -52,18 +52,6 @@ namespace LinearAlgebra BlockSparseMatrix::Tvmult( TpetraWrappers::BlockVector &, const TpetraWrappers::BlockVector &) const; - - template void - BlockSparseMatrix::vmult( - ::dealii::BlockVector &, - const ::dealii::BlockVector &) const; - - template void - BlockSparseMatrix::Tvmult( - ::dealii::BlockVector &, - const ::dealii::BlockVector &) const; - - } // namespace TpetraWrappers } // namespace LinearAlgebra # endif // DOXYGEN