On Mar 6, 2014, at 8:05 AM, Mark Lohry <[email protected]> wrote:

> I'm using DMDAs for managing my DOF data on structured grids, so processes 
> have access to local array chunks from i=gxs; i<gxs+gxm. I have a lot of 
> local/temporary data that I don't want PETSc to manage and I'm trying to keep 
> PETSc as segregated from the rest of code as possible, so I'd prefer for any 
> functions to be ignorant of particular ordering, and just access from i=0; 
> i<gxm so that I'm using 0-indexed arrays locally. What's the appropriate way 
> to go about doing this / getting direct access to the beginning of 
> global-indexed local array?

   Mark,

   Look at the source for DMDAVecGetArray() it calls either VecGetArray1d, 
VecGetArray2d, VecGetArray3d. You can call the VecGetArrayNd directly setting 
the local start and stop you want.

   Barry

  As a PETSc developer, of course, I would recommend keeping your 
local/temporary data also in Vecs and using the DMDAVecGetArray() for access to 
those also and having all code written in the “local patch style” with loops 
i=gxs; i<gxs+gxm  I think the code is clearer and easier to reason about than 
having each process from 0 to vxm etc.

Reply via email to