<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Thank you Dave! It works out nicely. 
<div><br>
</div>
<div>Hui</div>
<div><br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF125144" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> Dave May [dave.mayhem23@gmail.com]<br>
<b>Sent:</b> Friday, April 24, 2015 11:42 PM<br>
<b>To:</b> Sun, Hui<br>
<b>Cc:</b> petsc-users@mcs.anl.gov<br>
<b>Subject:</b> Re: [petsc-users] Scattering for DM objects<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">If your DM is of type DMDA, you can use<br>
<pre>DMDACreateNaturalVector()<br>DMDAGlobalToNaturalBegin() <br>DMDAGlobalToNaturalEnd()<br></pre>
to get the vector in the natural ordering, then you can use<br>
<div>
<div>
<div><br>
<span style="font-family:Menlo; font-size:11px">VecScatterCreateToZero</span>()<br>
<br>
</div>
<div>with your natural vector. <br>
This will give you the correctly ordered vector on rank 0.<br>
<br>
</div>
<div>Cheers<br>
</div>
<div>  Dave<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 25 April 2015 at 08:30, Sun, Hui <span dir="ltr"><<a href="mailto:hus003@ucsd.edu" target="_blank">hus003@ucsd.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">I have a DM MPI Vec u, I want to scatter it to a sequential Vec w in processor 0. There is a function <span style="font-family:Menlo; font-size:11px">VecScatterCreateToZero </span><span style="font-size:10pt">allowing
 me to do that. However, the global indices get easily messed up if I do this way. </span>
<div><span style="font-size:10pt"><br>
</span></div>
<div><span style="font-size:10pt">So I have to match the IS for u and w. And I think maybe I can use </span><span style="font-family:Menlo; font-size:11px">DMCompositeGetGlobalISs </span><span style="font-size:10pt">to get the IS, and then call </span><span style="font-family:Menlo; font-size:11px">VecScatterCreate(u,is[</span><span style="font-family:Menlo; font-size:11px; color:rgb(39,42,216)">0</span><span style="font-family:Menlo; font-size:11px">],w,is[</span><span style="font-family:Menlo; font-size:11px; color:rgb(39,42,216)">0</span><span style="font-family:Menlo; font-size:11px">],&ctx). </span></div>
<div><span style="font-family:Menlo; font-size:11px"><br>
</span></div>
<div>But I'm not sure if I'm doing the right thing, and for now it gives me segmentation fault, memory errors on <span style="font-family:Menlo; font-size:11px">DMCompositeGetGlobalISs. </span></div>
<div><span style="font-size:10pt"><br>
</span></div>
<div><span style="font-size:10pt">So I need some help on this. </span></div>
<div><br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>