]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid some communication by improving on Timo's patch in r29631.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 27 May 2013 21:04:54 +0000 (21:04 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 27 May 2013 21:04:54 +0000 (21:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@29650 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/constraint_matrix.templates.h

index 6e1fa5dba4eff544e0862e720a64bd4fa827cfcc..3a67dbaf3f6453b229aad13cd299b57889aadf28 100644 (file)
@@ -980,9 +980,25 @@ ConstraintMatrix::distribute (VectorType &vec) const
   Assert (sorted==true, ExcMatrixIsClosed());
 
   // if the vector type supports parallel storage and if the
-  // vector actually does it, we need to be a bit more
-  // careful about how we do things
-  if (vec.supports_distributed_data == true)
+  // vector actually does store only part of the vector, distributing
+  // is slightly more complicated. we can skip the complicated part
+  // if the local processor stores the *entire* vector and pretend
+  // that this is a sequential vector but we need to pay attention that
+  // in that case the other processors don't actually do anything (in
+  // particular that they do not call compress because the processor
+  // that owns everything doesn't do so either); this is the first if
+  // case here, the second is for the complicated case, the last else
+  // is for the simple case (sequential vector or distributed vector
+  // where the current processor stores everything)
+  if ((vec.supports_distributed_data == true)
+      &&
+      (vec.locally_owned_elements().n_elements() == 0))
+    {
+      // do nothing, in particular don't call compress()
+    }
+  else if ((vec.supports_distributed_data == true)
+           &&
+           (vec.locally_owned_elements() != complete_index_set(vec.size())))
     {
       const IndexSet vec_owned_elements = vec.locally_owned_elements();
 

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.