]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assertion in TpetraWrappers::Vector::operator=() to require compressed source 18408/head
authorQingyuan Shi <shiqy21@mails.tsinghua.edu.cn>
Fri, 2 May 2025 13:44:58 +0000 (21:44 +0800)
committerQingyuan Shi <shiqy21@mails.tsinghua.edu.cn>
Thu, 8 May 2025 11:49:54 +0000 (19:49 +0800)
include/deal.II/lac/trilinos_tpetra_vector.templates.h

index 3caea753542c026cabf01ee08c00ba1712b2f4c8..aa80932bb91502adee4068e276704995e689d6e4 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.