[petsc-users] Getting 0 for both start and end with MatGetOwnershipRange()

Lisandro Dalcin dalcinl at gmail.com
Wed May 9 18:35:55 CDT 2012


On 9 May 2012 20:01, Daniel Christian Weflen <Daniel.Weflen at colorado.edu> wrote:
> I have the following code:
>
>     Mat H;
>     PetscInt mat_size=x_npts*y_npts;
>     ierr=MatCreate(PETSC_COMM_WORLD,&H);CHKERRQ(ierr);
>
> ierr=MatSetSizes(H,PETSC_DECIDE,PETSC_DECIDE,mat_size,mat_size);CHKERRQ(ierr);
>     ierr=MatSetType(H,MATSEQMAIJ);CHKERRQ(ierr);
>     PetscInt* nonzeros;
>     PetscInt start_row,end_row,row_index;
>     MatGetOwnershipRange(H,&start_row,&end_row);
>
> When I check the values of start_row and end_row right after calling
> MatGetOwnershipRange, both are 0. What am I doing wrong here? Am I calling
> MatCreate(), MatSetSizes() and MatSetType() in the wrong order?

Call MatSetUp() after MatSetType().


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169


More information about the petsc-users mailing list