Using of MatGetSubMatrices

Christian Henke henke at math.tu-clausthal.de
Mon Aug 28 06:42:50 CDT 2006


Hi all,

I am trying with petsc2.2.0 to get access to my sparse blockdiagonalmatrix  
matrix which contains for example 4 blocks m1 ... m4. If I use 2 Processors 
then m1 and m2 are owned by p1 and m3, m4 owned by p2. Now I want to read m1, 
m2 from p2 and m3, m4 from p1. First I have used MatGetValues, but then I 
took the message: Only local values currently supported. 
My next try was the function MatGetSubMatrices:

    IS             isrow, iscol;
    Mat            *M;

    ISCreateStride(PETSC_COMM_SELF,m,(int)i*m,1,&isrow);
    ISCreateStride(PETSC_COMM_SELF,m,(int)j*m,1,&iscol);

    const int ierr
      = MatGetSubMatrices(matrix,1,&isrow,&iscol,MAT_INITIAL_MATRIX,&M);
    
    ...

    ISDestroy(isrow);
    ISDestroy(iscol);

where i,j the blockindices and m is the blocksize. It works well for a few 
functioncalls, but then it stops with the log_trace-message:

[0] 0.055568 Event begin: MatGetSubMatrice.

What is my error? Is MatGetSubMatrices the wrong function for my problem or 
are the above lines wrong?

Regards Christian




More information about the petsc-users mailing list