Getting values of a parallel vector

Barry Smith bsmith at
Mon Mar 24 21:29:17 CDT 2008

   If you want all the  values available on all the processes you can
use VecScatterCreateToAll() to create your scatter context; but this is
an extreme situation and usually does not make sense.


On Mar 24, 2008, at 10:59 AM, Satish Balay wrote:
> On Mon, 24 Mar 2008, Jaime Suarez wrote:
>> Good morning,
>> My question is about getting the values of a parallel vector in the
>> PETSc subroutines using Fortran 90.
>> As far as I know, I can invoke:
>> CALL VecGetArrayF90
>> in order to get the full array that is being considered in each
>> processor. However, I cannot employ this tool since I need to have  
>> also
>> the values that are stored in other processors. Is there a straight  
>> way
>> to get the value of the n-th element of a parallel vector, no matter
>> where this element is stored?
>> I am aware of the difficulty of this task, since it would involve
>> transfer of information between different processors.
>> Thanking you in advance,
> Check the manpage for VecScatterCreate(). You'll have to create
> the VecScatter object corresponding to the off-proc values you
> need - and then scatter them.
> After the scatter, the values will be available locally [Now you can
> use VecGetArrayF90 to access the values]
> Satish

More information about the petsc-users mailing list