[petsc-users] VecSetType and ghosted vectors

Barry Smith bsmith at mcs.anl.gov
Wed Oct 19 16:54:53 CDT 2011


On Oct 19, 2011, at 1:27 PM, Jed Brown wrote:

> On Wed, Oct 19, 2011 at 13:26, Dominik Szczerba <dominik at itis.ethz.ch> wrote:
> Is it possible to VecCreate() first and set its type to ghosted later, just as it is possible with VECMPI?
> 
> Not currently, you have to use VecCreateGhost*().


  Ghosting is basically a property of VECMPI not a different vector class.  I have added a VecMPISetGhost() to petsc-dev that you can call after VecCreate(), VecSetType() and VecSetSizes(). 

   It is not clear to me that this is a particularly useful function because you generally decide before you write the code if you are going to use ghosted vectors or not; that is, it is unlikely it is a runtime decision so you might as well just use VecCreateGhost() instead of the sequence VecCreate(), VecSetType(), VecSetSizes(), VecMPISetGhost(). But for uniformity of PETSc style it is good to have it so here it is.


  Barry

 


More information about the petsc-users mailing list