From: Timo Heister Date: Wed, 12 Feb 2014 22:32:22 +0000 (+0000) Subject: detect when assigning PETSc vectors to each other when they are not compress()ed X-Git-Tag: v8.2.0-rc1~843 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b98b62fa92b45ebc78434dc13c58d18fc7f5ead;p=dealii.git detect when assigning PETSc vectors to each other when they are not compress()ed git-svn-id: https://svn.dealii.org/trunk@32464 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/petsc_parallel_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_vector.h index eaf007917a..540bf0b23e 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_vector.h @@ -596,6 +596,15 @@ namespace PETScWrappers Vector & Vector::operator = (const Vector &v) { + // make sure left- and right-hand side of the assignment are compress()'ed: + Assert(v.last_action == VectorOperation::unknown, + internal::VectorReference::ExcWrongMode (VectorOperation::unknown, + v.last_action)); + Assert(last_action == VectorOperation::unknown, + internal::VectorReference::ExcWrongMode (VectorOperation::unknown, + last_action)); + + if (v.size()==0) { // this happens if v has not been initialized to something useful: