vibespatial.constructive.union_all

GPU-accelerated union/intersection reduction kernels.

Provides:
  • disjoint_subset_union_all: geometry collection assembly (no Boolean ops)

  • union_all_gpu: tree-reduction global union via pairwise overlay_union

  • coverage_union_all_gpu: coverage-optimized union (non-overlapping input)

  • intersection_all_gpu: tree-reduction global intersection with early termination

  • unary_union_gpu: thin wrapper -> union_all_gpu

For disjoint_subset, geometries are disjoint by assumption, so union is just geometry collection assembly – concatenate coordinate buffers and chain offset arrays. No Boolean geometry operations are performed.

For homogeneous input (all same family), the output is the corresponding Multi* family:

  • Point -> MultiPoint

  • LineString -> MultiLineString

  • Polygon -> MultiPolygon

  • Multi* -> Multi* (merge all parts into a single row)

For mixed families, falls back to Shapely CPU path.

ADR-0002: CONSTRUCTIVE class – fp64, no precision downgrade (coordinates are

exact subsets, no new coordinates created).

ADR-0033: Disjoint subset: pure CuPy buffer manipulation (Tier 2).

Tree-reduction: orchestrates Tier 1 overlay pipeline pairwise.

Attributes

Functions

disjoint_subset_union_all_owned(...)

Union all geometries by disjoint-subset assembly (no Boolean ops).

union_all_gpu_owned(...)

GPU tree-reduction global union of all rows into a single geometry.

coverage_union_all_gpu_owned(...)

GPU coverage-optimized union for non-overlapping input.

intersection_all_gpu_owned(...)

GPU tree-reduction global intersection of all rows.

unary_union_gpu_owned(...)

GPU unary_union -- thin wrapper around union_all_gpu.

Module Contents

vibespatial.constructive.union_all.cp = None
vibespatial.constructive.union_all.logger
vibespatial.constructive.union_all.disjoint_subset_union_all_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray | None

Union all geometries by disjoint-subset assembly (no Boolean ops).

Since geometries are disjoint by assumption, this concatenates all coordinate buffers and chains offset arrays to produce a single Multi* geometry.

Returns None when the input contains mixed geometry families that cannot be merged into a single Multi* type (e.g. Point + Polygon). The caller should fall through to the Shapely CPU path in that case.

Parameters

ownedOwnedGeometryArray

Input geometries (device- or host-resident).

dispatch_modeExecutionMode or str

Execution mode hint (AUTO, GPU, CPU).

precisionPrecisionMode or str

Precision mode. Stays fp64 per ADR-0002 (exact coord subsets).

Returns

OwnedGeometryArray or None

Single-row OGA containing all input geometries assembled into one, or None when the input has incompatible mixed families.

vibespatial.constructive.union_all.union_all_gpu_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, grid_size: float | None = None, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO, _skip_polygon_contraction: bool = False) vibespatial.geometry.owned.OwnedGeometryArray

GPU tree-reduction global union of all rows into a single geometry.

When grid_size is set, applies set_precision to the input first (snapping coordinates to the grid) before performing the union.

Parameters

ownedOwnedGeometryArray

Input geometries (device- or host-resident).

grid_sizefloat or None

Optional snap grid size. Applied before union via set_precision_owned.

dispatch_modeExecutionMode or str

Execution mode hint.

precisionPrecisionMode or str

Precision mode. CONSTRUCTIVE stays fp64 per ADR-0002.

Returns

OwnedGeometryArray

Single-row OGA containing the global union.

vibespatial.constructive.union_all.coverage_union_all_gpu_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

GPU coverage-optimized union for non-overlapping input.

Since the input is assumed to be non-overlapping (coverage property), the binary union of any pair will not produce new intersection vertices. This uses the same tree-reduction as union_all_gpu; the coverage property simply means the overlay is cheaper (no self-intersections to resolve).

Parameters

ownedOwnedGeometryArray

Input non-overlapping geometries (device- or host-resident).

dispatch_modeExecutionMode or str

Execution mode hint.

precisionPrecisionMode or str

Precision mode. CONSTRUCTIVE stays fp64 per ADR-0002.

Returns

OwnedGeometryArray

Single-row OGA containing the coverage union.

vibespatial.constructive.union_all.intersection_all_gpu_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

GPU tree-reduction global intersection of all rows.

Early termination: if any intermediate result is empty, returns empty immediately (since A intersect empty = empty for all A).

Parameters

ownedOwnedGeometryArray

Input geometries (device- or host-resident).

dispatch_modeExecutionMode or str

Execution mode hint.

precisionPrecisionMode or str

Precision mode. CONSTRUCTIVE stays fp64 per ADR-0002.

Returns

OwnedGeometryArray

Single-row OGA containing the global intersection.

vibespatial.constructive.union_all.unary_union_gpu_owned(owned: vibespatial.geometry.owned.OwnedGeometryArray, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

GPU unary_union – thin wrapper around union_all_gpu.

unary_union is deprecated in favour of union_all in Shapely 2.x but some codebases still use it. This provides the GPU path.

Parameters

ownedOwnedGeometryArray

Input geometries (device- or host-resident).

dispatch_modeExecutionMode or str

Execution mode hint.

precisionPrecisionMode or str

Precision mode.

Returns

OwnedGeometryArray

Single-row OGA containing the global union.