mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-30 01:39:30 +02:00
Merge branch 'drc-enhancements', remote-tracking branch 'origin' into lvs-debug
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
+32
@@ -12,6 +12,18 @@ l2 = input(2, 0)
|
||||
l1.output(1, 0)
|
||||
l2.output(2, 0)
|
||||
|
||||
def split_vs_normal(r, f1, f2, *args)
|
||||
d1 = r.send(f1, *args)[0].data
|
||||
d2 = r.send(f2, *args).data
|
||||
d1.to_s == d2.to_s || raise("#{f1.to_s} vs. #{f2.to_s} check failed: #{d1.to_s} != #{d2.to_s}")
|
||||
end
|
||||
|
||||
def splitn_vs_normal(r, f1, f2, *args)
|
||||
d1 = r.send(f1, *args)[1].data
|
||||
d2 = r.send(f2, *args).data
|
||||
d1.to_s == d2.to_s || raise("#{f1.to_s} vs. #{f2.to_s} check failed: #{d1.to_s} != #{d2.to_s}")
|
||||
end
|
||||
|
||||
l1.interacting(l2, 1).output(100, 0)
|
||||
l1.interacting(l2, 2).output(101, 0)
|
||||
l1.interacting(l2, 1..2).output(102, 0)
|
||||
@@ -22,6 +34,11 @@ else
|
||||
end
|
||||
l1.interacting(l2, 1, 2).output(104, 0)
|
||||
|
||||
split_vs_normal(l1, :split_interacting, :interacting, l2, 1)
|
||||
split_vs_normal(l1, :split_interacting, :interacting, l2, 2)
|
||||
split_vs_normal(l1, :split_interacting, :interacting, l2, 1..2)
|
||||
split_vs_normal(l1, :split_interacting, :interacting, l2, 1, 2)
|
||||
|
||||
l1.overlapping(l2, 1).output(110, 0)
|
||||
l1.overlapping(l2, 2).output(111, 0)
|
||||
l1.overlapping(l2, 1..2).output(112, 0)
|
||||
@@ -32,6 +49,11 @@ else
|
||||
end
|
||||
l1.overlapping(l2, 1, 2).output(114, 0)
|
||||
|
||||
split_vs_normal(l1, :split_overlapping, :overlapping, l2, 1)
|
||||
split_vs_normal(l1, :split_overlapping, :overlapping, l2, 2)
|
||||
split_vs_normal(l1, :split_overlapping, :overlapping, l2, 1..2)
|
||||
split_vs_normal(l1, :split_overlapping, :overlapping, l2, 1, 2)
|
||||
|
||||
l = l1.dup
|
||||
l.select_interacting(l2, 1)
|
||||
l.output(200, 0)
|
||||
@@ -82,6 +104,11 @@ else
|
||||
end
|
||||
l1.not_interacting(l2, 1, 2).output(304, 0)
|
||||
|
||||
splitn_vs_normal(l1, :split_interacting, :not_interacting, l2, 1)
|
||||
splitn_vs_normal(l1, :split_interacting, :not_interacting, l2, 2)
|
||||
splitn_vs_normal(l1, :split_interacting, :not_interacting, l2, 1..2)
|
||||
splitn_vs_normal(l1, :split_interacting, :not_interacting, l2, 1, 2)
|
||||
|
||||
l1.not_overlapping(l2, 1).output(310, 0)
|
||||
l1.not_overlapping(l2, 2).output(311, 0)
|
||||
l1.not_overlapping(l2, 1..2).output(312, 0)
|
||||
@@ -92,6 +119,11 @@ else
|
||||
end
|
||||
l1.not_overlapping(l2, 1, 2).output(314, 0)
|
||||
|
||||
splitn_vs_normal(l1, :split_overlapping, :not_overlapping, l2, 1)
|
||||
splitn_vs_normal(l1, :split_overlapping, :not_overlapping, l2, 2)
|
||||
splitn_vs_normal(l1, :split_overlapping, :not_overlapping, l2, 1..2)
|
||||
splitn_vs_normal(l1, :split_overlapping, :not_overlapping, l2, 1, 2)
|
||||
|
||||
l = l1.dup
|
||||
l.select_not_interacting(l2, 1)
|
||||
l.output(400, 0)
|
||||
|
||||
Vendored
+32
@@ -10,11 +10,33 @@ b = input(2, 0)
|
||||
a.output(1, 0)
|
||||
b.output(2, 0)
|
||||
|
||||
def split_vs_normal(r, f1, f2, *args)
|
||||
d1 = r.send(f1, *args)[0].data
|
||||
d2 = r.send(f2, *args).data
|
||||
d1.to_s == d2.to_s || raise("#{f1.to_s} vs. #{f2.to_s} check failed: #{d1.to_s} != #{d2.to_s}")
|
||||
end
|
||||
|
||||
def splitn_vs_normal(r, f1, f2, *args)
|
||||
d1 = r.send(f1, *args)[1].data
|
||||
d2 = r.send(f2, *args).data
|
||||
d1.to_s == d2.to_s || raise("#{f1.to_s} vs. #{f2.to_s} check failed: #{d1.to_s} != #{d2.to_s}")
|
||||
end
|
||||
|
||||
a.covering(b).output(100, 0)
|
||||
a.covering(b, 1..1).output(101, 0)
|
||||
a.covering(b, 2..2).output(102, 0)
|
||||
a.covering(b, 3..3).output(103, 0)
|
||||
b.inside(a).output(110, 0)
|
||||
a.not_covering(b).output(120, 0)
|
||||
b.not_inside(a).output(130, 0)
|
||||
|
||||
split_vs_normal(a, :split_covering, :covering, b)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 1..1)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 2..2)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 3..3)
|
||||
split_vs_normal(b, :split_inside, :inside, a)
|
||||
splitn_vs_normal(a, :split_covering, :not_covering, b)
|
||||
splitn_vs_normal(b, :split_inside, :not_inside, a)
|
||||
|
||||
deep
|
||||
|
||||
@@ -26,4 +48,14 @@ a.covering(b, 1..1).output(201, 0)
|
||||
a.covering(b, 2..2).output(202, 0)
|
||||
a.covering(b, 3..3).output(203, 0)
|
||||
b.inside(a).output(210, 0)
|
||||
a.not_covering(b).output(220, 0)
|
||||
b.not_inside(a).output(230, 0)
|
||||
|
||||
split_vs_normal(a, :split_covering, :covering, b)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 1..1)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 2..2)
|
||||
split_vs_normal(a, :split_covering, :covering, b, 3..3)
|
||||
split_vs_normal(b, :split_inside, :inside, a)
|
||||
splitn_vs_normal(a, :split_covering, :not_covering, b)
|
||||
splitn_vs_normal(b, :split_inside, :not_inside, a)
|
||||
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
||||
b = input(0, 0)
|
||||
a = input(1, 0)
|
||||
|
||||
b.output(0, 0)
|
||||
a.output(1, 0)
|
||||
|
||||
a.with_density(0..0.1, tile_size(10.um), tile_boundary(b)).output(100, 0)
|
||||
a.without_density(0..0.1, tile_size(10.um)).output(101, 0)
|
||||
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um)).output(102, 0)
|
||||
a.with_density(0.1, nil, tile_size(10.um, 20.um)).output(103, 0)
|
||||
a.with_density(0.1, 1.0, tile_size(10.um), tile_step(10.um, 20.um)).output(104, 0)
|
||||
a.with_density(0.1, nil, tile_size(10.um), tile_origin(25.um, 10.um), tile_count(10, 15)).output(105, 0)
|
||||
a.with_density(0..0.1, tile_size(100.um), tile_step(10.um)).output(110, 0)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+25
@@ -148,6 +148,7 @@ def run_testsuite(dm, ic, tiled = false, hier = false)
|
||||
b.not_interacting(a).output(lb, dm + 1)
|
||||
b.interacting(empty).output(lb, dm + 2)
|
||||
b.not_interacting(empty).output(lb, dm + 3)
|
||||
|
||||
b.interacting(a).in(b).output(lb + 1, dm)
|
||||
(b|a).not_in(b).output(lb + 2, dm)
|
||||
x.in(b).output(lb + 3, dm)
|
||||
@@ -160,18 +161,42 @@ def run_testsuite(dm, ic, tiled = false, hier = false)
|
||||
b.not_inside(c).output(lb, dm + 1)
|
||||
b.inside(empty).output(lb, dm + 2)
|
||||
b.not_inside(empty).output(lb, dm + 3)
|
||||
(p, m) = b.split_inside(c)
|
||||
p.output(lb, dm + 10)
|
||||
m.output(lb, dm + 11)
|
||||
|
||||
b.covering(c).output(lb, dm + 100)
|
||||
b.not_covering(c).output(lb, dm + 101)
|
||||
b.covering(empty).output(lb, dm + 102)
|
||||
b.not_covering(empty).output(lb, dm + 103)
|
||||
(p, m) = b.split_covering(c)
|
||||
p.output(lb, dm + 110)
|
||||
m.output(lb, dm + 111)
|
||||
|
||||
b.outside(c).output(lb + 1, dm)
|
||||
b.not_outside(c).output(lb + 1, dm + 1)
|
||||
b.outside(empty).output(lb + 1, dm + 2)
|
||||
b.not_outside(empty).output(lb + 1, dm + 3)
|
||||
(p, m) = b.split_outside(c)
|
||||
p.output(lb + 1, dm + 10)
|
||||
m.output(lb + 1, dm + 11)
|
||||
|
||||
b.overlapping(c).output(lb + 2, dm)
|
||||
b.not_overlapping(c).output(lb + 2, dm + 1)
|
||||
b.overlapping(empty).output(lb + 2, dm + 2)
|
||||
b.not_overlapping(empty).output(lb + 2, dm + 3)
|
||||
(p, m) = b.split_overlapping(c)
|
||||
p.output(lb + 2, dm + 10)
|
||||
m.output(lb + 2, dm + 11)
|
||||
|
||||
b.interacting(c).output(lb + 3, dm)
|
||||
b.not_interacting(c).output(lb + 3, dm + 1)
|
||||
b.interacting(empty).output(lb + 3, dm + 2)
|
||||
b.not_interacting(empty).output(lb + 3, dm + 3)
|
||||
(p, m) = b.split_interacting(c)
|
||||
p.output(lb + 3, dm + 10)
|
||||
m.output(lb + 3, dm + 11)
|
||||
|
||||
bdup = b.dup
|
||||
bdup.select_inside(c)
|
||||
bdup.xor(b.inside(c)).output(lb + 4, dm)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
+3
@@ -289,6 +289,9 @@ class DBPolygonTests(unittest.TestCase):
|
||||
p = pya.Polygon( [ pya.Point.new(0, 0), pya.Point.new(10, 50), pya.Point.new(0, 100), pya.Point.new(200, 100), pya.Point.new(200, 0) ])
|
||||
self.assertEqual(str(p.smooth(5)), "(0,0;10,50;0,100;200,100;200,0)")
|
||||
self.assertEqual(str(p.smooth(15)), "(0,0;0,100;200,100;200,0)")
|
||||
p = pya.Polygon( [ pya.Point.new(0, 0), pya.Point.new(10, 50), pya.Point.new(10, 100), pya.Point.new(200, 100), pya.Point.new(200, 0) ])
|
||||
self.assertEqual(str(p.smooth(15, False)), "(0,0;10,100;200,100;200,0)")
|
||||
self.assertEqual(str(p.smooth(15, True)), "(0,0;10,50;10,100;200,100;200,0)")
|
||||
|
||||
# Ellipse constructor
|
||||
p = pya.Polygon.ellipse( pya.Box(-10000, -20000, 30000, 40000), 200 )
|
||||
|
||||
Vendored
+3
@@ -304,6 +304,9 @@ class DBPolygon_TestClass < TestBase
|
||||
p = RBA::Polygon::new( [ RBA::Point.new(0, 0), RBA::Point.new(10, 50), RBA::Point.new(0, 100), RBA::Point.new(200, 100), RBA::Point.new(200, 0) ])
|
||||
assert_equal(p.smooth(5).to_s, "(0,0;10,50;0,100;200,100;200,0)")
|
||||
assert_equal(p.smooth(15).to_s, "(0,0;0,100;200,100;200,0)")
|
||||
p = RBA::Polygon::new( [ RBA::Point.new(0, 0), RBA::Point.new(10, 50), RBA::Point.new(10, 100), RBA::Point.new(200, 100), RBA::Point.new(200, 0) ])
|
||||
assert_equal(p.smooth(15, false).to_s, "(0,0;10,100;200,100;200,0)")
|
||||
assert_equal(p.smooth(15, true).to_s, "(0,0;10,50;10,100;200,100;200,0)")
|
||||
|
||||
# Ellipse constructor
|
||||
p = RBA::Polygon::ellipse( RBA::Box::new(-10000, -20000, 30000, 40000), 200 )
|
||||
|
||||
Vendored
+19
@@ -525,34 +525,49 @@ class DBRegion_TestClass < TestBase
|
||||
|
||||
r1 = RBA::Region::new
|
||||
r1.insert(RBA::Box::new(10, 20, 100, 200))
|
||||
r11 = r1.dup
|
||||
r1.insert(RBA::Box::new(50, 70, 150, 270))
|
||||
r1.insert(RBA::Box::new(100, 70, 250, 270))
|
||||
r2 = RBA::Region::new(RBA::Box::new(-10, -20, 100, 200))
|
||||
r3 = RBA::Region::new(RBA::Box::new(150, 270, 160, 280))
|
||||
r3 += r2
|
||||
r21 = r2.dup
|
||||
r21 += RBA::Region::new(RBA::Box::new(110, -20, 200, 200))
|
||||
|
||||
assert_equal(r1.merged_semantics?, true)
|
||||
r1.merged_semantics = false
|
||||
assert_equal(r1.merged_semantics?, false)
|
||||
|
||||
assert_equal(r1.inside(r2).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(r1.split_inside(r2)[0].to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.not_inside(r2).to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(csort(r1.split_inside(r2)[1].to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(r21.covering(r11).to_s, "(-10,-20;-10,200;100,200;100,-20)")
|
||||
assert_equal(r21.split_covering(r11)[0].to_s, "(-10,-20;-10,200;100,200;100,-20)")
|
||||
assert_equal(csort(r21.not_covering(r11).to_s), csort("(110,-20;110,200;200,200;200,-20)"))
|
||||
assert_equal(csort(r21.split_covering(r11)[1].to_s), csort("(110,-20;110,200;200,200;200,-20)"))
|
||||
assert_equal(csort(r1.interacting(r2).to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(csort(r1.interacting(r3, 1).to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(csort(r1.interacting(r3, 2).to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(csort(r1.split_interacting(r3, 2)[0].to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(r1.interacting(r3, 3).to_s, "")
|
||||
assert_equal(r1.interacting(r3, 1, 1).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.interacting(r3, 2, 2).to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(r1.not_interacting(r2).to_s, "")
|
||||
assert_equal(r1.not_interacting(r3, 1).to_s, "")
|
||||
assert_equal(r1.not_interacting(r3, 2).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(r1.split_interacting(r3, 2)[1].to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.not_interacting(r3, 3).to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(csort(r1.not_interacting(r3, 1, 1).to_s), csort("(50,70;50,270;150,270;150,70);(100,70;100,270;250,270;250,70)"))
|
||||
assert_equal(r1.not_interacting(r3, 2, 2).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.overlapping(r2).to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(csort(r1.split_overlapping(r2)[0].to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(r1.not_overlapping(r2).to_s, "(100,70;100,270;250,270;250,70)")
|
||||
assert_equal(r1.split_overlapping(r2)[1].to_s, "(100,70;100,270;250,270;250,70)")
|
||||
assert_equal(r1.outside(r2).to_s, "(100,70;100,270;250,270;250,70)")
|
||||
assert_equal(r1.split_outside(r2)[0].to_s, "(100,70;100,270;250,270;250,70)")
|
||||
assert_equal(csort(r1.not_outside(r2).to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(csort(r1.split_outside(r2)[1].to_s), csort("(10,20;10,200;100,200;100,20);(50,70;50,270;150,270;150,70)"))
|
||||
|
||||
e2 = RBA::Edges::new(RBA::Edge::new(-10, -20, 100, 200))
|
||||
e3 = RBA::Edges::new(RBA::Edge::new(150, 270, 160, 280))
|
||||
@@ -561,12 +576,14 @@ class DBRegion_TestClass < TestBase
|
||||
assert_equal(csort(r1.interacting(e2).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.interacting(e3, 1).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.interacting(e3, 2).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(csort(r1.split_interacting(e3, 2)[0].to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(r1.interacting(e3, 3).to_s, "")
|
||||
assert_equal(r1.interacting(e3, 1, 1).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.interacting(e3, 2, 2).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(r1.not_interacting(e2).to_s, "")
|
||||
assert_equal(r1.not_interacting(e3, 1).to_s, "")
|
||||
assert_equal(r1.not_interacting(e3, 2).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(r1.split_interacting(e3, 2)[1].to_s, "(10,20;10,200;100,200;100,20)")
|
||||
assert_equal(csort(r1.not_interacting(e3, 3).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.not_interacting(e3, 1, 1).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70)"))
|
||||
assert_equal(r1.not_interacting(e3, 2, 2).to_s, "(10,20;10,200;100,200;100,20)")
|
||||
@@ -577,6 +594,7 @@ class DBRegion_TestClass < TestBase
|
||||
|
||||
assert_equal(csort(r1.interacting(t2).to_s), csort("(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.interacting(t3, 1).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.split_interacting(t3, 1)[0].to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(r1.interacting(t3, 2).to_s, "(50,70;50,270;150,270;150,70)")
|
||||
assert_equal(r1.interacting(t3, 3).to_s, "")
|
||||
assert_equal(csort(r1.interacting(t3, 1, 1).to_s), csort("(100,70;100,270;250,270;250,70);(10,20;10,200;100,200;100,20)"))
|
||||
@@ -584,6 +602,7 @@ class DBRegion_TestClass < TestBase
|
||||
assert_equal(r1.not_interacting(t2).to_s, "(100,70;100,270;250,270;250,70)")
|
||||
assert_equal(r1.not_interacting(t3, 1).to_s, "")
|
||||
assert_equal(csort(r1.not_interacting(t3, 2).to_s), csort("(100,70;100,270;250,270;250,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.split_interacting(t3, 2)[1].to_s), csort("(100,70;100,270;250,270;250,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(csort(r1.not_interacting(t3, 3).to_s), csort("(100,70;100,270;250,270;250,70);(50,70;50,270;150,270;150,70);(10,20;10,200;100,200;100,20)"))
|
||||
assert_equal(r1.not_interacting(t3, 1, 1).to_s, "(50,70;50,270;150,270;150,70)")
|
||||
assert_equal(csort(r1.not_interacting(t3, 2, 2).to_s), csort("(100,70;100,270;250,270;250,70);(10,20;10,200;100,200;100,20)"))
|
||||
|
||||
Reference in New Issue
Block a user