Skip to content

refactor: BoundingBox.structured_grid returns a PropertyGrid - #370

Merged
lachlangrose merged 2 commits into
feature/property-grid-trilinearfrom
refactor/bounding-box-structured-grid-returns-property-grid
Nov 1, 2026
Merged

lachlangrose merged 2 commits into
feature/property-grid-trilinearfrom
refactor/bounding-box-structured-grid-returns-property-grid

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Draft, stacked. Built on the trilinear PR (so #368, #367, #366, #364, #363). The change here is the last commit, refactor: BoundingBox.structured_grid returns a PropertyGrid.

BoundingBox.structured_grid() returned the interpolation support, which has no properties dict, silently dropped cell_data / vertex_data, and had nsteps + 1 nodes per axis. It now returns a PropertyGrid whose nodes are exactly the points of regular_grid().

Change

  • Returns PropertyGrid(origin, step_vector=node_step_vector, nsteps=nsteps, ...); cell_data and vertex_data are stored (copied). With local_coordinates=True the grid spans the projected corners.
  • get_block_model, scalar_field and gradient_norm_scalar_field use it instead of building the grid by hand (their NOTE comments about the workaround are gone).
  • COMPAT.md row: the support's interpolation methods are no longer on the return value; node count per axis changes from nsteps + 1 to nsteps.

Tests

test_bounding_box_structured_grid.py (13 tests, two boxes): returns a PropertyGrid; nodes equal regular_grid(local=False, order="F"); the grid spans the box; cell_centres equal the box's; data is stored and copied; values computed at regular_grid() sit on the grid's nodes; the local-coordinates grid contains the rotated box.

  • packages/loop_common/tests: 247 passed; packages/loop_interpolation/tests: 606 passed; tests: 737 passed. ruff clean on changed files.

Compatibility

Checked in this repo only. Other repos on my machine that call it (loop-cgal examples: bb.structured_grid().vtk()) keep working, since PropertyGrid.vtk() exists. I have not checked the QGIS plugin or map2loop.

🤖 Generated with Claude Code

@lachlangrose
lachlangrose force-pushed the refactor/bounding-box-structured-grid-returns-property-grid branch from c1806aa to 5297d98 Compare November 1, 2026 05:51
@lachlangrose
lachlangrose changed the base branch from master to feature/property-grid-trilinear November 1, 2026 05:51
@lachlangrose
lachlangrose added this pull request to stack #385 November 1, 2026 05:52
@lachlangrose
lachlangrose force-pushed the refactor/bounding-box-structured-grid-returns-property-grid branch from 5297d98 to aae0074 Compare November 1, 2026 06:08
@lachlangrose
lachlangrose marked this pull request as ready for review November 1, 2026 06:10
lachlangrose and others added 2 commits November 1, 2026 17:24
It returned the interpolation support, which has no properties dict, silently dropped
cell_data / vertex_data and had nsteps + 1 nodes per axis. It now returns a PropertyGrid whose
nodes are the points of regular_grid(), so values computed at regular_grid() / cell_centres()
sit where the grid says they do. get_block_model, scalar_field and gradient_norm_scalar_field
use it instead of building the grid by hand.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the support

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@lachlangrose
lachlangrose force-pushed the refactor/bounding-box-structured-grid-returns-property-grid branch from aae0074 to 15ca12f Compare November 1, 2026 06:54
@lachlangrose
lachlangrose merged commit f70a4d6 into master Nov 1, 2026
37 checks passed
@lachlangrose
lachlangrose deleted the refactor/bounding-box-structured-grid-returns-property-grid branch November 1, 2026 06:54
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