]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix the MPI problem in ConstraintMatrix reported by Michael Rapson in the mailing...
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 27 Jul 2009 08:42:11 +0000 (08:42 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 27 Jul 2009 08:42:11 +0000 (08:42 +0000)
git-svn-id: https://svn.dealii.org/trunk@19117 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/constraint_matrix.h
deal.II/lac/source/constraint_matrix.cc

index 64113296a6377f801b954f1d9465a8ba3c457e00..f99bd6717334958e77843032596e3a294b295ece 100644 (file)
@@ -1521,7 +1521,7 @@ class ConstraintMatrix : public Subscriptor
                                       * This vector is used to import data
                                       * within the distribute function.
                                       */
-    mutable TrilinosWrappers::MPI::Vector vec_distribute;
+    mutable std::auto_ptr<TrilinosWrappers::MPI::Vector> vec_distribute;
 #endif
 };
 
index 2762c836df24b44f0d3c4ec7ee5940b7079e9b4e..5bd0c374fe0c3a77e76efb0a4b75af10382f6c54 100644 (file)
@@ -744,7 +744,7 @@ void ConstraintMatrix::clear ()
 #ifdef DEAL_II_USE_TRILINOS
   {
                                   // reset distribute vector
-    vec_distribute.clear();
+    vec_distribute.reset();
   }
 #endif
   
@@ -1889,7 +1889,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const
                                   // constraints indicate. Do this only at
                                   // the first call and provide the class
                                   // with a vector for further use.
-  if (vec_distribute.size()!=vec.size())
+  if (&*vec_distribute!=0 || vec_distribute->size()!=vec.size())
     {
       std::vector<int> my_indices(vec.local_size());
       unsigned int index2 = 0;
@@ -1917,10 +1917,11 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const
       my_indices.resize(index2);
 
       Epetra_Map map_exchange = Epetra_Map(-1,index2,(int*)&my_indices[0],0,vec.trilinos_vector().Comm());
-      vec_distribute.reinit(map_exchange);
+      vec_distribute = std::auto_ptr<TrilinosWrappers::MPI::Vector> 
+       (new TrilinosWrappers::MPI::Vector(map_exchange));
     }
                                   // here we import the data
-  vec_distribute.reinit(vec,false,true);
+  vec_distribute->reinit(vec,false,true);
 
   next_constraint = 
     std::lower_bound (lines.begin(),lines.end(),index_comparison);
@@ -1932,7 +1933,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const
                                       // different contributions
       double new_value = next_constraint->inhomogeneity;
       for (unsigned int i=0; i<next_constraint->entries.size(); ++i)
-       new_value += (vec_distribute(next_constraint->entries[i].first) *
+       new_value += ((*vec_distribute)(next_constraint->entries[i].first) *
                       next_constraint->entries[i].second);
       vec(next_constraint->line) = new_value;
     }

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.