Skip to content
Snippets Groups Projects
Commit 64898518 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

petsc : add assemblyBegin/End on vector

parent d52f3c8d
No related branches found
No related tags found
No related merge requests found
...@@ -240,6 +240,8 @@ linearSystemPETScBlockDouble::linearSystemPETScBlockDouble() ...@@ -240,6 +240,8 @@ linearSystemPETScBlockDouble::linearSystemPETScBlockDouble()
double linearSystemPETScBlockDouble::normInfRightHandSide() const double linearSystemPETScBlockDouble::normInfRightHandSide() const
{ {
PetscReal nor; PetscReal nor;
VecAssemblyBegin(_b);
VecAssemblyEnd(_b);
VecNorm(_b, NORM_INFINITY, &nor); VecNorm(_b, NORM_INFINITY, &nor);
return nor; return nor;
} }
......
...@@ -173,7 +173,7 @@ void linearSystemPETSc<scalar>::getFromRightHandSide(int row, scalar &val) const ...@@ -173,7 +173,7 @@ void linearSystemPETSc<scalar>::getFromRightHandSide(int row, scalar &val) const
// FIXME specialize this routine // FIXME specialize this routine
val = s.real(); val = s.real();
#else #else
VecGetValues(_b, 1, &row, &val); _try(VecGetValues(_b, 1, &row, &val));
#endif #endif
} }
...@@ -181,6 +181,8 @@ template <class scalar> ...@@ -181,6 +181,8 @@ template <class scalar>
double linearSystemPETSc<scalar>::normInfRightHandSide() const double linearSystemPETSc<scalar>::normInfRightHandSide() const
{ {
PetscReal nor; PetscReal nor;
VecAssemblyBegin(_b);
VecAssemblyEnd(_b);
_try(VecNorm(_b, NORM_INFINITY, &nor)); _try(VecNorm(_b, NORM_INFINITY, &nor));
return nor; return nor;
} }
...@@ -205,7 +207,7 @@ void linearSystemPETSc<scalar>::getFromSolution(int row, scalar &val) const ...@@ -205,7 +207,7 @@ void linearSystemPETSc<scalar>::getFromSolution(int row, scalar &val) const
_try(VecRestoreArray(_x, &tmp)); _try(VecRestoreArray(_x, &tmp));
val = s.real(); val = s.real();
#else #else
VecGetValues(_x, 1, &row, &val); _try(VecGetValues(_x, 1, &row, &val));
#endif #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment