<div dir="ltr"><div dir="ltr">On Sat, Jul 25, 2020 at 4:10 AM Swarnava Ghosh <<a href="mailto:swarnava89@gmail.com">swarnava89@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">Dear Petsc users,<div><br></div><div>I had a trivial question about DMPlex. Suppose I have a 3D mesh of tetrahedrons. I want to find out the 3D coordinates of the vertices of a particular cell. What would be the function to do this?</div></div></blockquote><div><br></div><div>Lots of good responses. You can see that it is taking some time for canonical patterns to emerge as the "right way" to do something. The reason we provide</div><div>multiple layers of interface is that user codes rely on different abstractions and would like to interact with PETSc using different assumptions.</div><div><br></div><div>If you just want the coordinates of each vertex in some cell with the vertices in a canonical ordering, you can do as Mark suggested, with a slight modification:</div><div><br></div><div>DM plex, cdm;<br></div><div>Vec coordinates;</div><div><br></div><div>ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr);</div><div></div><div>ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr);</div><div>ierr = DMConvert(cdm, DMPLEX, &plex);CHKERRQ(ierr);<br>ierr = DMPlexVecGetClosure(plex, NULL, coordinates, cell, NULL, &coef);CHKERRQ(ierr);<br>....<br>ierr = DMPlexVecRestoreClosure(plex, NULL, coordinates, cell, NULL, &coef);CHKERRQ(ierr);<br></div><div><br></div><div>We get a local coordinate vector, because local vectors are guaranteed to store everything in the closure of anything in the Plex. Global vectors</div><div>are non-overlapping partitions, suitable for solvers, and might not have some of the values.</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="ltr"><div>Thank you,</div><div>SG</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>