From 5b98b62fa92b45ebc78434dc13c58d18fc7f5ead Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 12 Feb 2014 22:32:22 +0000 Subject: [PATCH] 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 --- deal.II/include/deal.II/lac/petsc_parallel_vector.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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: -- 2.39.5