]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Initialize all member variables in TrilinosWrappers::MPI::Vector
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 3 Jun 2017 22:21:50 +0000 (00:21 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 6 Jun 2017 10:04:59 +0000 (12:04 +0200)
source/lac/trilinos_vector.cc

index acab363c1d9c989c546c35c25a7cea20260939de..ecddfa439e50c40a309b64e7ebcad491275e4376 100644 (file)
@@ -64,22 +64,18 @@ namespace TrilinosWrappers
   {
     Vector::Vector ()
       :
+      Subscriptor(),
       last_action (Zero),
       compressed  (true),
       has_ghosts  (false),
-#ifdef DEAL_II_WITH_MPI
-      vector(new Epetra_FEVector(
-               Epetra_Map(0,0,Epetra_MpiComm(MPI_COMM_SELF))))
-#else
-      vector(new Epetra_FEVector(
-               Epetra_Map(0,0,Epetra_SerialComm())))
-#endif
+      vector(new Epetra_FEVector(Epetra_Map(0,0,0,Utilities::Trilinos::comm_self())))
     {}
 
 
 
     Vector::Vector (const IndexSet &parallel_partitioning,
                     const MPI_Comm &communicator)
+      : Vector()
     {
       reinit (parallel_partitioning, communicator);
     }
@@ -88,23 +84,19 @@ namespace TrilinosWrappers
 
     Vector::Vector (const Vector &v)
       :
-      Subscriptor(),
-      last_action (Zero),
-      compressed (true),
-      has_ghosts  (v.has_ghosts),
-      vector(new Epetra_FEVector(*v.vector)),
-      owned_elements(v.owned_elements)
-    {}
+      Vector()
+    {
+      has_ghosts = v.has_ghosts;
+      vector.reset(new Epetra_FEVector(*v.vector));
+      owned_elements = v.owned_elements;
+    }
 
 
 
     Vector::Vector (Vector &&v)
+      : Vector()
     {
       // initialize a minimal, valid object and swap
-      last_action = Zero;
-      vector.reset(new Epetra_FEVector(Epetra_Map(0,0,0,Utilities::Trilinos::comm_self())));
-      owned_elements.clear();
-
       swap(v);
     }
 
@@ -113,10 +105,7 @@ namespace TrilinosWrappers
     Vector::Vector (const IndexSet   &parallel_partitioner,
                     const Vector     &v,
                     const MPI_Comm   &communicator)
-      :
-      last_action (Zero),
-      compressed  (true),
-      has_ghosts  (false)
+      : Vector()
     {
       AssertThrow (parallel_partitioner.size() ==
                    static_cast<size_type>(TrilinosWrappers::n_global_elements(v.vector->Map())),
@@ -134,9 +123,7 @@ namespace TrilinosWrappers
     Vector::Vector (const IndexSet &local,
                     const IndexSet &ghost,
                     const MPI_Comm &communicator)
-      :
-      last_action (Zero),
-      compressed  (true)
+      : Vector()
     {
       reinit(local, ghost, communicator, false);
     }
@@ -812,6 +799,7 @@ namespace TrilinosWrappers
       std::swap(last_action, v.last_action);
       std::swap(compressed, v.compressed);
       std::swap(vector, v.vector);
+      std::swap(has_ghosts, v.has_ghosts);
     }
 
 

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.