<div class="gmail_quote">On Sat, Oct 8, 2011 at 05:04, Dominik Szczerba <span dir="ltr"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I have my parallel layout and I can easily gather my MPI Vec's<br>
components into one sequential Vec on root process using<br>
VecScatterCreateToZero. Works perfectly.<br>
<br>
But now I want the opposite: "VecScatterCreateFromZero". There is no<br>
such function, but it well depicts my intention: I know my parallel<br>
layout, I have a sequential Vec on root process that I want to be<br>
partitioned and distributed to all processes. </blockquote><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Vec/VecScatterCreateToZero.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Vec/VecScatterCreateToZero.html</a></div>
<div><br></div><div>then</div><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Vec/SCATTER_REVERSE.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Vec/SCATTER_REVERSE.html</a></div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">After studying all<br>
VecScatter* functions I remain unsure how to best accomplish it, e.g.<br>
VecScatterCreateToAll sounds promising but seems to scatter the whole<br>
vector while I need to scatter only relevant processor chunks. I think<br>
along these lines:<br>
<br>
// arrayGlobal is a sequential vector on root with known size and in<br>
application ordering.<br>
// arrayLocal is a MPI vector with known global and local sizes.<br>
IS ix;<br>
// Fill ix on each process with global ID's this process owns<br>
ierr = VecScatterCreate(arrayGlobal, ix, arrayLocal, PETSC_NULL, &scatter);<br>
<br>
Is this right or is there a better/more elegant way?<br>
<br>
Many thanks for any hints,<br>
<font color="#888888">Dominik<br>
</font></blockquote></div><br>