<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Thanks!<br>
</p>
<div class="moz-cite-prefix">On 11/30/18 9:28 PM, Matthew Knepley
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAMYG4GmwUo-GF1A9yYUH34POi9B32T6nJ0cCN1dvkS9UwnoUvA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Fri, Nov 30, 2018 at 8:19 AM barry via
petsc-users <<a
href="mailto:petsc-users@mcs.anl.gov"
moz-do-not-send="true">petsc-users@mcs.anl.gov</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">
<div bgcolor="#FFFFFF"> Sorry for the imprecisely
description.
<p>I have an unstructured grid (DMPLEX) with
triangle mesh.</p>
<p>cell number (2 dim)={0}; line number (1
dim)={1, 2, 3}; node number (0 dim)={4, 5, 6}</p>
</div>
</blockquote>
<div>So, you have a 2D interpolated simplex mesh in
DMPlex, which means it has vertices, edges, and cells.</div>
<div>If you want the vertices on a given cell, you would
get the closure and then filter out any points which
are</div>
<div>not vertices. For example,</div>
<div><br>
</div>
<div>PetscInt *closure = NULL;</div>
<div>PetscInt clSize, cl;</div>
<div><br>
</div>
<div>
<div>ierr = DMPlexGetDepthStratum(dm, 0, &vStart,
&vEnd);CHKERRQ(ierr);</div>
</div>
<div>
<div>ierr = DMPlexGetTransitiveClosure(dm, cell,
PETSC_TRUE, &clSize,
&closure);CHKERRQ(ierr);</div>
</div>
<div>for (cl = 0; cl < clSize*2; cl += 2) {</div>
<div> const PetscInt point = closure[cl];</div>
<div><br>
</div>
<div> if (point >= vStart && point <
vEnd) {</div>
<div> <this is a vertex></div>
<div> }</div>
<div>}</div>
<div>
<div>ierr = DMPlexRestoreTransitiveClosure(dm, cell,
PETSC_TRUE, &clSize,
&closure);CHKERRQ(ierr);</div>
</div>
<div><br>
</div>
<div>If you do not use edges, then its much easier. Just
call DMPlexGetCone(). If you do use edges, but also</div>
<div>get the vertices all the time, you can make an
index for this query, which will speed it up greatly
at the</div>
<div>cost of some memory.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Thank you,</p>
<p>Barry<br>
</p>
<div
class="gmail-m_-3541176372144564405moz-cite-prefix">On
11/30/18 8:33 PM, Stefano Zampini wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">
<div><br>
<br>
<div class="gmail_quote">
<div dir="ltr">Il giorno Ven 30 Nov 2018,
15:05 Tsung-Hsing Chen via petsc-users
<<a
href="mailto:petsc-users@mcs.anl.gov"
target="_blank" moz-do-not-send="true">petsc-users@mcs.anl.gov</a>>
ha scritto:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi,
<div>Is there any function that can get
cell number from the given node number
exist already?</div>
</div>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Cell number of what? DMPLEX? And
what is "node number"?</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<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 dir="ltr">
<div><br>
</div>
<div>Thank you,</div>
<div>Barry</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</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" moz-do-not-send="true">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</body>
</html>