[petsc-dev] MatGetLocalSubMatrix, MatLocalReference implementation

Jed Brown jed at 59A2.org
Thu Nov 18 18:12:42 CST 2010


[From "Handling ADD_VALUES with DMComposite"]

On Wed, Nov 17, 2010 at 16:26, Jed Brown <jed at 59a2.org> wrote:

> So what if I could get lightweight references to the blocks with an API
> like MatGetSubMatrices.  In the MatBlock case, it would just give me
> references to the pieces, but in the AIJ case, it would give me a Mat of a
> new type that only implements MatSetValues (and variants).  This
> implementation would end up just calling MatSetValues(J,...) with fixed up
> indices.


I started writing this and I have a question about nesting.  The idea is
that the user calls DMCompositeGetLocalISs and then MatGetLocalSubMatrix for
the pieces they will assemble into.  MatGetLocalSubMatrix would be
implemented for MatBlock (with matching index sets) to just return the
constitutive piece, but matrix types that do not implement it, they would
return a new matrix type (maybe "LocalReference", not sure about the name).
 This matrix would implement MatSetValuesLocal and MatSetValuesBlockedLocal.
 I'm not sure it makes sense to implement insertion in terms of global
indices since there isn't a cheap way to forward those to the correct values
within the big matrix.

We want it to be possible to nest these local references.  It could always
call MatSetValuesLocal from the higher level.  This is slightly simpler, but
I'm concerned about having to go through several layers.  Only slightly more
involved to implement, is to collapse all nesting in defining the
LocalToGlobalMapping so that it translates directly to the top level and can
call that insertion directly.  I think this is normally the right solution,
but non-overlapping DD really requires local insertion.

I think the right thing will be to collapse all the way to MatSetValues if
mat->ops->setvalueslocal == NULL, and to only collapse to MatSetValuesLocal
if it is non-NULL.

Jed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20101119/60347411/attachment.html>


More information about the petsc-dev mailing list