Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] crash when writing xdmf file with "line" cells #1462

Open
gpbonneau opened this issue Feb 28, 2024 · 0 comments · May be fixed by #1464
Open

[BUG] crash when writing xdmf file with "line" cells #1462

gpbonneau opened this issue Feb 28, 2024 · 0 comments · May be fixed by #1464

Comments

@gpbonneau
Copy link

gpbonneau commented Feb 28, 2024

Describe the bug

meshio crashes when writing a mesh containing "line" cells in xdmf format.

To Reproduce

import meshio
import numpy as np

# three lines, two triangles and one quad
points = [
    [0.0, 0.0],
    [1.0, 0.0],
    [0.0, 1.0],
    [1.0, 1.0],
    [2.0, 0.0],
    [2.0, 1.0],
]
cells = [
    ("line", [[0,1], [1,2], [2,3]]),
    ("triangle", [[0, 1, 2], [1, 3, 2]]),
    ("quad", [[1, 4, 5, 3]]),
]

nPoint = len(points)
with meshio.xdmf.TimeSeriesWriter("foo.xdmf") as writer:
    writer.write_points_cells(points, cells)
    for t in [0.0, 0.1, 0.21]:
        data = np.full( nPoint, t)
        writer.write_data(t, point_data={"phi": data})

executing the above code produces a crash with the following error messages:

Traceback (most recent call last):
  File "[...]/meshioWriteXdmf.py", line 21, in <module>
    writer.write_points_cells(points, cells)
  File "[...]/site-packages/meshio/xdmf/time_series.py", line 291, in write_points_cells
    self.cells(cells, grid)
  File "/[...]/site-packages/meshio/xdmf/time_series.py", line 413, in cells
    c.data[:] = np.insert(c.data, 0, 2, axis=1)
    ~~~~~~^^^

Diagnose
I may ask you to cut and paste the output of the following command.

pip freeze | grep meshio
meshio @ file:///home/conda/feedstock_root/build_artifacts/meshio_1706720595231/work

Did I help?

Thank you in advance for your help. Vielen Dank im voraus.

If I was able to resolve your problem, consider sponsoring my work on meshio, or buy me a coffee to say thanks.

@kaiserls kaiserls linked a pull request Mar 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant