bbox_with_layer -> bbox

This commit is contained in:
Matthias Koefferlein 2022-08-27 17:58:17 +02:00
parent 67d8518926
commit 69617e8006
3 changed files with 44 additions and 34 deletions

View File

@ -2718,9 +2718,9 @@ Class<db::Cell> decl_Cell ("db", "Cell",
"@return The bounding box of the cell\n"
"\n"
"The bounding box is computed over all layers. To compute the bounding box over single layers, "
"use \\bbox_per_layer.\n"
"use \\bbox with a layer index argument.\n"
) +
gsi::method ("bbox_per_layer", (const db::Cell::box_type &(db::Cell::*) (unsigned int) const) &db::Cell::bbox, gsi::arg ("layer_index"),
gsi::method ("bbox|#bbox_per_layer", (const db::Cell::box_type &(db::Cell::*) (unsigned int) const) &db::Cell::bbox, gsi::arg ("layer_index"),
"@brief Gets the per-layer bounding box of the cell\n"
"\n"
"@return The bounding box of the cell considering only the given layer\n"
@ -2733,11 +2733,11 @@ Class<db::Cell> decl_Cell ("db", "Cell",
"@return The bounding box of the cell\n"
"\n"
"The bounding box is computed over all layers. To compute the bounding box over single layers, "
"use \\dbbox_per_layer.\n"
"use \\dbbox with a layer index argument.\n"
"\n"
"This method has been introduced in version 0.25."
) +
gsi::method_ext ("dbbox_per_layer", &cell_dbbox_per_layer, gsi::arg ("layer_index"),
gsi::method_ext ("dbbox|#dbbox_per_layer", &cell_dbbox_per_layer, gsi::arg ("layer_index"),
"@brief Gets the per-layer bounding box of the cell in micrometer units\n"
"\n"
"@return The bounding box of the cell considering only the given layer\n"
@ -3913,7 +3913,7 @@ Class<db::Instance> decl_Instance ("db", "Instance",
"\n"
"This method has been introduced in version 0.25."
) +
gsi::method_ext ("bbox_per_layer", &inst_bbox_per_layer, gsi::arg ("layer_index"),
gsi::method_ext ("bbox|#bbox_per_layer", &inst_bbox_per_layer, gsi::arg ("layer_index"),
"@brief Gets the bounding box of the instance for a given layer\n"
"@param layer_index The index of the layer the bounding box will be computed for.\n"
"The bounding box incorporates all instances that the array represents. "
@ -3922,11 +3922,11 @@ Class<db::Instance> decl_Instance ("db", "Instance",
"\n"
"This method has been introduced in version 0.25."
) +
gsi::method_ext ("dbbox_per_layer", &inst_dbbox_per_layer, gsi::arg ("layer_index"),
gsi::method_ext ("dbbox|#dbbox_per_layer", &inst_dbbox_per_layer, gsi::arg ("layer_index"),
"@brief Gets the bounding box of the instance in micron units\n"
"@param layer_index The index of the layer the bounding box will be computed for.\n"
"Gets the bounding box (see \\bbox_per_layer) of the instance, but will compute the micrometer unit box by "
"multiplying \\bbox_per_layer with the database unit.\n"
"Gets the bounding box (see \\bbox) of the instance, but will compute the micrometer unit box by "
"multiplying \\bbox with the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
) +
@ -4412,7 +4412,7 @@ static db::CellInstArray::box_type cell_inst_array_bbox_per_layer (const db::Cel
Class<db::CellInstArray> decl_CellInstArray ("db", "CellInstArray",
cell_inst_array_defs<db::CellInstArray>::methods (false /*old version*/) +
gsi::method_ext ("bbox_per_layer", &cell_inst_array_bbox_per_layer, gsi::arg ("layout"), gsi::arg ("layer_index"),
gsi::method_ext ("bbox|#bbox_per_layer", &cell_inst_array_bbox_per_layer, gsi::arg ("layout"), gsi::arg ("layer_index"),
"@brief Gets the bounding box of the array with respect to one layer\n"
"The bounding box incorporates all instances that the array represents. It needs the layout object to access the "
"actual cell from the cell index."
@ -4474,7 +4474,7 @@ static db::DBox cell_dinst_array_bbox_per_layer (const db::DCellInstArray *a, co
Class<db::DCellInstArray> decl_DCellInstArray ("db", "DCellInstArray",
cell_inst_array_defs<db::DCellInstArray>::methods (true /*new version*/) +
gsi::method_ext ("bbox_per_layer", &cell_dinst_array_bbox_per_layer, gsi::arg ("layout"), gsi::arg ("layer_index"),
gsi::method_ext ("bbox|#bbox_per_layer", &cell_dinst_array_bbox_per_layer, gsi::arg ("layout"), gsi::arg ("layer_index"),
"@brief Gets the bounding box of the array with respect to one layer\n"
"The bounding box incorporates all instances that the array represents. It needs the layout object to access the "
"actual cell from the cell index."

View File

@ -53,21 +53,23 @@ class DBInstance_TestClass < TestBase
assert_equal(c1.bbox.to_s, "(10,-10;50,40)")
assert_equal(c1.bbox_per_layer(lindex).to_s, "(10,-10;50,40)")
assert_equal(c1.bbox_per_layer(ldummy).to_s, "()")
assert_equal(c1.bbox(lindex).to_s, "(10,-10;50,40)")
assert_equal(c1.bbox(ldummy).to_s, "()")
tr = RBA::Trans::new( RBA::Trans::R90, RBA::Point::new( 101, -51 ) )
inst = RBA::CellInstArray::new( c1.cell_index, tr )
assert_equal(inst.bbox(ly).to_s, "(61,-41;111,-1)")
assert_equal(inst.bbox_per_layer(ly, lindex).to_s, "(61,-41;111,-1)")
assert_equal(inst.bbox_per_layer(ly, ldummy).to_s, "()")
assert_equal(inst.bbox(ly, lindex).to_s, "(61,-41;111,-1)")
assert_equal(inst.bbox(ly, ldummy).to_s, "()")
inst_ref = c2.insert( inst )
assert_equal( inst_ref.to_s, "cell_index=0 r90 101,-51" )
assert_equal( inst_ref.bbox.to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.cell_inst.bbox(ly).to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.bbox_per_layer(lindex).to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.cell_inst.bbox_per_layer(ly, lindex).to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.bbox_per_layer(ldummy).to_s, "()" )
assert_equal( inst_ref.cell_inst.bbox_per_layer(ly, ldummy).to_s, "()" )
assert_equal( inst_ref.bbox(lindex).to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.cell_inst.bbox(ly, lindex).to_s, "(61,-41;111,-1)" )
assert_equal( inst_ref.bbox(ldummy).to_s, "()" )
assert_equal( inst_ref.cell_inst.bbox(ly, ldummy).to_s, "()" )
tr = RBA::Trans::new( RBA::Trans::R90, RBA::Point::new( 100, -50 ) )
inst = RBA::CellInstArray::new( c1.cell_index, tr )
@ -514,21 +516,23 @@ class DBInstance_TestClass < TestBase
assert_equal(c1.dbbox.to_s, "(0.01,-0.01;0.05,0.04)")
assert_equal(c1.dbbox_per_layer(lindex).to_s, "(0.01,-0.01;0.05,0.04)")
assert_equal(c1.dbbox_per_layer(ldummy).to_s, "()")
assert_equal(c1.dbbox(lindex).to_s, "(0.01,-0.01;0.05,0.04)")
assert_equal(c1.dbbox(ldummy).to_s, "()")
tr = RBA::DTrans::new( RBA::DTrans::R90, RBA::DPoint::new( 0.101, -0.051 ) )
inst = RBA::DCellInstArray::new( c1.cell_index, tr )
assert_equal(inst.bbox(ly).to_s, "(0.061,-0.041;0.111,-0.001)")
assert_equal(inst.bbox_per_layer(ly, lindex).to_s, "(0.061,-0.041;0.111,-0.001)")
assert_equal(inst.bbox_per_layer(ly, ldummy).to_s, "()")
assert_equal(inst.bbox(ly, lindex).to_s, "(0.061,-0.041;0.111,-0.001)")
assert_equal(inst.bbox(ly, ldummy).to_s, "()")
inst_ref = c2.insert( inst )
assert_equal( inst_ref.to_s, "cell_index=0 r90 101,-51" )
assert_equal( inst_ref.dbbox.to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dcell_inst.bbox(ly).to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dbbox_per_layer(lindex).to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dcell_inst.bbox_per_layer(ly, lindex).to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dbbox_per_layer(ldummy).to_s, "()" )
assert_equal( inst_ref.dcell_inst.bbox_per_layer(ly, ldummy).to_s, "()" )
assert_equal( inst_ref.dbbox(lindex).to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dcell_inst.bbox(ly, lindex).to_s, "(0.061,-0.041;0.111,-0.001)" )
assert_equal( inst_ref.dbbox(ldummy).to_s, "()" )
assert_equal( inst_ref.dcell_inst.bbox(ly, ldummy).to_s, "()" )
tr = RBA::DTrans::new( RBA::DTrans::R90, RBA::DPoint::new( 0.100, -0.050 ) )
inst = RBA::DCellInstArray::new( c1.cell_index, tr )

View File

@ -206,22 +206,28 @@ class DBLayoutTests2_TestClass < TestBase
assert_equal( c1.bbox.to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox_per_layer( lindex ).to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox_per_layer( ldummy ).to_s, "()" )
assert_equal( c1.bbox( lindex ).to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox( ldummy ).to_s, "()" )
assert_equal( c1.dbbox_per_layer( lindex ).to_s, "(0.01,-0.01;0.05,0.04)" )
assert_equal( c1.dbbox_per_layer( ldummy ).to_s, "()" )
assert_equal( c1.dbbox( lindex ).to_s, "(0.01,-0.01;0.05,0.04)" )
assert_equal( c1.dbbox( ldummy ).to_s, "()" )
c1.swap( lindex, ldummy )
assert_equal( c1.bbox_per_layer( lindex ).to_s, "()" )
assert_equal( c1.bbox_per_layer( ldummy ).to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox( lindex ).to_s, "()" )
assert_equal( c1.bbox( ldummy ).to_s, "(10,-10;50,40)" )
c1.clear( lindex )
c1.clear( ldummy )
assert_equal( c1.bbox_per_layer( lindex ).to_s, "()" )
assert_equal( c1.bbox_per_layer( ldummy ).to_s, "()" )
assert_equal( c1.bbox( lindex ).to_s, "()" )
assert_equal( c1.bbox( ldummy ).to_s, "()" )
c1.shapes( lindex ).insert( RBA::Box::new( 10, -10, 50, 40 ) )
assert_equal( c1.bbox_per_layer( lindex ).to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox_per_layer( ldummy ).to_s, "()" )
assert_equal( c1.bbox( lindex ).to_s, "(10,-10;50,40)" )
assert_equal( c1.bbox( ldummy ).to_s, "()" )
c1.clear_shapes
assert_equal( c1.bbox_per_layer( lindex ).to_s, "()" )
assert_equal( c1.bbox_per_layer( ldummy ).to_s, "()" )
assert_equal( c1.bbox( lindex ).to_s, "()" )
assert_equal( c1.bbox( ldummy ).to_s, "()" )
assert_equal( ly.unique_cell_name("c3"), "c3" )
assert_equal( ly.unique_cell_name("c1"), "c1$1" )
@ -255,8 +261,8 @@ class DBLayoutTests2_TestClass < TestBase
tr = RBA::Trans::new( RBA::Trans::R90, RBA::Point::new( 100, -50 ) )
inst = RBA::CellInstArray::new( c1.cell_index, tr )
assert_equal( inst.bbox( ly ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox_per_layer( ly, lindex ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox_per_layer( ly, ldummy ).to_s, "()" )
assert_equal( inst.bbox( ly, lindex ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox( ly, ldummy ).to_s, "()" )
assert_equal( inst.size, 1 )
assert_equal( inst.is_complex?, false )
c2.insert( inst )
@ -496,8 +502,8 @@ class DBLayoutTests2_TestClass < TestBase
tr = RBA::Trans::new( RBA::Trans::R90, RBA::Point::new( 100, -50 ) )
inst = RBA::CellInstArray::new( c1.cell_index, tr )
assert_equal( inst.bbox( ly ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox_per_layer( ly, lindex ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox_per_layer( ly, ldummy ).to_s, "()" )
assert_equal( inst.bbox( ly, lindex ).to_s, c1.bbox.transformed(tr).to_s )
assert_equal( inst.bbox( ly, ldummy ).to_s, "()" )
assert_equal( inst.size, 1 )
assert_equal( inst.is_complex?, false )
c2.insert( inst, pid )