I have constructed a local and global distributed array in Petsc 3.2 using:
DMCreateGlobalVector(da, &v); DMCreateLocalVector(da, &lv);
In order to retrieve the ghost cell values from neighbouring processes, I simply use the command:
DMGlobalToLocalBegin(da, v, INSERT_VALUES, lv); DMGlobalToLocalEnd(da, v, INSERT_VALUES, lv);
From what I understand, the local and global vectors use separate memory spaces. For any processor, the local portion of the global vector (Vec v) is duplicated in another memory space allocated to the local vector (Vec lv). I am attempting to construct a local/global vector that use the same memory space. I would then need to use some sort of scatter routine to only fill the appropriate ghost cells. I notice that there is a VecCreateGhost function that seems to provide this functionality. However, it does not seem to be associated with the DMDA functions (e.g. DMCreateGhostVector).