#include "petscvec.h" PetscErrorCode VecGhostGetLocalForm(Vec g,Vec *l)Logically Collective
| g | - the global vector | 
| l | - the local (ghosted) representation, NULL if g is not ghosted | 
To update the ghost values from the locations on the other processes one must call VecGhostUpdateBegin() and VecGhostUpdateEnd() before accessing the ghost values. Thus normal usage is
    VecGhostUpdateBegin(x,INSERT_VALUES,SCATTER_FORWARD);
    VecGhostUpdateEnd(x,INSERT_VALUES,SCATTER_FORWARD);
    VecGhostGetLocalForm(x,&xlocal);
    VecGetArray(xlocal,&xvalues);
       // access the non-ghost values in locations xvalues[0:n-1] and ghost values in locations xvalues[n:n+nghost];
    VecRestoreArray(xlocal,&xvalues);
    VecGhostRestoreLocalForm(x,&xlocal);
One should call VecGhostRestoreLocalForm() or VecDestroy() once one is finished using the object.