<div dir="ltr"><div>It turns out I asked a question that is on the FAQ page:<br></div><div><h3><a name="mpi-vec-access">How do I access the values of a parallel PETSc vector on a different process than owns them?</a></h3>
<ul>
<li>On each process create a local vector large enough to hold all the values it wishes to access</li>
<li>Create a VecScatter that scatters from the parallel vector into the local vectors</li>
<li>Use VecGetArray() to access the values in the local vector</li>
</ul><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 29, 2018 at 11:42 PM, Youjun Hu <span dir="ltr"><<a href="mailto:youjunhu@gmail.com" target="_blank">youjunhu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>After doing some research, I am convinced that VecScatter is the proper subroutine to use in getting off-process values of a vector.</div><div>Thank Jed.</div><span class="HOEnZb"><font color="#888888"><div>Youjun<br></div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Sun, Jul 29, 2018 at 10:36 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">See VecScatter.<br>
<div class="m_550222363249275056HOEnZb"><div class="m_550222363249275056h5"><br>
Youjun Hu <<a href="mailto:youjunhu@gmail.com" target="_blank">youjunhu@gmail.com</a>> writes:<br>
<br>
> Hi all,<br>
><br>
> The man-page for VecGetValues subroutine states that:<br>
> "VecGetValues gets values from certain locations of a vector. Currently can<br>
> only get values on the same processor ".<br>
><br>
> I am wondering whether there is a subroutine that can be used to get values<br>
> from any portion of a vector, rather than limited to the current<br>
> processor's portion of the vector?<br>
><br>
> It seems natural to expect that PETSc provides this kind of capability,<br>
> which is already there for some subroutines, e.g., VecSetValues.<br>
><br>
> When using VecSetValues to set the values of a vector, one processor can<br>
> set other processors' portion of the vector. The communication is handled<br>
> by PETSc when VecAssembly is called.<br>
><br>
> Am I missing something obvious?<br>
> Cheers,<br>
> Youjun<br>
</div></div></blockquote></div></div></div><br></div>
</blockquote></div><br></div>