[petsc-users] extract Mat data

Hong Zhang hzhang at mcs.anl.gov
Thu Mar 31 09:48:14 CDT 2011


Loic,

>
> I want to do the same for MATMPI. This is what I do:
>
> MatGetLocalMat(A,MAT_INITIAL_MATRIX, &Aloc);
> MatGetRowIJ(Aloc, 1, PETSC_FALSE, PETSC_FALSE, &(Acsr.n), &(Acsr.ia),
> &(Acsr.ja), &done);
> MatGetArray(Aloc, &(Acsr.a));
>
> Now, I need to know on what process the non local points are.

Each process get its own local submatrix. See
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateMPIAIJ.html
on data structure of MPIAIJ format. Applying your statements above to
the example listed on the page (a 8x8 matrix), Proc0 will get
Aloc=A(0:2,:), ..., Porc2 gets Aloc=A(6:7,:).
>
> Is there a petsc function that gives this partition ?
MatGetOwnershipRange()

Hong

>


More information about the petsc-users mailing list