<div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Oct 4, 2018 at 8:56 AM Phil Tooley <<a href="mailto:phil.tooley@sheffield.ac.uk">phil.tooley@sheffield.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
I am trying to understand how to create a custom scatter from petsc<br>
ordering in a local vector to natural ordering in a global vector.<br>
<br>
I have a 3D DMDA and local vector containing field data and am<br>
calculating the x y and z gradients into their own local vectors. I<br>
then need to scatter these gradients to different parts of a single<br>
vector so they are arranged [x_1 .. x_n y_1 .. y_n z_1 .. z_n] with<br>
natural ordering. (This is for use in a custom numerical scheme that I<br>
have been asked to parallelise)<br></blockquote><div><br></div><div>I may not be understanding correctly, but it sounds like this can be done simply</div><div>using two DMs. The first DM is your original one holding the field values. The</div><div>second one would set dof = dim in your new DM but everything else the same. You can use</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMDA/DMDACreateCompatibleDMDA.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMDA/DMDACreateCompatibleDMDA.html</a></div><div><br></div><div>Then stick the gradients in a global vector for the new DM. Then do GlobalToNatural</div><div>for that DM.</div><div><br></div><div>Is this what you want?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I can of course do this using multiple scatters but I need to perform<br>
this operation regularly and would like to express it as a single<br>
scatter operation if possible.<br>
<br>
I know I need to get the relevant AO from my DMDA and use it to<br>
construct appropriate ISs to build the scatter context but I am unsure<br>
how exactly to go about this.<br>
<br>
Can someone point me in the right direction please?<br>
<br>
Many Thanks<br>
<br>
Phil<br>
<br>
-- <br>
Phil Tooley<br>
Research Software Engineering<br>
University of Sheffield<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div></div>