From: Qingyuan Shi Date: Fri, 2 May 2025 13:44:58 +0000 (+0800) Subject: Add assertion in TpetraWrappers::Vector::operator=() to require compressed source X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18408%2Fhead;p=dealii.git Add assertion in TpetraWrappers::Vector::operator=() to require compressed source --- diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index 3caea75354..aa80932bb9 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -338,6 +338,12 @@ namespace LinearAlgebra // - First case: both vectors have the same layout. // - Second case: both vectors have the same size but different layout. // - Third case: the vectors have different size. + + AssertThrow(V.compressed, + ExcMessage("Cannot copy-assign from a vector that has not " + "been compressed. Please call compress() on the " + "source vector before using operator=().")); + if (vector->getMap()->isSameAs(*V.vector->getMap())) { // Create a read-only Kokkos view from the source vector