From 6add2085478c099529a66a675fcabe6f3b45fdf7 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 14 Oct 2014 17:07:29 -0400 Subject: [PATCH] Allow v=0.0 for ghosted PETSc and Trilinos vectors --- source/lac/petsc_vector_base.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 007453082d..041648c52e 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -221,18 +221,18 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); if (has_ghost_elements()) - { - Vec ghost = PETSC_NULL; - ierr = VecGhostGetLocalForm(vector, &ghost); - AssertThrow (ierr == 0, ExcPETScError(ierr)); + { + Vec ghost = PETSC_NULL; + ierr = VecGhostGetLocalForm(vector, &ghost); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = VecSet (ghost, s); + AssertThrow (ierr == 0, ExcPETScError(ierr)); - ierr = VecSet (ghost, s); - AssertThrow (ierr == 0, ExcPETScError(ierr)); + ierr = VecGhostRestoreLocalForm(vector, &ghost); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + } - ierr = VecGhostRestoreLocalForm(vector, &ghost); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - } - return *this; } -- 2.39.5