MatCreateMPIAIJ

Barry Smith bsmith at mcs.anl.gov
Tue Oct 3 07:32:19 CDT 2006



On Mon, 2 Oct 2006, Xiaoxu Wang wrote:

> Hi,
> 
>      I am a beginner on PETSC. This is my question about MatCreateMPIAIJ. I
> have a sparse matrix and only know the total number of nonzeros each row. The
> number of local rows and the number of local columns has been set to
> PETSC_DECIDE. Therefore I don't know the size of each portion and it is hard
> to tell d_nnz and o_nnz. I use the total number of nunzeros as d_nnz and get
> an allocation error.

   It would be helpful to know the exact error message:

>  How to deal  with  this problem?  Should  I  explicitly
> specify the number of local rows and the number of local columns and calculate
> d_nnz and o_nnz? Or let PETSC decide the number of local rows and the number
> of local columns, and  then use another function to get these values?  Any
> other better solution?

   You should specifically set the number of local rows and columns and then
compute the values of d_nnz and o_nnz. How you determine d_nnz and o_nnz is 
problem dependent and depends on what type of discretization you are using:
finite differences, elements etc.


   Barry

> 
> Thanks a lot,
> Xiaoxu
> 
> 




More information about the petsc-users mailing list