def merge_well(self, template: TemplateBase, inst_list: List[PyLayInstance], sub_type: str, *, threshold: str = '', res_type: str = '', merge_imp: bool = False) -> None: """Merge the well of the given instances together.""" if threshold is not None: lay_iter = chain( self.get_well_layers(sub_type), self.get_threshold_layers(sub_type, threshold, res_type=res_type)) else: lay_iter = self.get_well_layers(sub_type) if merge_imp: lay_iter = chain( lay_iter, self.get_implant_layers(sub_type, res_type=res_type)) for lay_purp in lay_iter: tot_box = BBox.get_invalid_bbox() for inst in inst_list: cur_box = inst.master.get_rect_bbox(lay_purp) tot_box.merge(inst.transform_master_object(cur_box)) if tot_box.is_physical(): template.add_rect(lay_purp, tot_box)
def get_bounding_box(self, grid: RoutingGrid, layer: Union[int, str] = -1000) -> BBox: """Calculate the overall bounding box of this port on the given layer. Parameters ---------- grid : RoutingGrid the RoutingGrid of this Port. layer : Union[int, str] the layer ID. If Negative, check if this port is on a single layer, then return the result. Returns ------- bbox : BBox the bounding box. """ layer = self._get_layer(layer) box = BBox.get_invalid_bbox() for geo in self._pin_dict[layer]: if isinstance(geo, BBox): box.merge(geo) else: box.merge(grid.get_warr_bbox(geo)) return box
def test_invalid_bbox(): ans = BBox.get_invalid_bbox() assert ans.is_valid() is False