[petsc-users] Scattering for DM objects

Dave May dave.mayhem23 at gmail.com
Sat Apr 25 01:42:53 CDT 2015

If your DM is of type DMDA, you can use


to get the vector in the natural ordering, then you can use


with your natural vector.
This will give you the correctly ordered vector on rank 0.


On 25 April 2015 at 08:30, Sun, Hui <hus003 at ucsd.edu> wrote:

>  I have a DM MPI Vec u, I want to scatter it to a sequential Vec w in
> processor 0. There is a function VecScatterCreateToZero allowing me to do
> that. However, the global indices get easily messed up if I do this way.
>  So I have to match the IS for u and w. And I think maybe I can use
> DMCompositeGetGlobalISs to get the IS, and then call
> VecScatterCreate(u,is[0],w,is[0],&ctx).
>  But I'm not sure if I'm doing the right thing, and for now it gives me
> segmentation fault, memory errors on DMCompositeGetGlobalISs.
>  So I need some help on this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150425/caf3c8e6/attachment.html>

More information about the petsc-users mailing list