[petsc-users] Element connectivity of a DMPlex

Noam T. dontbugthedevs at proton.me
Thu May 22 11:25:48 CDT 2025


Hello,

Thank you the various options.

Use case here would be obtaining the exact output generated by option 1), DMView() with PETSC_VIEWER_HDF5_VIZ; in particular, the matrix generated under /viz/topology/cells.

> There are several ways you might do this. It helps to know what you are aiming for.
>
> 1) If you just want this output, it might be easier to just DMView() with the PETSC_VIEWER_HDF5_VIZ format, since that just outputs the cell-vertex topology and coordinates

Is it possible to get this information in memory, onto a Mat, Vec or some other Int array object directly? it would be handy to have it in order to manipulate it and/or save it to a different format/file. Saving to an HDF5 and loading it again seems redundant.

> 2) You can call DMPlexUninterpolate() to produce a mesh with just cells and vertices, and output it in any format.
>
> 3) If you want it in memory, but still with global indices (I don't understand this use case), then you can use DMPlexCreatePointNumbering() for an overall global numbering, or DMPlexCreateCellNumbering() and DMPlexCreateVertexNumbering() for separate global numberings.

Perhaps I missed it, but getting the connectivity matrix in /viz/topology/cells/ did not seem directly trivial to me from the list of global indices returned by DMPlexGetCell/Point/VertexNumbering() (i.e. I assume all the operations done when calling DMView()).

Thanks,
Noam.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250522/33d99d69/attachment-0001.html>


More information about the petsc-users mailing list