[petsc-users] Get a single value from a global Vec in petsc

Barry Smith bsmith at mcs.anl.gov
Wed Jan 21 13:17:14 CST 2015


> On Jan 21, 2015, at 12:43 PM, Grischa Jacobs <grischa.jacobs at email.de> wrote:
> 
> Hi,
> 
> I don't understand the concept with local and global vec's in petsc when it come to DMDAVecGetArray and VecGetValues. I'm creating some DMDA Vec in parallel which works well. Now I want to access certain non local values of my Vec without receiving the whole global array (will not fit into my main memory) on each processor.
> 
> Is there something I'm getting wrong? In the documentation of VecGetValues it is written "Gets values from certain locations of a vector. Currently can only get values on the same processor".

   You want to use VecScatterCreate() to create a scatter that provides for each process the values that it wants. Once you have obtained the values locally then you use VecGetArray() on that process to access the values you want.

   Barry

> 
> thx, Pete
> 



More information about the petsc-users mailing list