[petsc-dev] Changing Mat block size?
Barry Smith
bsmith at mcs.anl.gov
Fri Feb 14 07:54:27 CST 2014
Change MatCreateShell() to take the block size
Note that we should probably also change MatCreateSeqAIJ() and MatCreateAIJ() to take the block size now before a release.
The “convenience” constructors are suppose to be convenient, if they stop being convenient then it is reasonable to change them.
Barry
On Feb 14, 2014, at 12:10 AM, Jed Brown <jed at jedbrown.org> wrote:
> I'm confronted with code that looks like this:
>
> MatCreateShell(...,&B);
> MatSetBlockSize(B,3);
>
> This used to work, but then we made block sizes stricter and since
> MatCreate_Shell calls PetscLayoutSetUp, we can't change the block size
> later. Is there a sane way to fix this (perhaps leaving [rc]map->bs=-1
> and collapsing it to 1 the first time it is actually used), or must we
> replace that code with the following?
>
> MatCreate(comm,&B);
> MatSetBlockSize(B,3);
> MatSetSizes(B,m,n,M,N);
> MatSetType(B,MATSHELL);
> MatShellSetContext(B,ctx);
> MatSetUp(B);
More information about the petsc-dev
mailing list