Skip to content

fix: adding gocad export for structured grid support#286

Open
lachlangrose wants to merge 5 commits into
masterfrom
export/gocad-vo
Open

fix: adding gocad export for structured grid support#286
lachlangrose wants to merge 5 commits into
masterfrom
export/gocad-vo

Conversation

@lachlangrose
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-cell pyvista.UnstructuredGrid.
  • Add GOCAD VOXET writer for StructuredGrid and route .save() for .vo/.gocad.
  • Expand unit tests for the new exports and add pyvista to 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']}
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.

2 participants