dolfinx icon indicating copy to clipboard operation
dolfinx copied to clipboard

[BUG]: `create_entity_permutations` occasionally segfaults for prism meshes

Open jpdean opened this issue 1 year ago • 2 comments

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

jpdean avatar May 13 '24 14:05 jpdean

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.

chrisrichardson avatar May 17 '24 15:05 chrisrichardson

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.

chrisrichardson avatar May 17 '24 16:05 chrisrichardson

Fixed by #3223

chrisrichardson avatar May 21 '24 05:05 chrisrichardson