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] Reading VTU only gets last piece #1444

Open
cbosoft opened this issue Nov 23, 2023 · 0 comments
Open

[BUG] Reading VTU only gets last piece #1444

cbosoft opened this issue Nov 23, 2023 · 0 comments

Comments

@cbosoft
Copy link

cbosoft commented Nov 23, 2023

Describe the bug
Reading a VTU file only gives the cells from the last piece.

To Reproduce
A minimal code example that reproduces the problem would be a big help if you can provide it. Attach a small mesh file if necessary.

Open a VTU file with multiple pieces. mesh.cells will show only a single piece

I've tracked the issue to a small typo in src/meshio/vtu/_vtu.py, function _organize_cells lines 154 and 155 need indenting in once more to be within the loop above.

        for offset, cls, cdr in zip(point_offsets, cells, cell_data_raw):
            cls, cell_data = vtk_cells_from_data(
                cls["connectivity"].ravel(),
                cls["offsets"].ravel(),
                cls["types"].ravel(),
                cdr,
            )

        for c in cls:
            out_cells.append(CellBlock(c.type, c.data + offset))

to become

        for offset, cls, cdr in zip(point_offsets, cells, cell_data_raw):
            cls, cell_data = vtk_cells_from_data(
                cls["connectivity"].ravel(),
                cls["offsets"].ravel(),
                cls["types"].ravel(),
                cdr,
            )

            for c in cls:
                out_cells.append(CellBlock(c.type, c.data + offset))

Let me know if you want me to draft a PR or anything.

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

No branches or pull requests

1 participant