VecGhost and PCFieldSplit

Barry Smith bsmith at
Wed May 27 14:50:59 CDT 2009

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?


> 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

More information about the petsc-dev mailing list