[petsc-users] MatGetLocalSubMatrix?

Jed Brown jed at jedbrown.org
Mon Jul 27 17:41:02 CDT 2015

Mark Adams <mfadams at lbl.gov> writes:

> I have a 4x4 block matrix, in one big AIJ matrix.  I use (global) ISs to
> address individual fields.  I have a mass matrix for one field.  I would
> like to add a scaled mass matrix to one field at a time.
> MatGetLocalSubMatrix looks like what I want but it takes local indices.  My
> ISs are global.  

This isn't scalable because it needs O(P) redundant storage to know how
to address the off-process parts.  You shouldn't write new code like
this.  Use local indices.

> It seems like I should be able to do this without making a local IS
> (shift the IS by the first equation index for the process).  

That won't work unless you're lumping the mass matrix because you need
to be able to address neighbors as you set values for element mass
matrices on the interfaces of the vertex partition.  Make a local to
global mapping and use MatGetLocalSubMatrix().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150727/e937e1ea/attachment.pgp>

More information about the petsc-users mailing list