nschloe/meshio

[BUG]

nikolasborrel opened this issue · 1 comments

Describe the bug
ParaView crashed when loading a XDMF file generated with the TimeSeriesWriter.

To Reproduce
Run the code below (from the documention) and load the generated file into ParaView 5.10.1

import meshio
import numpy as np

filename = "test.xdmf"
# 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 = [
    ("triangle", [[0, 1, 2], [1, 3, 2]]),
    ("quad", [[1, 4, 5, 3]]),
]

data=np.array([0.3, -1.2, 0.5, 0.7, 0.0, -3.0])
with meshio.xdmf.TimeSeriesWriter(filename) as writer:
    writer.write_points_cells(points, cells)
    for t in [0.0, 0.1, 0.21]:
        writer.write_data(t, point_data={"data": data})

Diagnose
ParaView crashes when loading the generated XDMF file.

I figured out that the .h5 is being saved in another location and hence was not in the same folder as the xdmf file. In this case it works.

Saving the .h5 in a wrong location is a bug in the library, caused by also stripping the path when creating the *.h5 filename.