Skip to content

bloqade.lanes.arch.geometry.ArchSpecGeometry

← Module overview

classArchSpecGeometrysource

bloqade.lanes.arch.geometry.ArchSpecGeometry

Geometry-level query helper wrapping an ArchSpec.

class ArchSpecGeometry(arch_spec: 'ArchSpec | _RustArchSpec')

Provides methods for retrieving coordinate grids, flat site lists, and bus descriptors from an architecture specification. Intended for downstream consumers who need geometry-level data without walking Rust zone objects directly.

Accepts either a Python ArchSpec or a raw Rust _RustArchSpec object, so it can be constructed from either layer of the stack.

Parameters

NameTypeDescription
arch_spec'ArchSpec | _RustArchSpec'

methodget_zone_gridsource

bloqade.lanes.arch.geometry.ArchSpecGeometry.get_zone_grid

def get_zone_grid(zone_id: int) -> GeoGrid

Get the coordinate grid for a zone as a bloqade.geometry.Grid.

Parameters

NameTypeDescription
zone_idintZone index.

Returns

(GeoGrid, GeoGrid)A ``bloqade.geometry.dialects.grid.Grid`` with the zone's x and y positions.

Raises

TypeDescription
ValueErrorIf zone_id is out of range.
source

methodget_all_sitessource

bloqade.lanes.arch.geometry.ArchSpecGeometry.get_all_sites

def get_all_sites() -> list[tuple[float, float]]

Get all site positions across all zones in canonical order.

Returns positions in zone-major order, with each zone flattened in column-major grid order (x outer, y inner). Each position is an (x, y) tuple.

Returns

list[tuple[float, float]]

source

methodget_available_busessource

bloqade.lanes.arch.geometry.ArchSpecGeometry.get_available_buses

def get_available_buses(zone_id: int) -> list[BusDescriptor]

Enumerate all valid bus descriptors for a zone.

Parameters

NameTypeDescription
zone_idintZone index.

Returns

(list[BusDescriptor], list[BusDescriptor])List of ``BusDescriptor`` for each (bus_id, move_type, direction) combination that has at least one lane in this zone.

Raises

TypeDescription
ValueErrorIf zone_id is out of range.
source

methodget_grid_endpointssource

bloqade.lanes.arch.geometry.ArchSpecGeometry.get_grid_endpoints

Signature
def get_grid_endpoints(zone_id: int, bus_id: int, move_type: MoveType, direction: Direction) -> tuple[GeoGrid, GeoGrid]

Get start and end grids for a bus move at full occupancy.

Returns two bloqade.geometry.Grid objects representing the source and destination positions for all lanes in the specified bus group.

Parameters

NameTypeDescription
zone_idintZone index.
bus_idintBus index within the zone.
move_typeMoveTypeSITE or WORD.
directionDirectionFORWARD or BACKWARD.

Returns

(GeoGrid, GeoGrid)``(src_grid, dst_grid)`` where each grid contains the physical positions of all source/destination sites for this bus.

Raises

TypeDescription
ValueErrorIf zone_id or bus_id is out of range, or move_type is not SITE or WORD.
source