VecGhost and PCFieldSplit

Matthew Knepley knepley at
Wed May 27 15:57:58 CDT 2009

On Wed, May 27, 2009 at 2:50 PM, Barry Smith <bsmith at> wrote:

> On May 27, 2009, at 2:23 PM, Jed Brown wrote:
>> Gee, having vectors with a little extra space at the end is hard!
>> Notation: J is the Jacobian, P is the associated preconditioning matrix
>> PCFieldSplit gets the full row blocks (Afield) or the off-diagonal
>> blocks (B,C) from J.  I implement these matrix-free and use VecGhost
>> internally.  It also queries P for diagonal blocks (A,D).  I provide
>> these as assembled AIJ and BAIJ matrices.  It then obtains work vectors
>> by getting vecs from A and D which returns ordinary MPI vectors (no
>> ghosts).
>   You could provide the getvecs() method for the A and D matrices that you
> provide to give you the ghosted vectors that you need?

I agree with Barry. If you want to use ghosts, make everything use VecGhost.


>    Barry
>  It then tries to multiply B and C with these vectors which
>> fails because I need the ghosts.  In my particular case, this could be
>> fixed by getting the work vecs from B and C, but that just pushes the
>> problem elsewhere.
>> So it looks like I either have to abandon VecGhost (which I'd rather not
>> do because it would add two copies to every matrix-free multiply, and
>> these multiplies normally only touch a little more memory than a vector
>> an thus can be pretty cheap) or I need to be able to turn an unghosted
>> vec into a ghosted one (in-place since I have a Vec, not a Vec*).  I can
>> think of a couple ways to do this, but they would be a maintenance
>> nightmare.  There might be a way to reorganize
>> VecCreateGhostBlockWithArray to make this possible, but it still looks
>> messy to me.  Any ideas?
>> Jed

What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-dev mailing list