mirror of https://github.com/KLayout/klayout.git
Convenience initializer for CellInstArray and DCellInstArray that takes a vector instead of a transformation
This commit is contained in:
parent
1a53cd00d2
commit
a5e7395d10
|
|
@ -68,6 +68,12 @@ struct cell_inst_array_defs
|
|||
return new C ();
|
||||
}
|
||||
|
||||
static C *
|
||||
new_cell_inst_vector (db::cell_index_type ci, const vector_type &v)
|
||||
{
|
||||
return new C (db::CellInst (ci), trans_type (v));
|
||||
}
|
||||
|
||||
static C *
|
||||
new_cell_inst (db::cell_index_type ci, const trans_type &t)
|
||||
{
|
||||
|
|
@ -84,6 +90,13 @@ struct cell_inst_array_defs
|
|||
}
|
||||
}
|
||||
|
||||
static C *
|
||||
new_cell_inst_array_vector (db::cell_index_type ci, const vector_type &v,
|
||||
const vector_type &a, const vector_type &b, unsigned int na, unsigned int nb)
|
||||
{
|
||||
return new C (db::CellInst (ci), trans_type (v), a, b, na, nb);
|
||||
}
|
||||
|
||||
static C *
|
||||
new_cell_inst_array (db::cell_index_type ci, const trans_type &t,
|
||||
const vector_type &a, const vector_type &b, unsigned int na, unsigned int nb)
|
||||
|
|
@ -397,6 +410,12 @@ struct cell_inst_array_defs
|
|||
"@param cell_index The cell to instantiate\n"
|
||||
"@param trans The transformation by which to instantiate the cell\n"
|
||||
) +
|
||||
gsi::constructor ("new", &new_cell_inst_vector, gsi::arg ("cell_index"), gsi::arg ("disp"),
|
||||
"@brief Creates a single cell instance\n"
|
||||
"@param cell_index The cell to instantiate\n"
|
||||
"@param disp The displacement\n"
|
||||
"This convenience initializer has been introduced in version 0.28."
|
||||
) +
|
||||
gsi::constructor ("new", &new_cell_inst_cplx, gsi::arg ("cell_index"), gsi::arg ("trans"),
|
||||
"@brief Creates a single cell instance with a complex transformation\n"
|
||||
"@param cell_index The cell to instantiate\n"
|
||||
|
|
@ -415,6 +434,17 @@ struct cell_inst_array_defs
|
|||
"Starting with version 0.25 the displacements are of vector type."
|
||||
)
|
||||
) +
|
||||
gsi::constructor ("new", &new_cell_inst_array_vector, gsi::arg ("cell_index"), gsi::arg ("disp"), gsi::arg ("a"), gsi::arg ("b"), gsi::arg ("na"), gsi::arg ("nb"),
|
||||
"@brief Creates a single cell instance\n"
|
||||
"@param cell_index The cell to instantiate\n"
|
||||
"@param disp The basic displacement of the first instance\n"
|
||||
"@param a The displacement vector of the array in the 'a' axis\n"
|
||||
"@param b The displacement vector of the array in the 'b' axis\n"
|
||||
"@param na The number of placements in the 'a' axis\n"
|
||||
"@param nb The number of placements in the 'b' axis\n"
|
||||
"\n"
|
||||
"This convenience initializer has been introduced in version 0.28."
|
||||
) +
|
||||
gsi::constructor ("new", &new_cell_inst_array_cplx, gsi::arg ("cell_index"), gsi::arg ("trans"), gsi::arg ("a"), gsi::arg ("b"), gsi::arg ("na"), gsi::arg ("nb"),
|
||||
"@brief Creates a single cell instance with a complex transformation\n"
|
||||
"@param cell_index The cell to instantiate\n"
|
||||
|
|
|
|||
|
|
@ -511,7 +511,6 @@ Class<db::RecursiveInstanceIterator> decl_RecursiveInstanceIterator ("db", "Recu
|
|||
" puts \"Instance of #{iter.inst_cell.name} in #{cell.name}: \" + (iter.dtrans * iter.inst_dtrans).to_s\n"
|
||||
" iter.next\n"
|
||||
"end\n"
|
||||
"@/code\n"
|
||||
"\n"
|
||||
"# or shorter:\n"
|
||||
"cell.begin_instances_rec.each do |iter|\n"
|
||||
|
|
|
|||
|
|
@ -609,8 +609,7 @@ Class<db::RecursiveShapeIterator> decl_RecursiveShapeIterator ("db", "RecursiveS
|
|||
"end\n"
|
||||
"\n"
|
||||
"# or shorter:\n"
|
||||
"iter = cell.begin_shapes_rec(layer)\n"
|
||||
"iter.each do |iter|\n"
|
||||
"cell.begin_shapes_rec(layer).each do |iter|\n"
|
||||
" if iter.shape.renders_polygon?\n"
|
||||
" polygon = iter.shape.polygon.transformed(iter.itrans)\n"
|
||||
" puts \"In cell #{iter.cell.name}: \" + polygon.to_s\n"
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@ class DBCellInst_TestClass < TestBase
|
|||
assert_equal(a.trans.to_s, "r90 0,0")
|
||||
assert_equal(a.cplx_trans.to_s, "r90 *1 0,0")
|
||||
|
||||
a = RBA::CellInstArray::new(0, RBA::Vector::new(42, -17))
|
||||
assert_equal(a.is_complex?, false)
|
||||
assert_equal(a.trans.to_s, "r0 42,-17")
|
||||
assert_equal(a.cplx_trans.to_s, "r0 *1 42,-17")
|
||||
|
||||
a = RBA::CellInstArray::new(0, RBA::ICplxTrans::new(1.5))
|
||||
assert_equal(a.is_complex?, true)
|
||||
assert_equal(a.trans.to_s, "r0 0,0")
|
||||
|
|
@ -106,6 +111,12 @@ class DBCellInst_TestClass < TestBase
|
|||
assert_equal(a.cplx_trans.to_s, "r90 *1 0,0")
|
||||
assert_equal(a.to_s, "#0 r90 0,0 [10,20*3;30,40*5]")
|
||||
|
||||
a = RBA::CellInstArray::new(0, RBA::Vector::new(42, -17), RBA::Vector::new(10, 20), RBA::Vector::new(30, 40), 3, 5)
|
||||
assert_equal(a.is_complex?, false)
|
||||
assert_equal(a.trans.to_s, "r0 42,-17")
|
||||
assert_equal(a.cplx_trans.to_s, "r0 *1 42,-17")
|
||||
assert_equal(a.to_s, "#0 r0 42,-17 [10,20*3;30,40*5]")
|
||||
|
||||
a = RBA::CellInstArray::new(0, RBA::ICplxTrans::new(1.5), RBA::Vector::new(10, 20), RBA::Vector::new(30, 40), 3, 5)
|
||||
assert_equal(a.is_complex?, true)
|
||||
assert_equal(a.trans.to_s, "r0 0,0")
|
||||
|
|
@ -178,6 +189,11 @@ class DBCellInst_TestClass < TestBase
|
|||
assert_equal(a.trans.to_s, "r90 0,0")
|
||||
assert_equal(a.cplx_trans.to_s, "r90 *1 0,0")
|
||||
|
||||
a = RBA::DCellInstArray::new(0, RBA::DVector::new(42, -17))
|
||||
assert_equal(a.is_complex?, false)
|
||||
assert_equal(a.trans.to_s, "r0 42,-17")
|
||||
assert_equal(a.cplx_trans.to_s, "r0 *1 42,-17")
|
||||
|
||||
a = RBA::DCellInstArray::new(0, RBA::DCplxTrans::new(1.5))
|
||||
assert_equal(a.is_complex?, true)
|
||||
assert_equal(a.trans.to_s, "r0 0,0")
|
||||
|
|
@ -235,6 +251,12 @@ class DBCellInst_TestClass < TestBase
|
|||
assert_equal(a.cplx_trans.to_s, "r90 *1 0,0")
|
||||
assert_equal(a.to_s, "#0 r90 0,0 [10,20*3;30,40*5]")
|
||||
|
||||
a = RBA::DCellInstArray::new(0, RBA::DVector::new(42, -17), RBA::DVector::new(10, 20), RBA::DVector::new(30, 40), 3, 5)
|
||||
assert_equal(a.is_complex?, false)
|
||||
assert_equal(a.trans.to_s, "r0 42,-17")
|
||||
assert_equal(a.cplx_trans.to_s, "r0 *1 42,-17")
|
||||
assert_equal(a.to_s, "#0 r0 42,-17 [10,20*3;30,40*5]")
|
||||
|
||||
a = RBA::DCellInstArray::new(0, RBA::DCplxTrans::new(1.5), RBA::DVector::new(10, 20), RBA::DVector::new(30, 40), 3, 5)
|
||||
assert_equal(a.is_complex?, true)
|
||||
assert_equal(a.trans.to_s, "r0 0,0")
|
||||
|
|
|
|||
Loading…
Reference in New Issue