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

petsc : zeroMatrix() : do not call MatAssembly on empty matrix, it destroys...

petsc : zeroMatrix() : do not call MatAssembly on empty matrix, it destroys preallocation on petsc 3.4
parent 216f63c6
No related branches found
No related tags found
No related merge requests found
...@@ -280,8 +280,12 @@ void linearSystemPETSc<scalar>::zeroMatrix() ...@@ -280,8 +280,12 @@ void linearSystemPETSc<scalar>::zeroMatrix()
} }
} }
if (_isAllocated && _entriesPreAllocated) { if (_isAllocated && _entriesPreAllocated) {
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY)); PetscBool assembled;
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY)); _try(MatAssembled(_a, &assembled));
if (!assembled) {
_try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY));
_try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY));
}
_try(MatZeroEntries(_a)); _try(MatZeroEntries(_a));
_matrixModified = true; _matrixModified = true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment