[petsc-users] Dropping single entries in matrix insertion for block matrices

Stefano Zampini stefano.zampini at gmail.com
Tue Dec 11 04:47:08 CST 2018


A note aside: MATIS uses the ISLocalToGlobalMapping to setup the local
matrices. If these get changed by the user, the local matrices are rebuilt.

Il giorno lun 10 dic 2018 alle ore 14:58 Lawrence Mitchell via petsc-users <
petsc-users at mcs.anl.gov> ha scritto:

> Hi Barry,
>
> > On 9 Dec 2018, at 19:25, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
> >
> >
> >   Lawrence,
> >
> >      I understand what you want and it is a reasonable request. The
> problem is that currently ISLocalToGlobalMappingCreate() when used with
> block vectors and matrices is always based on blocks, that is, from the
> manual page, "There is one integer value in indices per block and it
> represents the actual indices bs*idx + j, where j=0,..,bs-1". If you look
> at ISLocalToGlobalMappingApply() it uses the code:
> >
> > out[i] = idx[in[i]/bs]*bs + (in[i] % bs);
> >
> > to do the mapping; that is the idx[] mapping is stored only by block,
> not by point.
> >
> >  But I think you may be able to get the effect you want by "managing the
> local to global mapping yourself before calling MatSetValues()". That is,
> you create a ISLocalToGlobal object yourself, not based on blocks, then
> when setting your Dirichlet conditions you call ISLocalToGlobalMapping()
> apply yourself and then call MatSetValues() using the resulting indices.
>
> Thanks. I can do this. What would be neat is if I could just swap out the
> LGMaps. I can try and prepare a PR that does this, if you think it would be
> useful.
>
> I think the checking should be something like:
>
> - Does ISLocalToGlobalMappingGetSize(...) match the PetscLayout size?
>
> - If using the blocked interface, does the block size of the LGMap match
> the block size of the PetscLayout?
>
> This would move some error checking from MatSetLocalToGlobalMapping to
> MatSetValuesXXXLocal, which may not be  desired.
>
> What do you think?
>
> Lawrence



-- 
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181211/73e52238/attachment.html>


More information about the petsc-users mailing list