[petsc-dev] MatNest in petsc4py with empty submatrices

Chris Eldred chris.eldred at gmail.com
Wed Feb 17 08:47:44 CST 2016


Hey All,

I was wondering if anyone had used MatNest with petsc4py. I am having
issues trying to create a MatNest where some of the submatrices are
empty. In PETSc, I can just pass NULL in the array that I give to
MatCreateNest and it works fine. However, the following code

nest_list = [[None,None],[None,None]]
nest_list[0][0] = some matrix
nest_list[0][1] = some matrix
nest_list[1][0] = some matrix
A = PETSc.Mat().createNest(nest_list,comm=PETSc.COMM_WORLD)

fails with:
  File "Mat.pyx", line 445, in petsc4py.PETSc.Mat.createNest
(src/petsc4py.PETSc.c:103202)
TypeError: Cannot convert NoneType to petsc4py.PETSc.Mat

Is there an equivalent to NULL in petsc4py (there doesn't appear to be one)?

If all of the entries in nest_list are filled, everything works fine.

Any help would be appreciated!

Thanks,
Chris

-- 
Chris Eldred
Postdoctoral Fellow, LAGA, University of Paris 13
PhD, Atmospheric Science, Colorado State University, 2015
DOE Computational Science Graduate Fellow (Alumni)
B.S. Applied Computational Physics, Carnegie Mellon University, 2009
chris.eldred at gmail.com



More information about the petsc-dev mailing list