Thank you Dave! It works out nicely. Hui
________________________________ From: Dave May [[email protected]] Sent: Friday, April 24, 2015 11:42 PM To: Sun, Hui Cc: [email protected] Subject: Re: [petsc-users] Scattering for DM objects If your DM is of type DMDA, you can use DMDACreateNaturalVector() DMDAGlobalToNaturalBegin() DMDAGlobalToNaturalEnd() to get the vector in the natural ordering, then you can use VecScatterCreateToZero() with your natural vector. This will give you the correctly ordered vector on rank 0. Cheers Dave On 25 April 2015 at 08:30, Sun, Hui <[email protected]<mailto:[email protected]>> 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.
