From: Wolfgang Bangerth Date: Mon, 27 May 2013 21:04:54 +0000 (+0000) Subject: Avoid some communication by improving on Timo's patch in r29631. X-Git-Tag: v8.0.0~387 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a01d13f107156cd4e92f86184487be729dad5713;p=dealii.git Avoid some communication by improving on Timo's patch in r29631. git-svn-id: https://svn.dealii.org/trunk@29650 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index 6e1fa5dba4..3a67dbaf3f 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -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();