[petsc-users] Element connectivity of a DMPlex
Noam T.
dontbugthedevs at proton.me
Mon May 19 17:57:33 CDT 2025
Hello,
I am trying to build the connectivity matrix for a mesh; i.e. the indices of the nodes that compose each cell.
Example:
0-------1
|.\.....|
|...\...|
|.....\.|
3-------2
the matrix would look like [ [0, 3, 2], [2, 1, 0] ] (possibly different ordering).
One option is using DMPlexGetTransitiveClosure, and accessing the last elements in the output "points", which contain the vertex indices.
However, these indices are local per process (both for vertices and cells). Is it possible to get the global indices?
I tried a mapping, as in example 14f (https://urldefense.us/v3/__https://petsc.org/release/src/ksp/ksp/tutorials/ex14f.F90.html__;!!G_uCfscf7eWS!ezMKlDED-8WxXpg_Elxus7WhYkZzCA5OmmLe6vHZGFoj4se5S5RD5ZgTrC3TYErx8znYKebSW-s0H0mt1_MEMAzpmFDwr0PH$ )
---
DM :: dm
ISLocalToGlobalMapping :: ltog_map
PetscInt, pointer :: ltog_idx(:)
! ...
! Create a dm from a mesh file
! ...
DMGetLocalToGlobalMapping(dm,ltog_map,ierr)
ISLocalToGlobalMappingGetIndices(ltog_map, ltog_idx, ierr)
---
but the returned array ltog is empty (ISLocalToGlobalMappingGetSize() returns zero). Are there other functions calls needed before being able to create this mapping? Or is this mapping simply not usable in this case?
Is there perhaps better/simpler way to get this connectivity?
Thank you.
Noam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250519/3f13b85e/attachment.html>
More information about the petsc-users
mailing list