From 6489851891d16dbd31f281764afe596aa4bf1d7b Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Tue, 21 Jun 2011 10:50:43 +0000 Subject: [PATCH] petsc : add assemblyBegin/End on vector --- Solver/linearSystemPETSc.cpp | 2 ++ Solver/linearSystemPETSc.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp index d0d34079ee..1ed3ec0af3 100644 --- a/Solver/linearSystemPETSc.cpp +++ b/Solver/linearSystemPETSc.cpp @@ -240,6 +240,8 @@ linearSystemPETScBlockDouble::linearSystemPETScBlockDouble() double linearSystemPETScBlockDouble::normInfRightHandSide() const { PetscReal nor; + VecAssemblyBegin(_b); + VecAssemblyEnd(_b); VecNorm(_b, NORM_INFINITY, &nor); return nor; } diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp index 2694650dd6..67c35945ef 100644 --- a/Solver/linearSystemPETSc.hpp +++ b/Solver/linearSystemPETSc.hpp @@ -173,7 +173,7 @@ void linearSystemPETSc<scalar>::getFromRightHandSide(int row, scalar &val) const // FIXME specialize this routine val = s.real(); #else - VecGetValues(_b, 1, &row, &val); + _try(VecGetValues(_b, 1, &row, &val)); #endif } @@ -181,6 +181,8 @@ template <class scalar> double linearSystemPETSc<scalar>::normInfRightHandSide() const { PetscReal nor; + VecAssemblyBegin(_b); + VecAssemblyEnd(_b); _try(VecNorm(_b, NORM_INFINITY, &nor)); return nor; } @@ -205,7 +207,7 @@ void linearSystemPETSc<scalar>::getFromSolution(int row, scalar &val) const _try(VecRestoreArray(_x, &tmp)); val = s.real(); #else - VecGetValues(_x, 1, &row, &val); + _try(VecGetValues(_x, 1, &row, &val)); #endif } -- GitLab