[petsc-users] Scattering for DM objects

Sun, Hui hus003 at ucsd.edu
Sat Apr 25 02:31:34 CDT 2015


Thank you Dave! It works out nicely.

Hui

________________________________
From: Dave May [dave.mayhem23 at gmail.com]
Sent: Friday, April 24, 2015 11:42 PM
To: Sun, Hui
Cc: petsc-users at mcs.anl.gov
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 <hus003 at ucsd.edu<mailto: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/9033e448/attachment.html>


More information about the petsc-users mailing list