Skip to content

Commit aa6187f

Browse files
authored
Merge pull request #75 from gridap/fix_convert
Fix convert from PSparseMatrix to PetscMatrix for MPI backend.
2 parents 30c722b + bedc0db commit aa6187f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PartitionedArrays.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ function _petsc_matrix(a::PSparseMatrix,::MPIBackend)
192192
@check isa(cols,IndexRange) "Not supported partition for PETSc matrices"
193193
Tm = SparseMatrixCSR{0,PetscScalar,PetscInt}
194194
csr = convert(Tm,values)
195-
i = csr.rowptr; j = csr.colval; v = csr.nzval
195+
i = csr.rowptr; _j = csr.colval; v = csr.nzval
196+
if values === csr
197+
j = copy(_j)
198+
else
199+
j = _j
200+
end
196201
u = PetscInt(1)
197202
for k in 1:length(j)
198203
lid = j[k] + u

0 commit comments

Comments
 (0)