Fan-In
add_fan_in takes a set of N ports and produces N parallel waveguides
that converge into a tightly-pitched bundle line — the input side
of a bundle route. add_bundle_astar and add_bundle_manual
call it internally on each end of a bundle, but you can also call it
directly when you only need the converging stub (for example, to
expose a bundle interface that a downstream router consumes, or to
compress a fibre-array fan-out without a closed-loop A* pass).
There are three fan-in strategies, each with a different sweet spot:
"manhattan"(default) — a 90° comb. The most compact choice when port pitch is comfortable relative to the bend radius."sbend"— per-wire euler s-bend with a corner angle sized to the PDK radius for each wire's jog. The right choice when port pitch falls below 2·radius and manhattan can no longer fit two 90° corners between adjacent wires."lbend"— straight + 90° bend + straight per port, so the bundle exits perpendicular to the input direction. Useful when the downstream bundle needs to turn 90°, or when you need a tunable clearance before the first bend.
This is optical routing: bends are bend_euler at the PDK
minimum radius (5 µm for gdsfactory.gpdk).
Imports
import gdsfactory as gf
from gdsfactory.gpdk import PDK
import gdsfactoryplus as gfp
dr = gfp.routing.doroutes
PDK.activate()
A 5-Port Frame
dr.pcells.fanout_frame(orientation="e") is an example layout with
5 east-facing ports spaced 40 µm apart inside a 100 µm-wide frame —
typical of a fibre-array facet. We render the empty frame first as a
reference, then apply each of the three fan-in strategies in turn on
a fresh copy so you can compare the resulting geometries.
c = gf.Component()
ref = c << dr.pcells.fanout_frame(orientation="e")
c.add_ports(ref)
dr.util.show_cell(c)
Manhattan Fan-In (Default)
The classic 90°-comb fan-in. Each port goes straight, then turns 90° onto the bundle line. The bend lands at the port face — predictable and compact, but on tight pitches the bend body can intrude on neighbouring wires.