I tried the equivalent version with petsc in C++: Mat subA[4]; Mat A; ... MatCreateNest(comm,2,NULL,2,NULL,subA,&A);
I did not face any issues. I am trying to map it to petsc4py. Amit On Fri, Apr 4, 2014 at 12:29 PM, Matthew Knepley <[email protected]> wrote: > On Fri, Apr 4, 2014 at 12:27 PM, Amit Itagi <[email protected]> wrote: > >> I need to use the createNest for some application. I am trying it out on >> a toy program. I created four 6x6 AIJ matrices on two processes. I am >> trying to create a nest using >> >> A=PETSc.Mat() >> A.createNest([mA11,mA12,mA21,mA22]) >> > > I have never run this using petsc4py, but if it were me I would make it > take a 2D array. > > Matt > > >> I get the following error: >> >> A.createNest([mA11,mA12,mA21,mA22]) >> File "Mat.pyx", line 409, in petsc4py.PETSc.Mat.createNest >> (src/petsc4py.PETSc.c:85554) >> A.createNest([mA11,mA12,mA21,mA22]) >> File "Mat.pyx", line 409, in petsc4py.PETSc.Mat.createNest >> (src/petsc4py.PETSc.c:85554) >> File "Mat.pyx", line 197, in petsc4py.PETSc.Mat.__getitem__ >> (src/petsc4py.PETSc.c:81516) >> File "Mat.pyx", line 197, in petsc4py.PETSc.Mat.__getitem__ >> (src/petsc4py.PETSc.c:81516) >> File "petscmat.pxi", line 870, in petsc4py.PETSc.mat_getitem >> (src/petsc4py.PETSc.c:24830) >> File "petscmat.pxi", line 870, in petsc4py.PETSc.mat_getitem >> (src/petsc4py.PETSc.c:24830) >> TypeError: 'int' object is not iterable >> TypeError: 'int' object is not iterable >> >> Any ideas ? >> >> Also, is the following the correct way of setting the nest to a 2x2 block >> ? >> >> ix=PETSc.IS() >> ix.CreateGeneral([0,1]) >> A.createNest([mA11,mA12,mA21,mA22],isrows=ix,iscols=ix) >> >> Thanks >> >> Amit >> >> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener >
