Skip to content

Add Ugrid2d.to_pyvista method#419

Draft
Huite wants to merge 1 commit into
mainfrom
pyvista
Draft

Add Ugrid2d.to_pyvista method#419
Huite wants to merge 1 commit into
mainfrom
pyvista

Conversation

@Huite

@Huite Huite commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@Huite

Huite commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator Author

A note on performance: for a Voronoi grid with 200 000 cells (with 4 to 9 edges per face), 90% of the time is spent in the deduplication. That seems excessive; secondly, deduplication might even have better memory access patterns...

Another issue is maintaining the order of the elements, such that node or face data can be mapped to the pyvista grid directly. Since we know the number of elements in advance, we might pre-allocate everything and then scatter the elements immediately instead of the current concatenation approach.

@Huite

Huite commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator Author

Turns out VTK has grid.clean(), which is much faster!

I think the best solution is to pre-allocate everything, store the proper indices and write to the pre-allocated buffer directly in the order of the data (e.g. n_layer, n_face; or n_layer, n_node).

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 this pull request may close these issues.

1 participant