]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Correctly set up object in move constructor
authorMatthias Maier <tamiko@43-1.org>
Mon, 4 May 2015 08:25:47 +0000 (10:25 +0200)
committerMatthias Maier <tamiko@43-1.org>
Mon, 4 May 2015 11:46:25 +0000 (13:46 +0200)
include/deal.II/lac/petsc_parallel_vector.h
source/lac/petsc_parallel_vector.cc

index e8ddd6b31bf22512d5de157db9a315363f633808..ea6137f65d968d2fdb981af08a1b5623c92f330c 100644 (file)
@@ -188,7 +188,7 @@ namespace PETScWrappers
 #ifdef DEAL_II_WITH_CXX11
       // explicitly declare default variant, such that below move constructor
       // does not dissallow it
-      Vector (const Vector &v) = default;
+      Vector (const Vector &) = default;
 
       /**
        * Move constructor. Creates a new vector by stealing the internal data
index 898b98e23c480954e2fda762ab71c20cdea8d82d..c6d0749f3109fc93d14b838e5b6631da565dccd8 100644 (file)
@@ -30,10 +30,8 @@ namespace PETScWrappers
 
     Vector::Vector ()
     {
-      // this is an invalid empty vector, so we
-      // can just as well create a sequential
-      // one to avoid all the overhead incurred
-      // by parallelism
+      // this is an invalid empty vector, so we can just as well create a
+      // sequential one to avoid all the overhead incurred by parallelism
       const int n = 0;
       const int ierr
         = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
@@ -46,6 +44,14 @@ namespace PETScWrappers
 #ifdef DEAL_II_WITH_CXX11
     Vector::Vector (Vector &&v)
     {
+      // this is an invalid empty vector, so we can just as well create a
+      // sequential one to avoid all the overhead incurred by parallelism
+      const int n = 0;
+      const int ierr
+        = VecCreateSeq (PETSC_COMM_SELF, n, &vector);
+      AssertThrow (ierr == 0, ExcPETScError(ierr));
+      ghosted = false;
+
       swap(v);
     }
 #endif

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.