diff --git a/src/db/db/dbCompoundOperation.cc b/src/db/db/dbCompoundOperation.cc index 0100e561b..65f3778cf 100644 --- a/src/db/db/dbCompoundOperation.cc +++ b/src/db/db/dbCompoundOperation.cc @@ -835,6 +835,7 @@ void compound_region_generic_operation_node::implement_compute_local const CompoundRegionOperationNode *self = child (0); std::vector > self_result; + self_result.push_back (std::unordered_set ()); shape_interactions self_interactions_heap; const shape_interactions &self_interactions = interactions_for_child (interactions, 0, self_interactions_heap); @@ -851,6 +852,7 @@ void compound_region_generic_operation_node::implement_compute_local const CompoundRegionOperationNode *intruder = child (ci); std::vector > intruder_result; + intruder_result.push_back (std::unordered_set ()); shape_interactions intruder_interactions_heap; const shape_interactions &intruder_interactions = interactions_for_child (interactions, ci, intruder_interactions_heap); diff --git a/src/db/unit_tests/dbCompoundOperationTests.cc b/src/db/unit_tests/dbCompoundOperationTests.cc index 0bc3ec42a..41363e795 100644 --- a/src/db/unit_tests/dbCompoundOperationTests.cc +++ b/src/db/unit_tests/dbCompoundOperationTests.cc @@ -137,9 +137,6 @@ TEST(3_BooleanOperations) reader.read (ly); } - db::RegionCheckOptions check_options; - check_options.metrics = db::Projection; - unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); @@ -166,3 +163,73 @@ TEST(3_BooleanOperations) db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au3.gds"); } +TEST(4_SizeOperation) +{ + db::Layout ly; + { + std::string fn (tl::testsrc ()); + fn += "/testdata/drc/compound_4.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); + db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + + db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); + db::CompoundRegionSizeOperationNode geo_size (250, 250, 2, primary); + + db::Region res = r.cop_to_region (geo_size); + + unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1000); + + db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2); + db::CompoundRegionSizeOperationNode geo_size2 (-250, -250, 2, secondary); + + res = r.cop_to_region (geo_size2); + + unsigned int l1001 = ly.get_layer (db::LayerProperties (1001, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1001); + + CHECKPOINT(); + db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au4.gds"); +} + +TEST(5_InteractOperation) +{ + db::Layout ly; + { + std::string fn (tl::testsrc ()); + fn += "/testdata/drc/compound_5.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + db::RegionCheckOptions check_options; + check_options.metrics = db::Projection; + + unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0)); + db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1)); + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2)); + + db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode (); + db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2); + db::CompoundRegionInteractOperationNode interact (primary, secondary, 0, true, false); + + db::Region res = r.cop_to_region (interact); + + unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0)); + res.insert_into (&ly, *ly.begin_top_down (), l1000); + + CHECKPOINT(); + db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au5.gds"); +} + diff --git a/testdata/drc/compound_4.gds b/testdata/drc/compound_4.gds new file mode 100644 index 000000000..001eefe47 Binary files /dev/null and b/testdata/drc/compound_4.gds differ diff --git a/testdata/drc/compound_5.gds b/testdata/drc/compound_5.gds new file mode 100644 index 000000000..001eefe47 Binary files /dev/null and b/testdata/drc/compound_5.gds differ diff --git a/testdata/drc/compound_au4.gds b/testdata/drc/compound_au4.gds new file mode 100644 index 000000000..2869b0529 Binary files /dev/null and b/testdata/drc/compound_au4.gds differ diff --git a/testdata/drc/compound_au5.gds b/testdata/drc/compound_au5.gds new file mode 100644 index 000000000..82ae13d74 Binary files /dev/null and b/testdata/drc/compound_au5.gds differ