[petsc-dev] MatNest considered harmful

Jed Brown jed at jedbrown.org
Tue Aug 12 12:47:16 CDT 2014


Please always use "reply-all" so that your messages go to the list.
This is standard mailing list etiquette.  It is important to preserve
threading for people who find this discussion later and so that we do
not waste our time re-answering the same questions that have already
been answered in private side-conversations.  You'll likely get an
answer faster that way too.

Patrick Lacasse <patrick.m.lacasse at gmail.com> writes:

> I'm interested in your discussion, I'd like to share my usage with you.
>
> I'm working with a code that assemble matrices A and B that define a saddle
> point problem
> (A B^T)
> (B   0 )
> I use matnest to give this system to pcfieldsplit and use Schur complement
> things.
> My matrix A and B are build by different parts in our code and it would not
> be that easy to build them together into a global matrix.
> It is not an optimization for matnest, it was coded this way before we know
> about matnest and pcfieldsplit.
>
> An other choice for me is to copy those submatrices into a global aij
> matrix (is it easy to do?) and then let pcfieldsplit extract the
> submatrices back.
>
> In my situation, matnest seems the natural path to use pcfieldsplit.
> I do think that matnest are important. I hope it doesn't make me a bad
> person...

Not at all, but I would still recommend using MatGetLocalSubMatrix() and
passing the result to your existing functions.  Then you could trivially
switch between monolithic/direct solvers and fieldsplit.

> I'm using MatNestSetSubMat, MatNestGetSubMat, MatNestGetISs and of course
> MatCreateNest.
>
> I've not try to use VecNest, but I'd like too.

Please don't.  This is really better done by VecScatter or
VecGetSubVector.

> I also have a situation where our code build one global aij matrix and
> after it extracts the submatrices. I'd like to convert this code to build
> directly submatrices and use MatNest.
> It this case, it would be for optimization purpose.

Do consider MatGetLocalSubMatrix to keep your options open.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140812/ae32af70/attachment.sig>


More information about the petsc-dev mailing list