[petsc-dev] MatGetLocalSubMatrix, MatLocalReference implementation

Jed Brown jed at 59A2.org
Fri Nov 19 18:43:50 CST 2010


On Fri, 19 Nov 2010 01:42:07 +0100, Jed Brown <jed at 59A2.org> wrote:
> In this direction, I need to be able to handle the off-diagonal local parts,
> which implies logically distinct row mappings and column mappings.  It seems
> like it should have been that way all along and I will make it so (tomorrow)
> unless there are objections.  This implies two parameters in
> MatSetLocalToGlobalMapping, but I think that is the only API change.

This is done, as is a simple MatCreateLocalRef(), which creates a matrix
that forwards MatSetValuesBlockedLocal() and MatSetValuesLocal() to the
appropriate top-level matrix.  Nesting of localrefs is not implemented
yet, but it is an easy addition.

The next step I have in mind is MatGetLocalSubMatrix() and
MatRestoreLocalSubMatrix() which is implemented using
MatCreateLocalRef() if the implementation does not provide this.  This
is very similar to MatGetSubMatrix().  Then Dmitry or Dave, or anyone
with a matrix class that holds constituent blocks should implement
MatGetLocalSubMatrix() to return those blocks directly.  Then, provided
that user code calls MatSetValuesLocal(), MatSetValuesBlockedLocal(),
MatSetValuesStencil(), or MatSetValuesBlockedStencil(), the same code
will assemble into a single coupled matrix or into independent blocks
based on the runtime type of the top-level matrix.

In the case of DMComposite, you can use DMCompositeGetLocalISs() to
select the pieces [1].  I think this API will work pretty well.

Jed

[1] Barry, what is going on with DMCompositeGetLocalISs() and
DMCompositeGetGlobalIndices().  The former has no implementation and the
latter has no man page.  I do not think that "Local IS" is a good name
for the global indices defined at all the local points (i.e. what
GetGlobalIndices is returning, in an array of ISs).  The "Local IS" that
I am looking for is the (serial) ISStride for each contiguous chunk of
the local vector.  What about DMCompositeGetGhostedISs() for the thing
GetGlobalIndices() is currently returning?

Jed



More information about the petsc-dev mailing list