"""Route profiles — cross-section recipes for waveguides.

A route profile bundles everything that varies along a route: layers,
strokes, widths, periodic teeth (gratings, tapers, periodic claddings).
Attach one to a port and every Route from that port adopts it.
"""
import lumicron as lm
import lumicron.pdks.elyon_demo.all as pdk


@lm.pcell
def ProfileDemo():
    c = lm.CELL("ProfileDemo")

    # The PDK ships ready-made profiles in `pdk.RP`. Here we route with
    # the silicon-nitride strip — the profile stamps SiLN at the right
    # width and inherits its bend radius.
    c.add(lm.PORT(
        "in", position=(0, 0), direction=0,
        route_profile=pdk.RP.siln_strip,
    ))
    c.add(lm.PORT(
        "out", position=(500, 200), direction=180,
        route_profile=pdk.RP.siln_strip,
    ))

    c.Route(c.ports["in"], radius=15).to(c.ports["out"])
    return c


if __name__ == "__main__":
    ProfileDemo().to_gds("profile_demo.gds")
