<div dir="ltr"><div dir="ltr">On Thu, Jun 16, 2022 at 12:06 PM 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="auto"><div dir="ltr"></div><div dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">在 2022年6月16日,23:22,Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> 写道:<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" target="_blank">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/" target="_blank">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 style="margin:0px;font-stretch:normal;font-size:medium;line-height:normal;color:rgb(0,0,0)"><span style="font-size:16px">1756: <span> </span>if (isSimplex) continuity = <a href="https://petsc.org/main/docs/manualpages/Sys/PETSC_FALSE/" target="_blank"><span>PETSC_FALSE</span></a>; /* XXX FIXME Requires DMPlexSetClosurePermutationLexicographic() */</span></p><p style="margin:0px;font-stretch:normal;font-size:medium;line-height:normal;min-height:21px;color:rgb(0,0,0)"><span style="font-size:16px"></span><br></p><p style="margin:0px;font-stretch:normal;font-size:medium;line-height:normal;color:rgb(0,0,0)"><span style="font-size:16px">1758: <span> </span>GmshCreateFE(comm, NULL, isSimplex, continuity, nodeType, dim, coordDim, order, &fe)</span></p><p style="margin:0px;font-stretch:normal;font-size:medium;line-height:normal;color:rgb(0,0,0)"><span style="font-size:16px"><br></span></p><p style="margin:0px;font-stretch:normal;font-size:medium;line-height:normal;color:rgb(0,0,0)"><span style="font-size:16px">The continuity is set to false for simplex.</span></p></div></div></blockquote><div><br></div><div>Oh, yes. That needs to be fixed. For now, you can just project it to P2 if you want using</div><div><br></div><div> <a href="https://petsc.org/main/docs/manualpages/DM/DMProjectCoordinates/">https://petsc.org/main/docs/manualpages/DM/DMProjectCoordinates/</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"><div dir="auto"><div>Thanks,</div><div>Zongze</div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><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/" target="_blank">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/" target="_blank">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"><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></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>