<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 12, 2017 at 3:48 AM, Lawrence Mitchell <span dir="ltr"><<a href="mailto:lawrence.mitchell@imperial.ac.uk" target="_blank">lawrence.mitchell@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br>
> On 12 May 2017, at 04:57, 李季 <<a href="mailto:leejearl@126.com">leejearl@126.com</a>> wrote:<br>
><br>
> Hi developers:<br>
>     I have such a question that I want to get the vertices of a cell. I know I can get the points by<br>
>     1. Getting the faces of a cell such as "DMPlexGetCone(dm, c, &faces";<br>
>     2. Getting the vertices of every face of the cell such as "DMPlexGetCone(dm, f, &vertices)".<br>
><br>
>     Then I can obtain the vertices belongs to a cell. Is there any concise routine which I can choose to get the<br>
> vertices of a cell directly?<br>
<br>
</span>You should use the interface for the transitive closure.<br>
<br>
Find bounds of points that are vertices:<br>
<br>
DMPlexGetDepthStratum(dm, &vStart, &vEnd);<br>
<br>
...<br>
DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &nclosure, &closure);<br>
for (PetscInt i = 0; i < nclosure; i++) {<br>
    const PetscInt p = closure[2*i];<br>
    if (p >= vStart && p < vEnd) {<br>
        p is a vertex<br>
    }<br>
}<br>
<br>
This works regardless of the topological dimension of the "cell" point you are using (the same code is good to find the vertices in the closure of a facet, say).<br>
<br>
Matt's course notes (<a href="http://www.caam.rice.edu/~caam519/CSBook.pdf" rel="noreferrer" target="_blank">http://www.caam.rice.edu/~<wbr>caam519/CSBook.pdf</a>) have nice pictures that help understand this language in section 7.1.<br></blockquote><div><br></div><div>Also note that this is fine for getting vertices if you want to do topological things. However, if what you really want is</div><div>some function over the vertices (like coordinates), you should use</div><div><br></div><div>  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexVecGetClosure.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexVecGetClosure.html</a></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">
Cheers,<br>
<br>
Lawrence</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>