mirror of https://github.com/KLayout/klayout.git
Added ParentCellInst#dinst
This commit is contained in:
parent
d9b61fe679
commit
11f6eb21e0
|
|
@ -4370,6 +4370,17 @@ Class<db::Instance> decl_Instance ("db", "Instance",
|
|||
// ---------------------------------------------------------------
|
||||
// db::ParentInstRep binding (to "ParentInstArray")
|
||||
|
||||
static db::DCellInstArray
|
||||
dinst (const db::ParentInstRep *parent_inst)
|
||||
{
|
||||
const db::Instances *instances = parent_inst->child_inst ().instances ();
|
||||
if (! instances || ! instances->layout ()) {
|
||||
return db::DCellInstArray ();
|
||||
}
|
||||
|
||||
return cell_inst_array_defs<db::CellInstArray>::transform_array (parent_inst->inst (), db::CplxTrans (instances->layout ()->dbu ()));
|
||||
}
|
||||
|
||||
Class<db::ParentInstRep> decl_ParentInstArray ("db", "ParentInstArray",
|
||||
method ("parent_cell_index", &db::ParentInstRep::parent_cell_index,
|
||||
"@brief Gets the index of the parent cell\n"
|
||||
|
|
@ -4381,6 +4392,11 @@ Class<db::ParentInstRep> decl_ParentInstArray ("db", "ParentInstArray",
|
|||
) +
|
||||
method ("inst", &db::ParentInstRep::inst,
|
||||
"@brief Compute the inverse instance by which the parent is seen from the child\n"
|
||||
) +
|
||||
method_ext ("dinst", &dinst,
|
||||
"@brief Compute the inverse instance by which the parent is seen from the child in micrometer units\n"
|
||||
"\n"
|
||||
"This convenience method has been introduced in version 0.28."
|
||||
),
|
||||
"@brief A parent instance\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -599,6 +599,14 @@ class DBLayoutTests2_TestClass < TestBase
|
|||
c1.each_parent_inst { |i| arr.push( i ) }
|
||||
assert_equal( arr.size, 1 )
|
||||
|
||||
strarr = []
|
||||
c1.each_parent_inst { |i| strarr.push( i.inst.to_s ) }
|
||||
assert_equal( strarr.join(";"), "#1 m45 *0.666666667 33,-67 [0,-67*10;-67,0*20]" )
|
||||
|
||||
strarr = []
|
||||
c1.each_parent_inst { |i| strarr.push( i.dinst.to_s ) }
|
||||
assert_equal( strarr.join(";"), "#1 m45 *0.666666667 0.033,-0.067 [0,-0.067*10;-0.067,0*20]" )
|
||||
|
||||
assert_equal( arr[0].parent_cell_index, c2.cell_index )
|
||||
assert_equal( arr[0].child_inst.cell_index, c1.cell_index )
|
||||
assert_equal( arr[0].inst.cell_index, c2.cell_index )
|
||||
|
|
|
|||
Loading…
Reference in New Issue