<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 24, 2015 at 9:01 PM, Wee Beng Tay <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div> <br><br>Sent using <a href="https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.2.9&pv=5.0.2" target="_blank">CloudMagic</a> </div><div style="color:#787878">On Mon, Aug 24, 2015 at 6:21 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br><div style="background:rgb(255,255,255)"><blockquote><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 24, 2015 at 4:09 AM, Wee-Beng Tay <span dir="ltr"><<a href="mailto:zonexo@gmail.com" target="_blank">zonexo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm modifying my 3d fortran code from MPI along 1 direction (z) to MPI along 2 directions (y,z)</div><div><br></div><div>Previously I was using MatSetValues with global indices. However, now I'm using DM and global indices is much more difficult.</div><div><br></div><div>I come across MatSetValuesStencil or MatSetValuesLocal.</div><div><br></div><div>So what's the difference bet the one since they both seem to work locally?</div></div></blockquote><div><br></div><div>No. MatSetValuesLocal() takes local indices. MatSetValuesStencil() takes global vertex numbers.</div><div></div></div></div></div></blockquote><div><br></div><div>So <span style="color:rgb(51,51,51);font-family:sans-serif;font-size:13.7600002288818px;line-height:22.3999996185303px">MatSetValuesStencil() takes global vertex numbers. Do you mean the natural or petsc  ordering? </span></div></div></blockquote><div><br></div><div>There is no PETSc ordering for vertices, only the natural ordering.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="background:rgb(255,255,255)"><blockquote><div><div class="gmail_extra"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Which is a simpler/better option?</div></div></blockquote><div><br></div><div>MatSetValuesStencil()</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Is there an example in Fortran for MatSetValuesStencil?</div></div></blockquote><div><br></div><div>Timothée Nicolas shows one in his reply.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Do I also need to use DMDAGetAO together with MatSetValuesStencil or MatSetValuesLocal?</div></div></blockquote><div><br></div><div>No.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks!</div></div>
</blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><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>
</font></span></div>
</blockquote></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>