Geometry
Geometry-level query helpers for ArchSpec.
This module provides :class:ArchSpecGeometry, a helper class for downstream
consumers who want geometry-level queries (grids, flat site lists, bus
descriptors) without walking Rust zone objects directly.
The class accepts either a Python :class:~bloqade.lanes.arch.spec.ArchSpec
wrapper or a raw Rust _RustArchSpec object, so it can be used at either
layer of the stack.
ArchSpecGeometry
ArchSpecGeometry(arch_spec: 'ArchSpec | _RustArchSpec')
Geometry-level query helper wrapping an ArchSpec.
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 :class:~bloqade.lanes.arch.spec.ArchSpec or a
raw Rust _RustArchSpec object, so it can be constructed from either
layer of the stack.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
49 50 51 52 53 | |
get_all_sites
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.
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
79 80 81 82 83 84 85 86 87 88 89 90 91 | |
get_available_buses
get_available_buses(zone_id: int) -> list[BusDescriptor]
Enumerate all valid bus descriptors for a zone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
Returns:
| Type | Description |
|---|---|
list[BusDescriptor]
|
List of |
list[BusDescriptor]
|
combination that has at least one lane in this zone. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id is out of range. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
get_grid_endpoints
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:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
bus_id
|
int
|
Bus index within the zone. |
required |
move_type
|
MoveType
|
SITE or WORD. |
required |
direction
|
Direction
|
FORWARD or BACKWARD. |
required |
Returns:
| Type | Description |
|---|---|
Grid
|
|
Grid
|
positions of all source/destination sites for this bus. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id or bus_id is out of range, or move_type is not SITE or WORD. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
get_zone_grid
get_zone_grid(zone_id: int) -> GeoGrid
Get the coordinate grid for a zone as a bloqade.geometry.Grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zone_id
|
int
|
Zone index. |
required |
Returns:
| Type | Description |
|---|---|
Grid
|
A |
Grid
|
x and y positions. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If zone_id is out of range. |
Source code in .venv/lib/python3.12/site-packages/bloqade/lanes/arch/geometry.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
BusDescriptor
dataclass
BusDescriptor(
bus_id: int,
move_type: MoveType,
direction: Direction,
num_lanes: int,
)
Descriptor for a bus within a zone.