gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
31 stars 11 forks source link

support route_bundle #206

Closed joamatab closed 4 months ago

joamatab commented 10 months ago

How can we support route_bundle?

@damienbonneau

damienbonneau commented 10 months ago

@joamatab route bundle logic not tied to kfactory or gdsfactory about them nor any layout-specififc package, I think.

The logic which generates bundles should be about taking a list of points (let's refer to this as a backbone) and to generate a list of backbones. The core of all bundle functions would have this signature:

Backbone = List[Point]
def make_bundle_of_type_A(points: Backbone) -> List[Backbone) ]

Then the extrusion should just be about applying a route filter to the list of backbones e.g something like this. The route filter is a function which takes a backbone and a cell, and instantiates elementary subcells (wg, tapers, bends) to flesh out the route:

def flesh_out_arbitrary_bundle(
    c: kf.KCell, 
    backbones: List[Backbone],
    route_filter: Callable,
    **route_filter_config
):
     for backbone in backbones:
         route_filter(c, backbone, **route_filter_config)

And the usage is something like this:


@kf.cell
def my_cell(...):
    c = kf.KCell()
    ...
    backbone = [...]

    bundle_backbones = make_bundle_function(backbone )
    flesh_out_arbitrary_bundle(c , bundle_backbones, route_filter)
sebastian-goeldi commented 4 months ago

Fixed by #295