Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-cell copy_tree with common subcells only copied once #639

klayoutmatthias opened this issue Sep 13, 2020 · 1 comment

Multi-cell copy_tree with common subcells only copied once #639

klayoutmatthias opened this issue Sep 13, 2020 · 1 comment


Copy link

klayoutmatthias commented Sep 13, 2020

This is a problem that pops up now and then. Recent case:

The problem is: when copying over a cell from one layout to another, the full tree is copied always. If multiple cells are copied, common subcells are not shared, not duplicated.

A solution is required to provide multi-cell copies while sharing common subcells. The "multi_clip_into" feature for example provides this ability already.


The solution consists of two methods: Cellmapping#for_multi_cells_full will create the target structure and prepare a mapping table and Layout#copy_tree_shapes will copy the shapes.

Here is some sample code:

l = ... # source layout
lt = ... # target layout

target_cells = ... # array of cell indexes to which cells to copy (in target layout)
source_cell = ... # array of cell indexes from which cells to copy (in source layout)

# NOTE: target_cells.size must be equal to source_cells.size

# Prepare a cell mapping (this will also create the necessary subcells in the target layout)
cm = RBA::CellMapping::new
cm.for_multi_cells_full(lt, target_cells, l, source_cells)

# Copy the cell's shapes
lt.copy_tree_shapes(l, cm)
Copy link
Collaborator Author

Release with 0.26.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant