WIP: hier network processor - some debugging, more tests.

This commit is contained in:
Matthias Koefferlein 2018-12-04 22:30:18 +01:00
parent 42f153672b
commit 37fad6da97
7 changed files with 38 additions and 11 deletions

View File

@ -621,8 +621,9 @@ public:
// below m_scanner_thr elements use the brute force approach which is faster in that case
for (iterator_type1 i = m_pp1.begin (); i != m_pp1.end (); ++i) {
box_type b1 = bc1 (*i->first);
for (iterator_type2 j = m_pp2.begin (); j != m_pp2.end (); ++j) {
if (bs_boxes_overlap (bc1 (*i->first), bc2 (*j->first), enl)) {
if (bs_boxes_overlap (b1, bc2 (*j->first), enl)) {
rec.add (i->first, i->second, j->first, j->second);
if (rec.stop ()) {
return false;

View File

@ -103,9 +103,21 @@ interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const Trans
{
// TODO: this could be part of db::interact (including transformation)
if (a.obj ().is_box () && b.obj ().is_box ()) {
return db::interact (a.obj ().box ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().box ().transformed (trans));
return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (trans * Trans (b.trans ())));
} else {
return db::interact (a.obj ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().transformed (trans));
return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (trans * Trans (b.trans ())));
}
}
template <class C>
static bool
interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const db::unit_trans<C> &)
{
// TODO: this could be part of db::interact (including transformation)
if (a.obj ().is_box () && b.obj ().is_box ()) {
return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (b.trans ()));
} else {
return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (b.trans ()));
}
}
@ -265,12 +277,11 @@ local_cluster<T>::interacts (const local_cluster<T> &other, const db::ICplxTrans
{
const_cast<local_cluster<T> *> (this)->ensure_sorted ();
if (! other.bbox ().touches (bbox ())) {
box_type common = other.bbox ().transformed (trans) & bbox ();
if (common.empty ()) {
return false;
}
box_type common = other.bbox () & bbox ();
db::box_scanner2<T, unsigned int, T, unsigned int> scanner;
transformed_box <T, db::ICplxTrans> bc_t (trans);
db::box_convert<T> bc;
@ -586,6 +597,11 @@ public:
// .. nothing yet ..
}
const box_type &operator() (const db::CellInst &cell_inst) const
{
return (*this) (cell_inst.cell_index ());
}
const box_type &operator() (db::cell_index_type cell_index) const
{
typename std::map<db::cell_index_type, box_type>::const_iterator b = m_cache.find (cell_index);
@ -601,7 +617,7 @@ public:
const db::Cell &cell = mp_layout->cell (cell_index);
for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) {
const db::CellInstArray &inst_array = inst->cell_inst ();
box += inst_array.raw_bbox () * (*this) (inst_array.object ().cell_index ());
box += inst_array.bbox (*this);
}
return m_cache.insert (std::make_pair (cell_index, box)).first->second;
@ -741,10 +757,10 @@ private:
void add_pair (const db::Instance &i1, const std::vector<db::InstElement> &p1, const db::ICplxTrans &t1, const db::Instance &i2, const std::vector<db::InstElement> &p2, const db::ICplxTrans &t2)
{
box_type bb1 = (*mp_cbc) (i1.cell_index ());
box_type b1 = (i1.cell_inst ().raw_bbox () * bb1).transformed (t1);
box_type b1 = i1.cell_inst ().bbox (*mp_cbc).transformed (t1);
box_type bb2 = (*mp_cbc) (i2.cell_index ());
box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2);
box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2);
if (! b1.touches (b2)) {
return;
@ -878,7 +894,7 @@ private:
box_type b1 = c1.bbox ();
box_type bb2 = (*mp_cbc) (i2.cell_index ());
box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2);
box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2);
if (! b1.touches (b2)) {
return;
@ -1043,7 +1059,7 @@ struct cell_inst_clusters_box_converter
box_type operator() (const db::Instance &inst) const
{
return inst.cell_inst ().raw_bbox () * (*mp_cbc) (inst.cell_index ());
return inst.cell_inst ().bbox (*mp_cbc);
}
private:

View File

@ -552,3 +552,13 @@ TEST(41_HierClusters)
{
run_hc_test (_this, "hc_test_l2.gds", "hc_test_au2.gds");
}
TEST(42_HierClusters)
{
run_hc_test (_this, "hc_test_l3.gds", "hc_test_au3.gds");
}
TEST(43_HierClusters)
{
run_hc_test (_this, "hc_test_l4.gds", "hc_test_au4.gds");
}

BIN
testdata/algo/hc_test_au3.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/hc_test_au4.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/hc_test_l3.gds vendored Normal file

Binary file not shown.

BIN
testdata/algo/hc_test_l4.gds vendored Normal file

Binary file not shown.