[petsc-users] How to find the map between the high order coordinates of DMPlex and vertex numbering?

Zongze Yang yangzongze at gmail.com
Thu Jun 16 10:11:32 CDT 2022

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?

Below is some code load the gmsh file, I want to know the relation between
`cl` and `cell_coords`.

import firedrake as fd
import numpy as np

# Load gmsh file (2rd)
plex = fd.mesh._from_gmsh('test-fd-load-p2-rect.msh')

cs, ce = plex.getHeightStratum(0)

cdm = plex.getCoordinateDM()
csec = dm.getCoordinateSection()
coords_gvec = dm.getCoordinates()

for i in range(cs, ce):
    cell_coords = cdm.getVecClosure(csec, coords_gvec, i)
    print(f'coordinates for cell {i} :\n{cell_coords.reshape([-1, 3])}')
    cl = dm.getTransitiveClosure(i)
    print('closure:', cl)

Best wishes,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220616/21fb60a9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-fd-load-p2-rect.msh
Type: application/octet-stream
Size: 189254 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220616/21fb60a9/attachment-0001.obj>

More information about the petsc-users mailing list