From: 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-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=480e351fec64cec684d9a4afc2e691b0c8a9c9a3;p=dealii-svn.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: