fix: adding gocad export for structured grid support#286
Open
lachlangrose wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds export/visualisation support for structured grids: GOCAD VOXET export for StructuredGrid and VTK (pyvista) export for StructuredGrid2D, with accompanying unit tests and CI dependency updates.
Changes:
- Implement
StructuredGrid2D.vtk()returning a quad-cellpyvista.UnstructuredGrid. - Add GOCAD VOXET writer for
StructuredGridand route.save()for.vo/.gocad. - Expand unit tests for the new exports and add
pyvistato the CI conda install.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
LoopStructural/interpolators/supports/_2d_structured_grid.py |
Implements StructuredGrid2D.vtk() (PyVista unstructured grid with QUAD cells). |
LoopStructural/export/gocad.py |
Adds VOXET export implementation for StructuredGrid properties/cell_properties. |
LoopStructural/datatypes/_structured_grid.py |
Fixes maximum computation and adds .save() support for .vo/.gocad. |
tests/unit/interpolator/test_2d_discrete_support.py |
Adds VTK export assertions for 2D structured grid. |
tests/unit/datatypes/test__structured_grid.py |
Adds VOXET export tests for point/cell properties; minor formatting updates. |
.github/workflows/tester.yml |
Installs pyvista in CI so new VTK tests can run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+493
to
+496
| def vtk(self, z=0.0, *, node_properties={}, cell_properties={}): | ||
| """ | ||
| Create a vtk unstructured grid from the mesh | ||
| """ |
Comment on lines
1
to
+3
| from LoopStructural.interpolators import StructuredGrid2D | ||
| import numpy as np | ||
| import pyvista as pv |
| @@ -62,7 +63,7 @@ def maximum(self): | |||
| np.ndarray | |||
| Maximum coordinates (origin + nsteps * step_vector) | |||
Comment on lines
+121
to
+128
| for export_property in export_properties: | ||
| fp.write( | ||
| f"""PROPERTY {export_property['index']} {export_property['name']} | ||
| PROPERTY_CLASS {export_property['index']} {export_property['name']} | ||
| PROP_UNIT {export_property['index']} {export_property['name']} | ||
| PROPERTY_CLASS_HEADER {export_property['index']} {export_property['name']} {{ | ||
| }} | ||
| PROPERTY_SUBCLASS {export_property['index']} QUANTITY {export_property['storage_type']} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.