<div dir="ltr"><div dir="ltr">On Thu, Aug 15, 2019 at 10:59 AM Daniel Mckinnell via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="color:black;font:10pt arial">
<div style="font-family:arial,helvetica;font-size:10pt;color:black">
<div id="gmail-m_4572011321480561676yiv8682774075">
<div style="color:black;font:10pt arial">
<div><font size="2">Hi,</font></div>
<div><font size="2">Attached is a way I came up with to access data in a global vector, is this the best way to do this or are there other ways? It would seem intuitive to use the global PetscSection and VecGetValuesSection but this doesn't seem to work on global vectors.</font></div>
<div><font size="2"><br>
</font></div>
<div><font size="2">Instead I have used VecGetValues and </font><font size="2"><font size="2">VecSetValues</font>, however I also have a problem with these when extracting more than one value, I initialise the output of </font><font size="2"><font size="2">VecGetValues as PetscScalar *values; and then call </font></font><font size="2"><font size="2"><font size="2"><font size="2">VecGetValues(Other stuff... ,</font></font></font></font><font size="2"><font size="2"> values). This seems to work some times and not others and I can't find any rhyme or reason to it?</font></font></div></div></div></div></div></blockquote><div><br></div><div>I guess I should write something about this. I like to think of it as a sort of decision tree.</div><div><br></div><div>1) Get just local values, meaning those owned by this process</div><div><br></div><div> These can be obtained from either a local or global vector.</div><div><br></div><div>2) Get ghosted values, meaning those values lying on unowned points that exist in the default PetscSF</div><div><br></div><div> These can only get obtained from a local vector</div><div><br></div><div>3) Get arbitrary values</div><div><br></div><div> You must use a VecScatter or custom PetscSF to get these</div><div><br></div><div>For 1) and 2), I think the best way to get values normally is to use</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexPointLocalRef.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexPointLocalRef.html</a></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexPointGlobalRef.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexPointGlobalRef.html</a></div><div><br></div><div>These also have Read versions, and Field version to split off a particular field in the Section.</div><div><br></div><div> Does this help?</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="color:black;font:10pt arial"><div style="font-family:arial,helvetica;font-size:10pt;color:black"><div id="gmail-m_4572011321480561676yiv8682774075"><div style="color:black;font:10pt arial">
<div><font size="2">Finally I was wondering if there is a good reference code base on Github including DMPlex that would be helpful in viewing applications of the DMPlex functions?</font></div>
<div><font size="2">Thanks,</font></div>
<div><font size="2">Daniel Mckinnell</font><br>
<font size="2"><a rel="nofollow" name="m_4572011321480561676_VecGetValuesSection"></a></font></div>
</div>
</div>
</div>
</div>
</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>