Skip to content

Commit 5e998f2

Browse files
authored
Remove unnecessary/premature subcomponent build in CompositeComponent geometry (#63)
1 parent f68d124 commit 5e998f2

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format of this changelog is based on
77
## Upcoming
88

99
- Added `set_periodic!` to `SolidModels` to enable periodic meshes
10+
- `CompositeComponent` geometry now preserves subcomponents instead of replacing them with `CoordinateSystem`s, unless `build!` is called explicitly on the composite component's schematic or the parent schematic
1011
- Minor documentation improvements
1112

1213
### Fixed

docs/src/examples/qpu17.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ nothing # hide
2020
<img src="../qpu17.png"/>
2121
```
2222

23-
Note that the timings above are around 90% compilation. If we wanted to tweak some parameters and then run the script again in the same Julia session, then it would take around 10% as long:
23+
Note that the timings above are around 95% compilation. If we wanted to tweak some parameters and then run the script again in the same Julia session, then it would take around 5% as long:
2424

2525
```@example 1
2626
@time "Total" schematic, artwork = DemoQPU17.qpu17_demo(savegds=false)

src/schematics/ExamplePDK/components/Transmons/star_island.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,20 @@ function SchematicDrivenLayout.hooks(isl::ExampleStarIsland)
151151
z=HandedPointHook(rotate(h, π / 2))
152152
)
153153
end
154+
155+
# Define custom exclusion zone/footprint
156+
function DeviceLayout.halo(
157+
isl::ExampleStarIsland,
158+
outer_delta,
159+
inner_delta=nothing;
160+
kwargs...
161+
)
162+
c = to_polygons(footprint(isl))
163+
temp_cs = CoordinateSystem{coordinatetype(isl)}(uniquename(name(isl)))
164+
place!(temp_cs, c, first(geometry(isl).element_metadata))
165+
return halo(temp_cs, outer_delta, inner_delta; kwargs...)
166+
end
167+
168+
function DeviceLayout.footprint(isl::ExampleStarIsland)
169+
return Circle(isl.island_outer_radius + isl.island_ground_gap)
170+
end

src/schematics/components/composite_components.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function _graph! end
9595
"""
9696
geometry(cc:AbstractCompositeComponent)
9797
98-
Return the `CoordinateSystem` resulting from `build!(plan(graph(cc)))`.
98+
Return the `CoordinateSystem` resulting from `plan(graph(cc)).coordinate_system`.
9999
"""
100100
function geometry(cc::AbstractCompositeComponent)
101101
return geometry_from_graph(cc)
@@ -112,18 +112,14 @@ function schematic(cc::AbstractCompositeComponent)
112112
for (k, v) in pairs(floorplan.ref_dict)
113113
cc._schematic.ref_dict[k] = v
114114
end
115+
cc._schematic.checked[] = true # Skip check
115116
return cc._schematic
116117
end
117118

118119
const COMPOSITE_NODE_ID_SEPARATOR = "__"
119120

120121
function geometry_from_graph(cc::AbstractCompositeComponent)
121-
floorplan = schematic(cc)
122-
if !floorplan.checked[]
123-
floorplan.checked[] = true # Skip check
124-
build!(floorplan)
125-
end
126-
return floorplan.coordinate_system
122+
return schematic(cc).coordinate_system
127123
end
128124

129125
compose_hookname(cc::AbstractCompositeComponent, i::Int, h::Symbol) =

src/schematics/schematics.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,9 @@ function build!(sch::Schematic, geometry_fn=geometry; strict=:error)
13251325
node_cs = structure(ref)
13261326
# One of the node cs's references will be its Component
13271327
for (i, subref) in pairs(refs(node_cs)) # Just check all of them
1328+
if structure(subref) isa AbstractCompositeComponent
1329+
build!(schematic(structure(subref)))
1330+
end
13281331
if structure(subref) isa AbstractComponent
13291332
try
13301333
refs(node_cs)[i] =

0 commit comments

Comments
 (0)