From: Timo Heister Date: Thu, 7 Aug 2014 15:40:13 +0000 (-0400) Subject: improve patch slightly X-Git-Tag: v8.2.0-rc1~208^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44af8d44e5c893f0d043e580e71425dc7815f6a9;p=dealii.git improve patch slightly --- diff --git a/include/deal.II/lac/constraint_matrix.h b/include/deal.II/lac/constraint_matrix.h index 282fa05f95..09edea34f7 100644 --- a/include/deal.II/lac/constraint_matrix.h +++ b/include/deal.II/lac/constraint_matrix.h @@ -649,22 +649,22 @@ public: * account and throws an exception in case there are any * inhomogeneities. Use the function using both a matrix and vector for that * case. - * Note: this function does not work for MPI vectors because it would require - * ghosted vector in that case, however all ghosted vectors are read-only objects. - * Instead, use the analogue with two input arguments. + * + * @note This function does not work for MPI vectors. Use condense() with + * two vector arguments instead. */ template void condense (VectorType &vec) const; /** - * Same as above, but accepts two input arguments. If called in parallel, one - * vector is supposed to be a ghosted vector and the other vector without ghost - * elements. The function copies and condenses values from @p vec_ghosted into - * @p vec. + * The function copies and condenses values from @p vec_ghosted into @p + * output. In a serial code it is equivalent to calling condense (vec). If + * called in parallel, @p vec_ghosted is supposed to contain ghost elements + * while @p output should not. */ template void condense (const VectorType &vec_ghosted, - VectorType &vec) const; + VectorType &output) const; /** * Condense a given matrix and a given vector. The associated matrix struct diff --git a/include/deal.II/lac/constraint_matrix.templates.h b/include/deal.II/lac/constraint_matrix.templates.h index d54eca03e6..12136a8b70 100644 --- a/include/deal.II/lac/constraint_matrix.templates.h +++ b/include/deal.II/lac/constraint_matrix.templates.h @@ -78,7 +78,9 @@ ConstraintMatrix::condense (const VectorType &vec_ghosted, { Assert (sorted == true, ExcMatrixNotClosed()); - vec = vec_ghosted; + // if this is called with different arguments, we need to copy the data over: + if (&vec != &vec_ghosted) + vec = vec_ghosted; // distribute all entries, and set them to zero. do so in // two loops because in the first one we need to add to elements