Skip to content

Commit

Permalink
Merge pull request #1313 from KLayout/wip2
Browse files Browse the repository at this point in the history
Wip2
  • Loading branch information
klayoutmatthias authored Mar 16, 2023
2 parents 9827d24 + b979219 commit 40848be
Show file tree
Hide file tree
Showing 41 changed files with 46,120 additions and 44,889 deletions.
1 change: 1 addition & 0 deletions scripts/mkqtdecl5/mkqtdecl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ drop_method "QNoDebug", /QNoDebug::operator<</ # nothing usable (TODO: how to ma

include "QCoreApplication", [ "<QCoreApplication>", "<QAbstractEventDispatcher>", "<QAbstractNativeEventFilter>", "<QTranslator>" ]
include "QThread", [ "<QThread>", "<QAbstractEventDispatcher>" ]
include "QByteArrayMatcher", [ "<limits>", "<QByteArrayMatcher>" ]

rename "QLocale", /QLocale::toString\(int i/, "toString_i"
rename "QLocale", /QLocale::toString\(unsigned int/, "toString_ui"
Expand Down
19 changes: 12 additions & 7 deletions scripts/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,14 @@ class PropertyStub(Stub):
class ClassStub(Stub):
indent_docstring: bool = True

def get_child_classes(c: ktl.Class):
child_classes = []
for c_child in c.each_child_class():
child_classes.append(c_child)
return sorted(child_classes, key=lambda cls: cls.name())

def get_py_child_classes(c: ktl.Class):
for c_child in c.each_child_class():
for c_child in get_child_classes(c):
yield c_child


Expand Down Expand Up @@ -390,9 +395,9 @@ def format_args(m: ktl.Method, self_str: str = "self") -> str:
)
)

boundmethods = sorted(boundmethods)
properties = sorted(properties)
classmethods = sorted(classmethods)
boundmethods = sorted(boundmethods, key=lambda m: m.signature)
properties = sorted(properties, key=lambda m: m.signature)
classmethods = sorted(classmethods, key=lambda m: m.signature)

return_list: List[Stub] = properties + classmethods + boundmethods

Expand All @@ -415,7 +420,7 @@ def get_class_stub(
signature="class " + full_name + base, docstring=c.doc(), name=full_name
)
child_attributes = get_py_methods(c)
for child_c in c.each_child_class():
for child_c in get_child_classes(c):
_cstub.child_stubs.append(
get_class_stub(
child_c,
Expand All @@ -434,7 +439,7 @@ def get_classes(module: str) -> List[ktl.Class]:
if c.module() != module:
continue
_classes.append(c)
return _classes
return sorted(_classes, key=lambda cls: cls.name())


def get_module_stubs(module: str) -> List[ClassStub]:
Expand All @@ -457,7 +462,7 @@ def print_mod(module, dependencies):

if __name__ == "__main__":
if len(argv) < 2:
print("Specity module in argument")
print("Specify module in argument")
exit(1)
if len(argv) == 2:
print_mod(argv[1], [])
Expand Down
47 changes: 47 additions & 0 deletions src/buddies/src/bd/strmxor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class HealingCountingReceiver
virtual void finish (bool);

void keep_for_healing (const db::Polygon &poly);
void keep_for_healing (const db::Box &box);

private:
size_t *mp_count;
Expand Down Expand Up @@ -78,6 +79,15 @@ class HealingCountingInserter
}
}

void operator() (const db::Box &box)
{
if (m_healing && ! box.inside (mp_tile->enlarged (db::Vector (-1, -1)))) {
mp_receiver->keep_for_healing (box);
} else {
m_count += 1;
}
}

size_t count () const
{
return m_count;
Expand Down Expand Up @@ -110,6 +120,12 @@ HealingCountingReceiver::keep_for_healing (const db::Polygon &poly)
m_for_healing.insert (poly);
}

void
HealingCountingReceiver::keep_for_healing (const db::Box &box)
{
m_for_healing.insert (box);
}

void
HealingCountingReceiver::finish (bool)
{
Expand All @@ -132,7 +148,9 @@ class HealingTileLayoutOutputReceiver
void finish (bool /*success*/);

void keep_for_healing (const db::Polygon &poly);
void keep_for_healing (const db::Box &box);
void output (const db::Polygon &poly);
void output (const db::Box &poly);

private:
db::Layout *mp_layout;
Expand Down Expand Up @@ -167,6 +185,23 @@ class HealingTileLayoutOutputInserter
}
}

void operator() (const db::Box &box)
{
if (m_healing && ! box.inside (mp_tile->enlarged (db::Vector (-1, -1)))) {
if (mp_trans->is_complex ()) {
mp_receiver->keep_for_healing (*mp_trans * db::Polygon (box));
} else {
mp_receiver->keep_for_healing (*mp_trans * box);
}
} else {
if (mp_trans->is_complex ()) {
mp_receiver->output (*mp_trans * db::Polygon (box));
} else {
mp_receiver->output (*mp_trans * box);
}
}
}

private:
const db::Box *mp_tile;
bool m_healing;
Expand Down Expand Up @@ -211,12 +246,24 @@ HealingTileLayoutOutputReceiver::keep_for_healing (const db::Polygon &poly)
m_for_healing.insert (poly);
}

void
HealingTileLayoutOutputReceiver::keep_for_healing (const db::Box &box)
{
m_for_healing.insert (box);
}

void
HealingTileLayoutOutputReceiver::output (const db::Polygon &poly)
{
mp_cell->shapes (m_layer).insert (poly);
}

void
HealingTileLayoutOutputReceiver::output (const db::Box &box)
{
mp_cell->shapes (m_layer).insert (box);
}

// ---------------------------------------------------------------------

struct ResultDescriptor
Expand Down
28 changes: 14 additions & 14 deletions src/buddies/unit_tests/bdStrmxorTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST(1A_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
"Result summary (layers without differences are not shown):\n"
Expand Down Expand Up @@ -141,7 +141,7 @@ TEST(1A_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
"Result summary (layers without differences are not shown):\n"
Expand Down Expand Up @@ -321,7 +321,7 @@ TEST(2_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
""
);
Expand Down Expand Up @@ -354,7 +354,7 @@ TEST(2_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
""
);
Expand Down Expand Up @@ -387,7 +387,7 @@ TEST(3_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -453,7 +453,7 @@ TEST(3_FlatHeal)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -520,7 +520,7 @@ TEST(3_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -553,7 +553,7 @@ TEST(4_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -586,7 +586,7 @@ TEST(4_FlatHeal)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -619,7 +619,7 @@ TEST(4_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -652,7 +652,7 @@ TEST(5_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -685,7 +685,7 @@ TEST(5_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -718,7 +718,7 @@ TEST(6_Flat)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down Expand Up @@ -751,7 +751,7 @@ TEST(6_Deep)
reader.read (layout);
}

db::compare_layouts (this, layout, au, db::NoNormalization);
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
EXPECT_EQ (cap.captured_text (),
"Layer 10/0 is not present in first layout, but in second\n"
);
Expand Down
4 changes: 2 additions & 2 deletions src/db/db/dbAsIfFlatRegion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,14 +1146,14 @@ AsIfFlatRegion::run_check (db::edge_relation_type rel, bool different_polygons,
check.set_min_projection (options.min_projection);
check.set_max_projection (options.max_projection);

std::vector<generic_shape_iterator<db::Polygon> > others;
std::vector<db::RegionIterator> others;
std::vector<bool> foreign;
bool has_other = false;
bool other_is_merged = true;

if (other == subject_regionptr () || other == foreign_regionptr ()) {
foreign.push_back (other == foreign_regionptr ());
others.push_back (begin_merged ());
others.push_back (polygons);
other_is_merged = primary_is_merged;
} else {
foreign.push_back (false);
Expand Down
31 changes: 15 additions & 16 deletions src/db/db/dbBoxScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,12 @@ class box_scanner

while (cc != current) {
rec.finish (cc->first, cc->second);
typename std::set<std::pair<const Obj *, const Obj *> >::iterator s;
s = seen.lower_bound (std::make_pair (cc->first, (const Obj *)0));
auto s = seen.lower_bound (std::make_pair (cc->first, (const Obj *)0));
auto s0 = s;
while (s != seen.end () && s->first == cc->first) {
seen.erase (s++);
}
s = seen.lower_bound (std::make_pair ((const Obj *)0, cc->first));
while (s != seen.end () && s->second == cc->first) {
seen.erase (s++);
++s;
}
seen.erase (s0, s);
++cc;
}

Expand Down Expand Up @@ -429,8 +426,8 @@ class box_scanner
for (iterator_type i = f0; i != f; ++i) {
for (iterator_type j = c; j < i; ++j) {
if (bs_boxes_overlap (bc (*i->first), bc (*j->first), enl)) {
if (seen.insert (std::make_pair (i->first, j->first)).second) {
seen.insert (std::make_pair (j->first, i->first));
if (seen.find (std::make_pair (i->first, j->first)) == seen.end () && seen.find (std::make_pair (j->first, i->first)) == seen.end ()) {
seen.insert (std::make_pair (i->first, j->first));
rec.add (i->first, i->second, j->first, j->second);
if (rec.stop ()) {
return false;
Expand Down Expand Up @@ -791,21 +788,23 @@ class box_scanner2

while (cc1 != current1) {
rec.finish1 (cc1->first, cc1->second);
typename std::set<std::pair<const Obj1 *, const Obj2 *> >::iterator s;
s = seen1.lower_bound (std::make_pair (cc1->first, (const Obj2 *)0));
auto s = seen1.lower_bound (std::make_pair (cc1->first, (const Obj2 *)0));
auto s0 = s;
while (s != seen1.end () && s->first == cc1->first) {
seen1.erase (s++);
++s;
}
seen1.erase (s0, s);
++cc1;
}

while (cc2 != current2) {
rec.finish2 (cc2->first, cc2->second);
typename std::set<std::pair<const Obj2 *, const Obj1 *> >::iterator s;
s = seen2.lower_bound (std::make_pair (cc2->first, (const Obj1 *)0));
auto s = seen2.lower_bound (std::make_pair (cc2->first, (const Obj1 *)0));
auto s0 = s;
while (s != seen2.end () && s->first == cc2->first) {
seen2.erase (s++);
++s;
}
seen2.erase (s0, s);
++cc2;
}

Expand Down Expand Up @@ -883,7 +882,7 @@ class box_scanner2
x = xx;

if (m_report_progress) {
progress->set (std::min (f1 - m_pp1.begin (), f2 - m_pp2.begin ()));
progress->set ((f1 - m_pp1.begin ()) + (f2 - m_pp2.begin ()));
}

}
Expand Down
Loading

0 comments on commit 40848be

Please sign in to comment.