FEniCS / FEniCS/dolfinx

Add error check for out of bounds vertex indices in mesh generation

Open
#4,053 0 comments 0 reactions 0 assignees View on GitHub
housekeeping
Dominant language
C++
Stars
1.2k
Forks
261
Avg merge
1d 15h
Merged PRs (30d)
65

Description

Following MWE missed a mesh vertex in the definition of `x`. Crashes with a hard to debug error of
```console
MPI_ERR_RANK: invalid rank
```

```python
from mpi4py import MPI
import numpy as np
import ufl
import basix
import dolfinx
import basix.ufl

x = np.array([[1, 0], [2, 0]], dtype=np.float64) # missed [3, 0]
cells = np.array([[0, 1], [1, 2]], dtype=np.int64)

element = ufl.Mesh(basix.ufl.element("Lagrange", "interval", 1, shape=(2,)))
mesh = dolfinx.mesh.create_mesh(MPI.COMM_WORLD, cells, element, x) # <- crashes here

```

In a Debug build this hits the assertion in `MPI.h::index_owner`. A similar output should be available in `Release` - but not raised from `index_owner` due to performance impact - rather as an input argument check.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.