PhysicsNeMo-Mesh: Adds new capability of Polyhedra triangulation in PyVista/VTU I/O#1469
Conversation
- Updated the handling of UnstructuredGrid meshes to utilize the celltypes array instead of cells_dict, improving compatibility with variable-length polyhedra. - Adjusted error messages and test cases to reflect the new attribute usage. - Renamed tessellation references to triangulation for clarity in the context of mesh conversion.
Greptile SummaryThis PR fixes VTK_POLYHEDRON support in the PyVista I/O layer by replacing Key changes and observations:
Important Files Changed
Last reviewed commit: a2d8cdb |
…or 3D meshes, improving error handling and clarity in mesh validation.
- Implemented `to_edge_graph`, `to_dual_graph`, and `to_point_cloud` methods to facilitate the extraction of edge graphs, dual graphs, and point clouds from the Mesh class. - Each method includes detailed docstrings with examples for better usability. - Added comprehensive unit tests to validate the functionality of the new methods, ensuring correct edge and dual graph generation from various mesh configurations.
…e dimension detection - Updated the logic for passing cell data to ensure compatibility with varying manifold dimensions and native mesh dimensions. - Improved the detection of native dimensions by adding checks for line types, enhancing the robustness of the function. - Clarified comments to better explain the conditions under which cell data can be passed through.
- Introduced a new `force_copy` parameter to control whether point and cell arrays are copied, allowing the returned Mesh to own its memory independently of the source PyVista mesh. - Updated documentation to clarify the implications of this parameter on memory sharing and data mutation. - Enhanced the logic for determining manifold dimensions and improved error handling for ambiguous mesh types.
|
Hey @peterdsharpe - What are you thinking to do with this? I wasn't able to test successfully on the high lift dataset because, as you know, it timed out with 100M + polyhedra 😬 . It seems like a really nice path to go down though, maybe there is a way to implement these polyhedra -> simplex conversion we can vectorize and actually finish before the heat death of the universe? |
|
Yeah, upon further testing with the high lift aero dataset (192 million polyhedra cells per VTU mesh), this is probably still not scalable :( However, hopefully this will still be useful for others processing more-typical smaller meshes (a few million cells?). Moreover, this PR also provides a few other features, beyond just polyhedra I/O handling:
|
…vista.py - Updated matplotlib to version 3.10.8 and pyvista to version 0.47.0 in the mesh-extras section of pyproject.toml. - Added vtk version requirement to the _build_dual_graph_edges function in io_pyvista.py, improving module import handling with importlib for better compatibility.
- Enhanced test classes for edge graph, dual graph, and point cloud extraction with comprehensive docstrings explaining their functionality and verification processes. - Improved clarity on the expected behavior and data handling in the tests for better maintainability and understanding.
|
/blossom-ci |
coreyjadams
left a comment
There was a problem hiding this comment.
I am using this in production so it seems to be working!
LGTM
|
/blossom-ci |
ktangsali
left a comment
There was a problem hiding this comment.
Approving the changes to the TOML and lock file.
|
/blossom-ci |
|
/blossom-ci |
…ell, and global data. This change ensures compatibility with PyVista DataSetAttributes by converting them to plain dictionaries before assignment.
|
/blossom-ci |
PhysicsNeMo Pull Request
To import VTK meshes (typically VTU unstructured grid files) into PhysicsNeMo-Mesh, all cells need to be converted to simplices - in 3D, this means tetrahedra. While this can be readily accomplished for hexahedra, wedges, pyramids, prisms, etc., polyhedra are notoriously difficult. When we say "polyhedra", we're referring to VTK's most-generic-possible cell type, which allows for arbitrary face connectivity.
These are difficult to process because there are very few geometric guarantees that you can make about how many tets each polyhedron needs to decompose into.
This PR fixes that, and adds tests to verify correctness by asserting that various geometric invariants hold across this conversion.
A direct consequence of this is that we can now support conversion for the High Lift Aero dataset internally. @coreyjadams
Description
Checklist
Dependencies
Review Process
All PRs are reviewed by the PhysicsNeMo team before merging.
Depending on which files are changed, GitHub may automatically assign a maintainer for review.
We are also testing AI-based code review tools (e.g., Greptile), which may add automated comments with a confidence score.
This score reflects the AI’s assessment of merge readiness and is not a qualitative judgment of your work, nor is
it an indication that the PR will be accepted / rejected.
AI-generated feedback should be reviewed critically for usefulness.
You are not required to respond to every AI comment, but they are intended to help both authors and reviewers.
Please react to Greptile comments with 👍 or 👎 to provide feedback on their accuracy.