Updated tests.

This commit is contained in:
Matthias Koefferlein 2021-05-24 16:49:00 +02:00
parent 2fc301a0b6
commit 05b1023fd5
3 changed files with 18 additions and 8 deletions

View File

@ -190,7 +190,7 @@ OriginalLayerRegion::min_coherence_changed ()
size_t
OriginalLayerRegion::count () const
{
if (m_iter.has_complex_region () || m_iter.region () != db::Box::world ()) {
if (m_iter.has_complex_region () || m_iter.region () != db::Box::world () || ! m_iter.enables ().empty () || ! m_iter.disables ().empty ()) {
// complex case with a search region - use the iterator to determine the count (expensive)
size_t n = 0;
@ -210,6 +210,7 @@ OriginalLayerRegion::count () const
std::set<db::cell_index_type> cells;
m_iter.top_cell ()->collect_called_cells (cells);
cells.insert (m_iter.top_cell ()->cell_index ());
db::CellCounter cc (&layout);
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
@ -217,8 +218,12 @@ OriginalLayerRegion::count () const
continue;
}
size_t nn = 0;
for (std::vector<unsigned int>::const_iterator l = m_iter.layers ().begin (); l != m_iter.layers ().end (); ++l) {
nn += layout.cell (*c).shapes (*l).size (m_iter.shape_flags ());
if (m_iter.multiple_layers ()) {
for (std::vector<unsigned int>::const_iterator l = m_iter.layers ().begin (); l != m_iter.layers ().end (); ++l) {
nn += layout.cell (*c).shapes (*l).size (m_iter.shape_flags ());
}
} else {
nn += layout.cell (*c).shapes (m_iter.layer ()).size (m_iter.shape_flags ());
}
n += cc.weight (*c) * nn;
}
@ -244,13 +249,18 @@ OriginalLayerRegion::hier_count () const
std::set<db::cell_index_type> cells;
m_iter.top_cell ()->collect_called_cells (cells);
cells.insert (m_iter.top_cell ()->cell_index ());
for (db::Layout::top_down_const_iterator c = layout.begin_top_down (); c != layout.end_top_down (); ++c) {
if (cells.find (*c) == cells.end ()) {
continue;
}
for (std::vector<unsigned int>::const_iterator l = m_iter.layers ().begin (); l != m_iter.layers ().end (); ++l) {
n += layout.cell (*c).shapes (*l).size (m_iter.shape_flags ());
if (m_iter.multiple_layers ()) {
for (std::vector<unsigned int>::const_iterator l = m_iter.layers ().begin (); l != m_iter.layers ().end (); ++l) {
n += layout.cell (*c).shapes (*l).size (m_iter.shape_flags ());
}
} else {
n += layout.cell (*c).shapes (m_iter.layer ()).size (m_iter.shape_flags ());
}
}

Binary file not shown.

View File

@ -166,7 +166,7 @@ class DBRegion_TestClass < TestBase
assert_equal(csort(r.to_s), csort("(-10,-20;-10,20;10,20;10,-20);(-10,80;-10,120;10,120;10,80);(190,80;190,120;210,120;210,80)"))
assert_equal(r.is_empty?, false)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(-10,-20;210,120)")
assert_equal(r.is_merged?, false)
assert_equal(r.has_valid_polygons?, false)
@ -195,7 +195,7 @@ class DBRegion_TestClass < TestBase
assert_equal(r.is_empty?, false)
assert_equal(r.is_box?, false)
assert_equal(r.count, 3)
assert_equal(r.hier_count, 3)
assert_equal(r.hier_count, 1)
assert_equal(r.bbox.to_s, "(0,0;220,140)")
assert_equal(r.is_merged?, false)
@ -972,7 +972,7 @@ class DBRegion_TestClass < TestBase
assert_equal(r.hier_count, 1)
assert_equal(rf.area, 53120000)
assert_equal(rf.count, 10)
assert_equal(rf.hier_count, 10)
assert_equal(rf.hier_count, 1)
ly_new = RBA::Layout::new
tc = ly_new.add_cell("TOP")