[petsc-users] Assembly of local Mat's to a parallel Mat

Hui Zhang mike.hui.zhang at hotmail.com
Fri Apr 12 11:49:12 CDT 2013


On Apr 12, 2013, at 5:22 PM, Jed Brown wrote:

> Hui Zhang <mike.hui.zhang at hotmail.com> writes:
> 
>> Assembly it directly. I just found MatGetSubMatricesParallel.  
> 
> This is not a private implementation function so it's not a good place
> to learn.  It also doesn't do what you want.
> 
> For your purpose, you can either loop over the entries of A_i inserting
> them according to the R_i

I can understand this method.  A further question: since Ai itself is shared 
by many processors,  MatSetValues to A should be called by only one of the 
processor sharing Ai.  Is it right?

> or you can create a block diagonal parallel
> matrix A_i constructed by joining together all the diagonal blocks.

Which function can do this?  I only found diagonal block Mat with each block 
of the same size and dense.  Thanks!

> Presumably R is already parallel, so then you can use MatPtAP to
> assemble the product.
> 
> Note that you might be able to assemble the block diagonal A directly.
> 
>> Maybe I can learn from the source codes of this function but I can not
>> find where they are.
> 
> For navigating source code, see the manual section about setting up GNU
> Global tags or etags.  PETSc functions are named to tab complete well
> with tags.
> 



More information about the petsc-users mailing list