<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">在 2022年6月16日,23:22,Matthew Knepley <knepley@gmail.com> 写道:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Thu, Jun 16, 2022 at 11:11 AM Zongze Yang <<a href="mailto:yangzongze@gmail.com">yangzongze@gmail.com</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 dir="ltr"><div>Hi, if I load a `gmsh` file with second-order elements, the coordinates will be stored in a DG-P2 space. After obtaining the coordinates of a cell, how can I map the coordinates to vertex and edge? </div></div></blockquote><div><br></div><div>By default, they are stored as P2, not DG.</div></div></div></div></blockquote><div><br></div><div>I checked the coordinates vector, and found the dogs only defined on cell other than vertex and edge, so I said they are stored as DG.</div><div>Then the function <a href="https://petsc.org/main/docs/manualpages/DMPLEX/DMPlexVecGetClosure/">DMPlexVecGetClosure</a> seems return the coordinates in lex order.</div><div><br></div><div>Some code in reading gmsh file reads that</div><div><br></div><div><br></div><div><p class="p1" style="margin: 0px; font-stretch: normal; font-size: medium; line-height: normal; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 16px;">1756:    <span class="Apple-converted-space"> </span>if (isSimplex) continuity = <a href="https://petsc.org/main/docs/manualpages/Sys/PETSC_FALSE/"><span class="s2">PETSC_FALSE</span></a>; /* XXX FIXME Requires DMPlexSetClosurePermutationLexicographic() */</span></p><p class="p2" style="margin: 0px; font-stretch: normal; font-size: medium; line-height: normal; min-height: 21px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 16px;"></span><br></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: medium; line-height: normal; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 16px;">1758:    <span class="Apple-converted-space"> </span>GmshCreateFE(comm, NULL, isSimplex, continuity, nodeType, dim, coordDim, order, &fe)</span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: medium; line-height: normal; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 16px;"><br></span></p><p class="p1" style="margin: 0px; font-stretch: normal; font-size: medium; line-height: normal; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit-text-size-adjust: auto;"><span class="s1" style="font-size: 16px;">The continuity is set to false for simplex.</span></p></div><div><br></div><div>Thanks,</div><div>Zongze</div><div><br></div><div><br></div><br><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>You can ask for the coordinates of a vertex or an edge directly using</div><div><br></div><div>  <a href="https://petsc.org/main/docs/manualpages/DMPLEX/DMPlexPointLocalRead/">https://petsc.org/main/docs/manualpages/DMPLEX/DMPlexPointLocalRead/</a></div><div><br></div><div>by giving the vertex or edge point. You can get all the coordinates on a cell, in the closure order, using</div><div><br></div><div>  <a href="https://petsc.org/main/docs/manualpages/DMPLEX/DMPlexVecGetClosure/">https://petsc.org/main/docs/manualpages/DMPLEX/DMPlexVecGetClosure/</a></div></div></div></div></blockquote><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><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 dir="ltr"><div>Below is some code load the gmsh file, I want to know the relation between `cl` and `cell_coords`.</div><div><br></div>```<div>import firedrake as fd<br>import numpy as np<br><br># Load gmsh file (2rd)<br>plex = fd.mesh._from_gmsh('test-fd-load-p2-rect.msh')<br><br>cs, ce = plex.getHeightStratum(0)<br><br>cdm = plex.getCoordinateDM()<br>csec = dm.getCoordinateSection()<br>coords_gvec = dm.getCoordinates()<br><br>for i in range(cs, ce):<br>    cell_coords = cdm.getVecClosure(csec, coords_gvec, i)<br>    print(f'coordinates for cell {i} :\n{cell_coords.reshape([-1, 3])}')<br>    cl = dm.getTransitiveClosure(i)<br>    print('closure:', cl)<br>    break</div><div>```<br clear="all"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><br></div><div dir="ltr">Best wishes,</div></div><div>Zongze</div></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>
</div></blockquote></body></html>