[petsc-users] Changing block size.

Barry Smith bsmith at mcs.anl.gov
Wed Dec 3 18:40:41 CST 2014


> On Dec 3, 2014, at 5:13 PM, Andrew Spott <ansp6066 at colorado.edu> wrote:
> 
> What is the easiest way to change the block size of a matrix?
> 
> I have a matrix that was saved with a block size of 1, and I would like to increase it upon load to a larger block size.  Is there a simple way of doing this?

   Yes, declare it as a BAIJ before calling MatLoad() for example

    Mat A;

    MatCreate(comm,&A);
    MatSetType(A,MATBAIJ);
    MatLoad(A,viewer);

    and pass the command line option -matload_block_size 2  

    In the development version of PETSc you can skip the command line option and instead use 

    MatSetBlockSize(A,2);   before the call to MatLoad().    There was a bug in the release version of PETSc that prevented this from previously working.

   Barry

> 
> Thanks
> 
> -Andrew Spott
> 



More information about the petsc-users mailing list