<div dir="ltr">I have a funky algorithm I'm working on... and in it I need to increment individual entries in vectors in parallel and then finalize the vector, summing to get the final value.  So, something like this:<div>
<br></div><div>If I have a vector "v" with 6 values in it (all starting at 0) spread across two processors (so that the first 3 entries are on processor 0 and the last three on processor 1).</div><div><br></div>
<div>On processor 0 I need to be able to do:</div><div><br></div><div>v[1]++;</div><div>v[2]++;</div><div>v[1]++;</div><div><br></div><div>Then on processor 1 I'd like to do:</div><div><br></div><div>v[0]++;</div><div>
v[1]++'</div><div>v[5]++;</div><div>v[1]++;</div><div><br></div><div>Then, after finalizing the vector I'd like to end up with a vector that has these values on processor 0:</div><div><br></div><div>v[0] -> 0</div>
<div>v[1] -> 4</div><div>v[2] -> 1</div><div><br></div><div>and on processor 1:</div><div><br></div><div>v[3] -> 0</div><div>v[4] -> 0</div><div>v[5] -> 1</div><div><br></div><div>Is there anything in PETSc that would help here??  I realize that I can roll my own solution using arrays and MPI for this... but it would be handy if I could do this with a PETSc Vec because the next step is to use VecPointwiseDivide() to divide another vector by this funky one pointwise.  Both of these vectors will have the same parallel distribution.  Also, note that these vectors might be really large (like 300 million to 1 billion entries) so it would be really handy to have the automatic parallelization of Vec...</div>
<div><br></div><div>Thanks for any help...</div><div><br></div><div>Derek</div></div>