[petsc-dev] Vec distribution
Barry Smith
bsmith at mcs.anl.gov
Sat Sep 14 21:13:04 CDT 2013
Jose,
You start with input Vec b which presumably has a parallel layout. The resulting x solution should then be "put back" into the same layout as the input Vec b. The simplest way to do this is to copy the portion of your "returned solution array" associated with each process to the Vec b. You can use VecGetArray() on b to access the portion of b then copy over the part of your "returned solution array" to the obtained array. The routine VecGetOwnershipRange() tells you on each process the portion of the array you need for that process.
Barry
On Sep 14, 2013, at 7:55 PM, Jose David Bermeol <jbermeol at purdue.edu> wrote:
> Hi, right now I'm implementing the function MatSolve for MATMPIAIJ matrices, so I can assume that output vector x is an MPI vector. the problem is that my library returns the solution in an array to all my MPI process, so how do I know which elements of the solution should be safe in the local vector x.
>
> Thanks
More information about the petsc-dev
mailing list