[petsc-users] Sequential to Parallel vector using VecScatter

Junchao Zhang junchao.zhang at gmail.com
Tue Jan 3 17:24:03 CST 2023


On Tue, Jan 3, 2023 at 4:01 PM Venugopal, Vysakh (venugovh) via petsc-users
<petsc-users at mcs.anl.gov> wrote:

> Hi,
>
>
>
> Suppose I have a vector ‘V’ of global size m divided into 2 processes
> (making local size m/2). This vector V is derived from a DM object using
> DMCreateGlobalVector.
>
>
>
> I am using VecScatterCreateToAll to get a vector V_SEQ.
>
V_SEQ on each process has a size m


>
>
> Is there a way to distribute the V_SEQ to V (where each V has a local size
> of m/2)?
>

I assume you want to sum V_SEQ into V, since each entry of V will receive
two contributions from the two V_SEQ.
If that's the case, you could use VecScatterBegin/End(toall, V_SEQ, V,
ADD_VALUES, SCATTER_REVERSE), where 'toall' is the VecScatter you created
with VecScatterCreateToAll.


>
>
> I am happy to explain if my question is not clear. Thank you!
>
>
>
> ---
>
> Vysakh Venugopal
>
> Ph.D. Candidate
>
> Department of Mechanical Engineering
>
> University of Cincinnati, Cincinnati, OH 45221-0072
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230103/d58a5aa3/attachment.html>


More information about the petsc-users mailing list