[petsc-users] MatGetLocalSubMatrix
Jed Brown
jedbrown at mcs.anl.gov
Sun Feb 17 09:45:40 CST 2013
Look at src/snes/examples/tutorials/ex28.c for an example usage, or
src/mat/examples/tests/ex159.c for a more advanced/manual test that
demonstrates recursive nesting.
On Sun, Feb 17, 2013 at 6:56 AM, Hui Zhang <mike.hui.zhang at hotmail.com>wrote:
> I want to use MatGetLocalSubMatrix for assembly purpose.
>
> PetscErrorCode MatGetLocalSubMatrix(Mat mat,IS isrow,IS iscol,Mat *submat)
>
> I want to get a submat shared by some (not all) of the processes that
> share the mat.
>
> Some questions.
>
> 1. Shall I create isrow and iscol shared by the processes that will share
> the submat?
>
The submat is not guaranteed to be collective (this depends on the matrix
format), but it does always support MatSetValuesLocal(). The isrow and
iscol are _local_ so they should use PETSC_COMM_SELF.
> 2. The manual says the submat supports MatSetValuesLocal. Is the
> LocalToGlobalMapping already defined for submat, or I need to define it by
> myself?
>
It is induced by the LocalToGlobalMapping of the coupled (parent) matrix
and the selected local indices.
>
> If it is already defined, is it derived from the ltog of the mat such
> that for this processor the local numbering of the submat are in the same
> order
>
> as the local numbering for the mat?
>
The local numbering is with respect to the submat. (This is necessary,
otherwise there would be no way to apply this recursively and you would
have to keep track of the index mapping. Keeping the submat indexing as
private as possible was a key motivation for this interface.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130217/67c93600/attachment.html>
More information about the petsc-users
mailing list