FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
742 stars 178 forks source link

Fix DofMap::collapse() on rank with no dofs #3369

Closed jorgensd closed 1 month ago

jorgensd commented 1 month ago

Currently, collapsing a dofmap with no dofs on the process segfaults due to unsafe access of dofs_view.back(), as it might be empty.

This is unlikely to happen to "standard" meshes, but very likely to happen for sub-meshes.

Thanks to @RemDelaporteMathurin for providing me with a segfaulting code that I could distill down.