On May 15, 2013, at 2:25 PM, Roc Wang <pengxwang at hotmail.com> wrote:
> Thanks, I will write the stand alone code for it. One more question about the
> global and local vector below.
>
> > > > > ierr = DMCreateGlobalVector(da,&gsol3d);CHKERRQ(ierr);
> > > > > ierr = DMLocalToGlobalBegin(da,x,INSERT_VALUES,gsol3d);CHKERRQ(ierr);
> > > > > ierr = DMLocalToGlobalEnd(da,x,INSERT_VALUES,gsol3d);CHKERRQ(ierr);
> > > >
In the above you are trying to scatter a local vector x to a global vector
gsol3d. But x is a global vector.
>
> !*******************************
> The x from KSPGetSolution() IS a global vector, it is not a "local" vector?
> (It should be a typo :) )
It is a global vector.
> So Can I convert the global x to a 3d array directly? Thank.
You can convert either a global vector or a local vector to 3d array access
BUT the converted global vector has NO ghost values accessible while the
converted local vector has ghost points available (after the call to
DMGlobalToLocalBegin/End()).
>