WIP: bugfix - intra-array self interactions.

This commit is contained in:
Matthias Koefferlein 2018-09-23 22:34:50 +02:00
parent 52a4459dac
commit eb71121c38
3 changed files with 24 additions and 1 deletions

View File

@ -335,6 +335,8 @@ private:
static bool
instances_interact (const db::Layout *layout1, const db::CellInstArray *inst1, unsigned int layer1, const db::Layout *layout2, const db::CellInstArray *inst2, unsigned int layer2)
{
// TODO: this algorithm is not in particular effective for identical arrays
const db::Cell &cell1 = layout1->cell (inst1->object ().cell_index ());
const db::Cell &cell2 = layout2->cell (inst2->object ().cell_index ());
db::box_convert <db::CellInst, true> inst2_bc (*layout2, layer2);
@ -353,6 +355,11 @@ instances_interact (const db::Layout *layout1, const db::CellInstArray *inst1, u
for (db::CellInstArray::iterator k = inst2->begin_touching (ibox1.enlarged (db::Vector (-1, -1)), inst2_bc); ! k.at_end (); ++k) {
if (inst1 == inst2 && *n == *k) {
// skip self-interactions - this is handled inside the cell
continue;
}
db::ICplxTrans tn2 = inst2->complex_trans (*k);
db::Box ibox2 = tn2 * cell2.bbox (layer2);
@ -398,7 +405,10 @@ public:
void add (const db::CellInstArray *inst1, int, const db::CellInstArray *inst2, int)
{
// @@@ TODO: always insert, if both instances come from different layouts
if (*inst1 != *inst2 && instances_interact (mp_subject_layout, inst1, m_subject_layer, mp_intruder_layout, inst2, m_intruder_layer)) {
// NOTE: self-interactions are possible for arrays: different elements of the
// array may interact which is a cell-external interaction.
if ((*inst1 != *inst2 || inst1->size () > 1)
&& instances_interact (mp_subject_layout, inst1, m_subject_layer, mp_intruder_layout, inst2, m_intruder_layer)) {
(*mp_result) [inst1].first.insert (inst2);
}
}

Binary file not shown.

View File

@ -254,3 +254,16 @@ TEST(BasicNot9)
"CHILD1[1] 0 insts, 4 shapes (2 times)\n"
);
}
TEST(BasicAnd10)
{
// Array instances, AND
run_test_bool (_this, "hlp10.oas", TMAnd, 100);
}
TEST(BasicNot10)
{
// Array instances, NOT
run_test_bool (_this, "hlp10.oas", TMNot, 101);
}