From afb58ce961adb1245af7faeb11f48d830da89e60 Mon Sep 17 00:00:00 2001 From: Qingyuan Shi Date: Fri, 2 May 2025 21:44:58 +0800 Subject: [PATCH] Add assertion in TpetraWrappers::Vector::operator=() to require compressed source --- include/deal.II/lac/trilinos_tpetra_vector.templates.h | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.39.5