thanks a lot! I seems to understand much better now! 

On Feb 17, 2013, at 4:45 PM, Jed Brown wrote:

> 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.)

Reply via email to