> On Dec 2, 2018, at 5:13 AM, Klaus Burkart via petsc-users 
> <[email protected]> wrote:
> 
> Hello,
> 
> I use the following routine to transfer the petsc result back to my 
> application which works fine using one core as the local parts of the linear 
> system == global parts: 
> 
>     VecGetArray(petsc_x, &array);
>     for (i=rstart; i < rend; ++i) { 
>         application_x[i] = array[i];
>     }
>     VecRestoreArray(petsc_x, &array);
> 
     VecGetArray() (and VecGetArrayRead() which you could use in this case), 
return arrays that always begin at 0 on each process. So your loop should be 

> or (i=0; i < rend-rstart; ++i) { 
>         application_x[i] = array[i];
>     }


> As this updates only the local portion of x on each core but nowhere the 
> entire/global application_x vector, multicore simulations don't work 
> correctly.
> 
> How can I update the entire/global application_x vector with all local parts 
> on all cores?

   I hope this resolves your difficulties, if not let us know what fails,

    Barry

> 
> Klaus

Reply via email to