Skip to content

Locating in grids with hidden or refined cells: extracted and re-binned on every call #402

Open

Description

@berkgeveci

probe, voxelize, advect, streamlines and temporal advection (Pathlines, Streaklines) call ghosts.visible() on a dataset with hidden or refined cells (Ghosts.MASKED_CELLS). That extracts the other cells into an unstructured copy, and the copy then gets a cell locator of its own. Every AMR box below the finest level has refined cells, so nearly every box takes this path; so does a blanked VTK grid (HIDDENCELL from blanking).

What it costs.

  • On every call. The copy has explicit connectivity (8 ids a hexahedron). Its positions become stored (an image's UniformCoordinates are materialized), and every field is carried, not only the one probed.
  • The locator is rebuilt each time. The topology keeps its locator (cached_locator), but the copy is a new topology every call, so a new CellLocator (boxes and bins) is built every time.
  • Repeated calls multiply it:
    • voxelize probes once per 4M-sample batch;
    • temporal RK4 makes about ten velocity probes per substep, each re-extracting and re-binning both steps;
    • VTK's Probe (interop/vtk/algorithms.py) probes per target piece and per Update(), against its docstring's promise that locators are built once.
  • No reuse. A locator passed in is refused on masked data (refuse_hidden(..., "probe with a locator"), and likewise for advect and streamlines).
  • Over pieces. _probe_pieces and advection's _rounds do this for every piece on every call.

Proposal. Leave masked cells out of the search itself:

  • The point search (by_id._MeshSearch.find_ranked, its find_from, and the cell-side search _test_points) skips candidate cells whose mark is masked, reading the marks as advection's handoff already does (_advection.py, ghosts[best]).
  • probe, advect, streamlines and the pieces paths then take the dataset as it is: one topology, its cached locator kept across calls, a locator given accepted.
  • On a structured box, the arithmetic locator of Locate cells of images and rectilinear grids by arithmetic (#371) #400 (CellLocator.structured, by_id._GridSearch) applies too.

To hold.

  • The same answers as now: a point in a masked cell is found in an unmasked neighbour within its tolerance, or nowhere, and the results are bit for bit.
  • Over pieces, the existing tie rules (holds, which already reads SKIPPED_CELLS).

This is most of #358 (AMR probing about 10x a single box per point).

Found while surveying ghost-driven slow paths for #316 (#401).

Activity

  1. self-assigned this
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions