From 2fa0d21615c31ee90bf8db4019eecf32830bb185 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 6 Oct 2018 22:25:24 +0200 Subject: [PATCH] Added self-overlap-with-sizing tests. --- src/plugins/tools/netx/testdata/hlp1.oas | Bin 740 -> 830 bytes src/plugins/tools/netx/testdata/hlp10.oas | Bin 584 -> 607 bytes src/plugins/tools/netx/testdata/hlp2.oas | Bin 1134 -> 1376 bytes src/plugins/tools/netx/testdata/hlp3.oas | Bin 817 -> 968 bytes src/plugins/tools/netx/testdata/hlp4.oas | Bin 830 -> 984 bytes src/plugins/tools/netx/testdata/hlp5.oas | Bin 936 -> 1141 bytes src/plugins/tools/netx/testdata/hlp6.oas | Bin 1468 -> 1819 bytes src/plugins/tools/netx/testdata/hlp7.oas | Bin 839 -> 1008 bytes src/plugins/tools/netx/testdata/hlp8.oas | Bin 1026 -> 1286 bytes src/plugins/tools/netx/testdata/hlp9.oas | Bin 936 -> 1110 bytes .../netx/unit_tests/dbHierProcessorTests.cc | 119 +++++++++++++----- 11 files changed, 86 insertions(+), 33 deletions(-) diff --git a/src/plugins/tools/netx/testdata/hlp1.oas b/src/plugins/tools/netx/testdata/hlp1.oas index 39fe2a5dd1427b939ce55a6a6aa8e56e23c28b17..27c260c4832027592f7da843eca2ee29e52e63eb 100644 GIT binary patch delta 109 zcmaFDx{qzc6UJy!%X~(z8yORrH!9sQTOqQ-ZKm@|w;kd)&6ezBy2~wU!N}C%aDs8p zI>tYOKn}+Z*@LP-lne6Xj5-`5g^Uf7D?}J3F@A~4XXLt( zF@brb(hai}A}icxII#)T)+rZ zG{N+x0#Fgu^q1MZOoAU6-dtn6pdt8yae~Z_DU2f3Obl1VE@*6MW@@MvDQJ-F5oHjW z?8&UkEK(gL2m=+oeoB($%V|nSsEG`7yz9&cC!Eg delta 87 zcmV-d0I2`q3hoGyc@QxJ217_mOhhsR15{5?4FQu60&5Hn02FHh0Du{&6rcu?!Sn%c tk&P@C4FVDH0FWHGlmQX&0qoWR&?ppp0RW>R0|5gRIRcaF0yLvw1OYGP7_e-eO;r}PU}WlWIKkL6 ziE%Hhr~!yG!Su^aMhNo-`xn2-J&f+$qMCV(Ob2*=aNUrde1b7JJfD&2f+JAYbV(t| zgdfTql(q=`5d^Y1Zpa=~{h@q7b%M+fS0b=J5{><#0UUu^+0C; delta 50 zcmX@XzL9N1598!BjP8>)nLNbv7?}?6{NS1(b3;~C1H}FydSezN)8vaxUnf6c;$UK6 F006v35Xb-k diff --git a/src/plugins/tools/netx/testdata/hlp4.oas b/src/plugins/tools/netx/testdata/hlp4.oas index 508689d78384331dd520173a06f620bce6f41563..ea722bf014d066b17a015c661a82eeccf4c9d86c 100644 GIT binary patch delta 246 zcmdnTc7uIFr?{wfJ_94u1;-ccZyc5siqtYSNcM;_Fl?Nt#^@kwna{{|BVz*dMx`5O zD@0bf&2(PrwnO};*_63VQ5+dc1GWN zQO!I?rUN`bxNgXbYJgZDL~qPu1R2frLwSSJ7J)y4K$AFb$R1Svp?pAfg3J%)PKSvy zUrd)2irO$Tt#F&byksZSU2X=5eLs}Hm;!YGWj^R_;OzO#bcdS(=;|wC7c@3BGchoT klzb4~A>MG5i9w`hhxiB4$qGztj7*aqnSQf0G%zp#0B5CB00000 delta 64 zcmcb?zK?A}Cx=Kn6GMY!kLbn)YK)WFn0zO1V^We7wajB=I>7UTYl6%TSy2rT`-A9> TS&U4RA2NNN{DFysiGcwChOrb7 diff --git a/src/plugins/tools/netx/testdata/hlp5.oas b/src/plugins/tools/netx/testdata/hlp5.oas index dd9ffd9e8730124de87f8f13003edee842f41cb2..04963b4004a1fbe601de1936ebd4f499d832c79f 100644 GIT binary patch delta 263 zcmZ3%{*`0HWJU*3%X~(z8yORrH!9sQTOqQ-ZKm@|w;kd)&8Ey{nyM^n!N}C%aDuUC z660Q0Q3DWXg6Wr;j1cAv_Ah>uCo{Tpi)!XEG9BRg!F5A+@_ELf@O(z53yv??-#9EO z1ex$dd4tj#=|6%%HpdOwgQ`E252#L%`JvqDFi{4q#)gq;h1&$?IY*f8ax*~e{Gt5D z0jL8g^FeO|XUjjPJKPMD&6)I=MH%xZr!v`C1Kka_ ZkTE@a7gA& VkU21)iD_~p^QXxZn7Nr47yuHc7GnSa diff --git a/src/plugins/tools/netx/testdata/hlp6.oas b/src/plugins/tools/netx/testdata/hlp6.oas index 56db21f0ac53065c3451ab3f5d4bb594487ff39e..38a6ae94af595d277825cb027aed8ecd62aeea76 100644 GIT binary patch delta 378 zcmdnPJ)3VsI8(i-Wj-U*1;-ccZyc5sirO%8-N=~0yiw_f*$R;rZZn-%y6q6ZX*TBw z(_L-`Q42<To#0IAtdzNSxz_>_OEZ$_G>@$ox?5beJduHH~S7 z+XQB)ZX1w}38sGzF#Zu_5H$eteke=5aex^0g8fe^1JHh^4|*FoTmCWK;ocm^l!oNK zFQz@;7=hZbI&jHOCXil`i{`9jd@`Ado1v#t2%Ezo#sGZ+w7s3NCHu?_W{|%??gSbF zvI59^puK^!=QGok=`8M|8jNf^#9vyzu$Iz?sS+a^F$J+XoBgNnIJ_#dpjI}Zt$D@no+?-)E?PU Z45B7*S22j%AUTUcq!#Y3&0V4R%Iq`)mw4j0?JpUIFB08>d0zyJUM diff --git a/src/plugins/tools/netx/testdata/hlp8.oas b/src/plugins/tools/netx/testdata/hlp8.oas index 9b32237c9ff7f20a379f22f478157cdec583377b..3b9f1acc1dc5644b86af93ae4f54e58788895ed9 100644 GIT binary patch delta 298 zcmZqTXyckNQC-wJpMjBSh1&$?B|Dk!a*J9pGJVk7z}fSe=?=F@CDRqL3mO}mnHV=R@r$Q)4J!1;oGBj*Geko=NDpf0u-mKT9$TyQ*~`htD3B~wEv*xVn=Ka{r! n{1F7X1!4zSHKrXlNPcF3xcrCm7gL~4pbR_!7&h-@@?-=6ib`nP delta 35 rcmZqUYT}qMkz1sgiQ$Ua1&s~OOdEH|F-{g^s-OIVsbTY8W=}={*MJOD diff --git a/src/plugins/tools/netx/testdata/hlp9.oas b/src/plugins/tools/netx/testdata/hlp9.oas index 16d63a4f8704786db6ac1025095c4ea6a2ee8f30..9b597f891b983d01a388f2b1181b6eee97608c45 100644 GIT binary patch delta 221 zcmZ3%evM*S%Dmm8?pyge<&YNogni=xzk~y%o9nNq6wy7W`YzMfONcI|Kc}Up2^b! z &result) const + { + db::ShapeInteractions sized_interactions = interactions; + for (db::ShapeInteractions::iterator i = sized_interactions.begin (); i != sized_interactions.end (); ++i) { + + const db::PolygonRef &ref = interactions.shape (i->first); + db::Polygon poly = ref.obj ().transformed (ref.trans ()); + poly.size (m_dist / 2, m_dist / 2); + sized_interactions.add_shape (i->first, db::PolygonRef (poly, layout->shape_repository ())); + + for (db::ShapeInteractions::iterator2 j = i->second.begin (); j != i->second.end (); ++j) { + const db::PolygonRef &ref = interactions.shape (*j); + db::Polygon poly = ref.obj ().transformed (ref.trans ()); + poly.size (m_dist / 2, m_dist / 2); + sized_interactions.add_shape (*j, db::PolygonRef (poly, layout->shape_repository ())); + } + + } + + SelfOverlapMergeLocalOperation::compute_local (layout, sized_interactions, result); + } + + db::Coord dist () const + { + return m_dist; + } + +private: + db::Coord m_dist; +}; + /** * @brief Turns a layer into polygons and polygon references * The hierarchical processor needs polygon references and can't work on polygons directly. @@ -228,8 +272,12 @@ void run_test_bool_with_size_gen (tl::TestBase *_this, const char *file, TestMod p.layer = 2; p.datatype = 0; - lmap.map (db::LDPair (2, 0), l2 = layout_org.insert_layer ()); - layout_org.set_properties (l2, p); + if (mode == TMSelfOverlap) { + lmap.map (db::LDPair (2, 0), l2 = l1); + } else { + lmap.map (db::LDPair (2, 0), l2 = layout_org.insert_layer ()); + layout_org.set_properties (l2, p); + } p.layer = out_layer_num; p.datatype = 0; @@ -246,19 +294,27 @@ void run_test_bool_with_size_gen (tl::TestBase *_this, const char *file, TestMod normalize_layer (layout_org, l1); normalize_layer (layout_org, l2); - BoolAndOrNotWithSizedLocalOperation op (mode == TMAnd, dist); + db::LocalOperation *lop = 0; + BoolAndOrNotWithSizedLocalOperation bool_op (mode == TMAnd, dist); + SelfOverlapWithSizedLocalOperation self_intersect_op (2, dist); + if (mode == TMSelfOverlap) { + lop = &self_intersect_op; + } else { + lop = &bool_op; + } + if (single) { db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ())); if (! context_doc) { - proc.run (&op, l1, l2, lout); + proc.run (lop, l1, l2, lout); } else { db::LocalProcessorContexts contexts; - proc.compute_contexts (contexts, &op, l1, l2); + proc.compute_contexts (contexts, lop, l1, l2); *context_doc = contexts_to_s (&layout_org, contexts); - proc.compute_results (contexts, &op, lout); + proc.compute_results (contexts, lop, lout); } } else { @@ -268,12 +324,12 @@ void run_test_bool_with_size_gen (tl::TestBase *_this, const char *file, TestMod db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ()), &layout_org2, &layout_org2.cell (*layout_org2.begin_top_down ())); if (! context_doc) { - proc.run (&op, l1, l2, lout); + proc.run (lop, l1, l2, lout); } else { db::LocalProcessorContexts contexts; - proc.compute_contexts (contexts, &op, l1, l2); + proc.compute_contexts (contexts, lop, l1, l2); *context_doc = contexts_to_s (&layout_org, contexts); - proc.compute_results (contexts, &op, lout); + proc.compute_results (contexts, lop, lout); } } @@ -853,55 +909,55 @@ TEST(TwoInputsNotWithSize10) TEST(BasicSelfOverlap1) { - // Simple flat AND + // Simple flat Self overlap run_test_bool (_this, "hlp1.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap2) { - // Up/down and down/up interactions, AND + // Up/down and down/up interactions, Self overlap run_test_bool (_this, "hlp2.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap3) { - // Variant building, AND + // Variant building, Self overlap run_test_bool (_this, "hlp3.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap4) { - // Sibling interactions, variant building, AND + // Sibling interactions, variant building, Self overlap run_test_bool (_this, "hlp4.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap5) { - // Variant building with intermediate hierarchy, AND + // Variant building with intermediate hierarchy, Self overlap run_test_bool (_this, "hlp5.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap6) { - // Extreme variants (copy, vanishing), AND + // Extreme variants (copy, vanishing), Self overlap run_test_bool (_this, "hlp6.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap7) { - // Context replication - direct and indirect, AND + // Context replication - direct and indirect, Self overlap run_test_bool (_this, "hlp7.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap8) { - // Mixed sibling-parent contexts, AND + // Mixed sibling-parent contexts, Self overlap run_test_bool (_this, "hlp8.oas", TMSelfOverlap, 110); } TEST(BasicSelfOverlap9) { - // Top-level ring structure, AND + // Top-level ring structure, Self overlap std::string doc; run_test_bool (_this, "hlp9.oas", TMSelfOverlap, 110, &doc); EXPECT_EQ (doc, @@ -917,62 +973,61 @@ TEST(BasicSelfOverlap9) TEST(BasicSelfOverlap10) { - // Array instances, AND + // Array instances, Self overlap run_test_bool (_this, "hlp10.oas", TMSelfOverlap, 110); } -#if 0 // @@@ TEST(BasicSelfOverlapWithSize1) { - // Simple flat AND + // Simple flat Self overlap run_test_bool_with_size (_this, "hlp1.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize2) { - // Up/down and down/up interactions, AND + // Up/down and down/up interactions, Self overlap run_test_bool_with_size (_this, "hlp2.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize3) { - // Variant building, AND + // Variant building, Self overlap run_test_bool_with_size (_this, "hlp3.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize4) { - // Sibling interactions, variant building, AND + // Sibling interactions, variant building, Self overlap run_test_bool_with_size (_this, "hlp4.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize5) { - // Variant building with intermediate hierarchy, AND + // Variant building with intermediate hierarchy, Self overlap run_test_bool_with_size (_this, "hlp5.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize6) { - // Extreme variants (copy, vanishing), AND + // Extreme variants (copy, vanishing), Self overlap run_test_bool_with_size (_this, "hlp6.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize7) { - // Context replication - direct and indirect, AND + // Context replication - direct and indirect, Self overlap run_test_bool_with_size (_this, "hlp7.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize8) { - // Mixed sibling-parent contexts, AND + // Mixed sibling-parent contexts, Self overlap run_test_bool_with_size (_this, "hlp8.oas", TMSelfOverlap, 1500, 111); } TEST(BasicSelfOverlapWithSize9) { - // Top-level ring structure, AND + // Top-level ring structure, Self overlap std::string doc; run_test_bool_with_size (_this, "hlp9.oas", TMSelfOverlap, 1500, 111, &doc); EXPECT_EQ (doc, @@ -981,16 +1036,14 @@ TEST(BasicSelfOverlapWithSize9) // from atop the CHILD cell don't interact with shapes inside CHILD, so there are 4 shapes rather than // 6. And the shapes from top inside the ring are not seen by the RING's subject shapes. "TOP[1] 0 insts, 0 shapes (1 times)\n" - "RING[1] 0 insts, 0 shapes (1 times)\n" + "RING[1] 0 insts, 1 shapes (1 times)\n" "CHILD1[1] 0 insts, 6 shapes (2 times)\n" ); } TEST(BasicSelfOverlapWithSize10) { - // Array instances, AND + // Array instances, Self overlap run_test_bool_with_size (_this, "hlp10.oas", TMSelfOverlap, 150, 111); } -#endif -