dolfinx
dolfinx copied to clipboard
[BUG]: `create_entity_permutations` occasionally segfaults for prism meshes
Summarize the issue
Calling create_entity_permutations occasionally segfaults for prism meshes. For some reason, I can only reproduce this on a clean Ubuntu install, it seems to run without failing on the docker images and on my local install.
How to reproduce the bug
Run the minimal example below on a minimal Ubuntu install as described in the build and test workflow here.
Minimal Example (Python)
from mpi4py import MPI
from dolfinx import mesh
n = 3
msh = mesh.create_unit_cube(MPI.COMM_WORLD, n, n, n, cell_type=mesh.CellType.prism)
msh.topology.create_entity_permutations()
Output (Python)
No response
Version
main branch
DOLFINx git commit
No response
Installation
Follow the build and run workflow file here using a plain Ubuntu image.
Additional information
No response
I can reproduce this bug.
I think it stems from compute_face_permutations in permutationcomputation.cpp where there are separate computations for simplices and 'tp' elements. However, I don't think prism is being properly treated.
Yes, confirmed: using auto f_to_v = topology.connectivity(2, 0); is not enough for prism cells, now they contain two types of facet, we need to use auto f0_to_v = topology.connectivity({2, 0}, {0, 0}); and auto f1_to_v = topology.connectivity({2, 1}, {0, 0});
Probably this function (compute_face_permutations) needs general refactoring.
Fixed by #3223