[petsc-users] MATIS and DMDA in petsc4py
Loic Gouarin
loic.gouarin at math.u-psud.fr
Mon Apr 23 05:32:42 CDT 2018
Hi,
I try to use MATIS from petsc4py but I am not able to use setValuesLocal
(I have a segmentation fault). And I don't understand why.
Could you tell me if I did a mistake or if it's a bug ?
My example
=======
from petsc4py import PETSc
import numpy as np
n = 10
da = PETSc.DMDA().create([n, n], dof=1, stencil_width=1)
da.setMatType(PETSc.Mat.Type.IS)
A = da.createMatrix()
#ltog = da.getLGMap()
#A.setLGMap(ltog, ltog)
elem = da.getElements()
melem = np.ones((4, 4))
for e in elem:
A.setValuesLocal(e, e, melem, PETSc.InsertMode.ADD_VALUES)
Thanks,
Loic
--
Tel: 01 69 15 60 14
http://www.math.u-psud.fr/~gouarin
https://github.com/gouarin
More information about the petsc-users
mailing list