I’ve got a simple problem where I use a DM to handle a representation of a
vector complex numbers, storing the real and imaginary components at each
lattice point. I also have ghost points at either end, i.e.:
DMDACreate1d (PETSC_COMM_WORLD, DM_BOUNDARY_GHOSTED, N, 2 , 1 , NULL, &dm ) ;
I have a few related questions:
1. Is there a quick way to zero out the ghost points, other than to do
DMGetLocalVector(dm,&local);
DMGlobalToLocalBegin(dm,global,INSERT_VALUES,local);
DMGlobalToLocalEnd(dm,global,INSERT_VALUES,local);
DMDAVecGetArray(dm, local, &array);
DMDAGetLocalInfo(dm, &info);
if(info.xs == 0){
array[-1].u =0.0;
array[-1].v =0.0;
}
if(info.xs + info.xm == info.mx){
array[info.mx].u =0.0;
array[info.mx].v =0.0;
}
/* call restores after */
My point is, I don’t really need to interfere with any of the entries, just the
values in those two ghost points.
2. If I take a dot product of two such vectors (associated with the dm, as
arrays of complex numbers in terms of real and imaginary parts), does the dot
product operate on the ghost points too, or just the “real” values?
3. If I apply a VecCopy, VecAXPY, or any similar operation to such vectors,
do they also operate on the ghost points?
-gideon