From: Sebastian Kinnewig <kinnewig@ifam.uni-hannover.de>
Date: Fri, 26 Jan 2024 09:44:37 +0000 (+0100)
Subject: Fix Copy Constructor in TpetraWrappers::Vector.
X-Git-Tag: relicensing~104^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1dca3fefc36741860b8f8d9a50c0c628f5f80bd;p=dealii.git

Fix Copy Constructor in TpetraWrappers::Vector.
---

diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h
index 6d93e62eeb..fbba68b36d 100644
--- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h
+++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h
@@ -63,9 +63,17 @@ namespace LinearAlgebra
       : Subscriptor()
       , compressed(V.compressed)
       , has_ghost(V.has_ghost)
-      , vector(V.vector)
-      , nonlocal_vector(V.nonlocal_vector)
-    {}
+      , vector(Utilities::Trilinos::internal::make_rcp<VectorType>(
+          V.vector->getMap()))
+    {
+      Tpetra::deep_copy(*vector, *V.vector);
+      if (!V.nonlocal_vector.is_null())
+        {
+          nonlocal_vector = Utilities::Trilinos::internal::make_rcp<VectorType>(
+            V.nonlocal_vector->getMap());
+          Tpetra::deep_copy(*nonlocal_vector, *V.nonlocal_vector);
+        }
+    }