It turns out I asked a question that is on the FAQ page: How do I access the values of a parallel PETSc vector on a different process than owns them?
- On each process create a local vector large enough to hold all the values it wishes to access - Create a VecScatter that scatters from the parallel vector into the local vectors - Use VecGetArray() to access the values in the local vector On Sun, Jul 29, 2018 at 11:42 PM, Youjun Hu <youju...@gmail.com> wrote: > After doing some research, I am convinced that VecScatter is the proper > subroutine to use in getting off-process values of a vector. > Thank Jed. > Youjun > > On Sun, Jul 29, 2018 at 10:36 PM, Jed Brown <j...@jedbrown.org> wrote: > >> See VecScatter. >> >> Youjun Hu <youju...@gmail.com> writes: >> >> > Hi all, >> > >> > The man-page for VecGetValues subroutine states that: >> > "VecGetValues gets values from certain locations of a vector. Currently >> can >> > only get values on the same processor ". >> > >> > I am wondering whether there is a subroutine that can be used to get >> values >> > from any portion of a vector, rather than limited to the current >> > processor's portion of the vector? >> > >> > It seems natural to expect that PETSc provides this kind of capability, >> > which is already there for some subroutines, e.g., VecSetValues. >> > >> > When using VecSetValues to set the values of a vector, one processor can >> > set other processors' portion of the vector. The communication is >> handled >> > by PETSc when VecAssembly is called. >> > >> > Am I missing something obvious? >> > Cheers, >> > Youjun >> > >