[petsc-users] MatGetSubmatrices from block matrix MPIBAIJ

Jed Brown jedbrown at mcs.anl.gov
Tue Oct 23 10:26:26 CDT 2012


On Tue, Oct 23, 2012 at 10:19 AM, shu guo <greatgs2008 at gmail.com> wrote:

> I am solving a electromagnetic problem. Each node has 4 degree of
> freedom, phi A1 A2 A3.
>
> The row in this blocked matrix is generated as
>
>                node1         |      node 2                 |         node 3
>                                  |                                |
> phi1 A1_1 A1_2 A1_3 | phi2 A2_1 A2_2 A2_3| phi3 A3_1 A3_2 A3_3
>
> And I permute it as
>
> phi matrix      ||                A matrix
> phi1 phi2 phi3 || A1_1 A1_2 A1_3 A2_1 A2_2 A2_3 A3_1 A3_2 A3_3
>
> I permuted it just want to sort each variables together.
>

Why? This just destroys the locality that makes BAIJ efficient. See the
effect of "field interlacing" here (still true today).

http://www.mcs.anl.gov/~kaushik/Papers/parco01.pdf


>
> > Just build an index set that has every part of the block. If you need
> > arbitrary scalar subsets, use MPIAIJ (can use MatConvert).
>
> If I want the submatrix from original matrix, can you be more specific
> that how the index set looks like? And is it possible for me to merely
> get the submatrix of the ist DOF of each element? Thank you.
>

Create an index set with [0,4,8,...], but use the AIJ format.

You can request support for BAIJ here, but I'm afraid it's not going to be
considered high priority because the potential benefits of BAIJ over AIJ
are quite small if you are taking submatrices.
https://bitbucket.org/petsc/petsc-dev/issues
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121023/f540fb3d/attachment.html>


More information about the petsc-users mailing list