Your ix array looks fine.<br><br>If you are happy ordering the sub vector as you've indicated, just pass in PETSC_NULL for iy when you define the VecScatter. This will indicate to just insert/add the entries for the sub vector in order from lowest global index largest global index.<br>
<br>Cheers,<br> Dave<br><br><br><div class="gmail_quote">On Sat, Jan 3, 2009 at 3:06 PM, Yujie <span dir="ltr"><<a href="mailto:recrusader@gmail.com">recrusader@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Matthew:<br><br>Assuming the parent vector is 0-9 and there are 3 processes (0,1,2; 3,4,5; 6,7,8,9),<br>Now the subvector contains 2; 4; 8, 9.<br>I should create "ix" in 3 processores with MPI_COMM using arraies {2}, {4}, {8,9} respectively?<br>
create "iy" using arraies {0},{1},{2,3} respectively?<br>If it is, I think it is a little difficult to get "iy". Since the user needs to communicate between processors to confirm the global position of the local subvector. thanks a lot.<br>
<br>Regards,<br><font color="#888888">Yujie</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Fri, Jan 2, 2009 at 6:19 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
No, you use the global indices ONLY for the values needed on this processor. I would<br>also note that there is an extensive discussion of this IN the manual.<br><br> Matt<div><div></div><div><br><br><div class="gmail_quote">
On Fri, Jan 2, 2009 at 7:31 PM, Yujie <span dir="ltr"><<a href="mailto:recrusader@gmail.com" target="_blank">recrusader@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You mean I need to let all processes have a copy of the whole global index and to use this function? thanks<div>
<div></div><div><br><br><div class="gmail_quote">On Fri, Jan 2, 2009 at 5:15 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
The ix and iy are always global indices based on where the vector lives.<br>
<br>
If you are going from a parallel to parallel vector then both indices are "global"<br><font color="#888888">
<br>
Barry</font><div><div></div><div><br>
<br>
On Jan 2, 2009, at 2:21 PM, Yujie wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear Barry:<br>
<br>
I have a new question about the parameter "iy"(new index set of subvector). To parallel vector, how to provide "ix" and "iy"?<br>
<br>
Just providing the local index subset for "ix" and "iy"? if it is, it is a little difficult to let the local vector know its global position in the new subvector? If the user needs to provide the global position of local vector for "iy". some MPI communication should be needed, it looks like not a good method. In exacting submatrix, the function hides this problem. could you give me any comments? thanks a lot.<br>
<br>
Regards,<br>
<br>
Yujie<br>
<br>
<br>
On Fri, Jan 2, 2009 at 11:46 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
VecScatter is for this purpose.<br>
<br>
Rational: extracting subparts of vectors for ghost points etc takes place many times in a simulation; maybe millions.<br>
Thus separating it into a set-up followed by many uses is a worthwhile optimization. Extracting submatrices occur<br>
much less often in a simulation, maybe tens, hundreds or thousands of times so it is not worth the extra complexity<br>
of having separate set-up followed by many uses. One could argue that uniformity of design means we should have<br>
handled matrices with a MatScatter concept to parallel the Vec approach, but it is too late now :-).<br>
<br>
Barry<br>
<br>
<br>
On Jan 2, 2009, at 1:41 PM, Yujie wrote:<br>
<br>
Like MatGetSubMatrix(), whether is there a function to get a subvector in parallel mode? I have checked some scatter functios, they don't likely work. thanks a lot.<br>
<br>
Regards,<br>
<br>
Yujie<br>
<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>