From 5187ddbfc0f7a6f0caff7caf3690cb19fab851f7 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 17 Feb 2024 21:20:24 +0100 Subject: [PATCH 01/79] Do not insert the same point twice into edge set in EdgeProcessor - this improves performance in the case of manifold intersecions in one point. Also: added edge count API --- src/db/db/dbEdgeProcessor.cc | 13 +++++++++++++ src/db/db/dbEdgeProcessor.h | 5 +++++ src/db/db/dbShapeProcessor.cc | 6 ++++++ src/db/db/dbShapeProcessor.h | 5 +++++ 4 files changed, 29 insertions(+) diff --git a/src/db/db/dbEdgeProcessor.cc b/src/db/db/dbEdgeProcessor.cc index 9f1c3f11f..4f0534ae8 100644 --- a/src/db/db/dbEdgeProcessor.cc +++ b/src/db/db/dbEdgeProcessor.cc @@ -251,6 +251,13 @@ struct CutPoints } + // do not insert points twice + for (auto c = cut_points.begin (); c != cut_points.end (); ++c) { + if (*c == p) { + return; + } + } + cut_points.push_back (p); } @@ -1057,6 +1064,12 @@ EdgeProcessor::reserve (size_t n) mp_work_edges->reserve (n); } +size_t +EdgeProcessor::count () const +{ + return mp_work_edges->size (); +} + void EdgeProcessor::insert (const db::Edge &e, EdgeProcessor::property_type p) { diff --git a/src/db/db/dbEdgeProcessor.h b/src/db/db/dbEdgeProcessor.h index a6fb2a680..30de5b35d 100644 --- a/src/db/db/dbEdgeProcessor.h +++ b/src/db/db/dbEdgeProcessor.h @@ -695,6 +695,11 @@ public: */ void reserve (size_t n); + /** + * @brief Reports the number of edges stored in the processor + */ + size_t count () const; + /** * @brief Insert an edge */ diff --git a/src/db/db/dbShapeProcessor.cc b/src/db/db/dbShapeProcessor.cc index 518aaa9e7..974fd469b 100644 --- a/src/db/db/dbShapeProcessor.cc +++ b/src/db/db/dbShapeProcessor.cc @@ -53,6 +53,12 @@ ShapeProcessor::reserve (size_t n) m_processor.reserve (n); } +size_t +ShapeProcessor::count () const +{ + return m_processor.count (); +} + void ShapeProcessor::process (db::EdgeSink &es, EdgeEvaluatorBase &op) { diff --git a/src/db/db/dbShapeProcessor.h b/src/db/db/dbShapeProcessor.h index a7afde10c..333c53b69 100644 --- a/src/db/db/dbShapeProcessor.h +++ b/src/db/db/dbShapeProcessor.h @@ -196,6 +196,11 @@ public: */ void reserve (size_t n); + /** + * @brief Reports the number of edges stored in the processor + */ + size_t count () const; + /** * @brief Sets the base verbosity of the processor (see EdgeProcessor::set_base_verbosity for details) */ From 8947c9992fb534c12e7c1a354552717245d22c4f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 17 Feb 2024 21:20:52 +0100 Subject: [PATCH 02/79] Added configuration options for XOR tool to switch between with merge-before and without. --- .../tools/xor/lay_plugin/layXORToolDialog.cc | 169 ++++++++++-------- 1 file changed, 92 insertions(+), 77 deletions(-) diff --git a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc index d78cbc9cf..08558adc4 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc +++ b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc @@ -52,6 +52,12 @@ namespace lay { +bool merge_before_bool () +{ + // $KLAYOUT_XOR_MERGE_BEFORE_BOOLEAN + return tl::app_flag ("xor-merge-before-boolean"); +} + std::string cfg_xor_input_mode ("xor-input-mode"); std::string cfg_xor_output_mode ("xor-output-mode"); std::string cfg_xor_nworkers ("xor-num-workers"); @@ -864,107 +870,116 @@ XORWorker::do_perform_tiled (const XORTask *xor_task) if (! mp_job->has_tiles ()) { tl::SelfTimer timer (tl::verbosity () >= 21, "Boolean part"); -#if 0 - // Straightforward implementation - sp.boolean (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, - mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, - xor_results_cell.shapes (0), op, true, false, true); -#else - // This implementation is faster when a lot of overlapping shapes are involved - db::Layout merge_helper; - db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); - merge_helper.insert_layer (0); - merge_helper.insert_layer (1); - if (!la.empty ()) { - sp.merge (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, - merge_helper_cell.shapes (0), true, 0, false, true); + if (! merge_before_bool ()) { +# + // Straightforward implementation + sp.boolean (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, + mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, + xor_results_cell.shapes (0), mp_job->op (), true, false, true); + + } else { + + // This implementation is faster when a lot of overlapping shapes are involved + db::Layout merge_helper; + db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); + merge_helper.insert_layer (0); + merge_helper.insert_layer (1); + + if (!la.empty ()) { + sp.merge (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, + merge_helper_cell.shapes (0), true, 0, false, true); + } + if (!lb.empty ()) { + sp.merge (mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, + merge_helper_cell.shapes (1), true, 0, false, true); + } + sp.boolean (merge_helper, merge_helper_cell, 0, + merge_helper, merge_helper_cell, 1, + xor_results_cell.shapes (0), mp_job->op (), true, false, true); + } - if (!lb.empty ()) { - sp.merge (mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, - merge_helper_cell.shapes (1), true, 0, false, true); - } - sp.boolean (merge_helper, merge_helper_cell, 0, - merge_helper, merge_helper_cell, 1, - xor_results_cell.shapes (0), mp_job->op (), true, false, true); -#endif } else { tl::SelfTimer timer (tl::verbosity () >= 31, "Boolean part"); size_t n; -#if 0 - // Straightforward implementation - sp.clear (); - - db::CplxTrans dbu_scale_a (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); - db::CplxTrans dbu_scale_b (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); - - n = 0; - for (db::RecursiveShapeIterator s (mp_job->cva ()->layout (), mp_job->cva ().cell (), la, region_a); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale_a * s.trans (), n * 2); - } - - n = 0; - for (db::RecursiveShapeIterator s (mp_job->cvb ()->layout (), mp_job->cvb ().cell (), lb, region_b); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale_b * s.trans (), n * 2 + 1); - } - - db::BooleanOp bool_op (mp_job->op ()); - db::ShapeGenerator sg (xor_results_cell.shapes (0), true /*clear shapes*/); - db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, mp_job->op ()); -#else - // This implementation is faster when a lot of overlapping shapes are involved - db::Layout merge_helper; - merge_helper.dbu (mp_job->dbu ()); - db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); - merge_helper.insert_layer (0); - merge_helper.insert_layer (1); - - // This implementation is faster when a lot of overlapping shapes are involved - if (!la.empty ()) { + if (! merge_before_bool ()) { + // Straightforward implementation sp.clear (); - db::CplxTrans dbu_scale (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); + db::CplxTrans dbu_scale_a (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); + db::CplxTrans dbu_scale_b (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); n = 0; for (db::RecursiveShapeIterator s (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale * s.trans (), n); + sp.insert (s.shape (), dbu_scale_a * s.trans (), n * 2); } - db::MergeOp op (0); - db::ShapeGenerator sg (merge_helper_cell.shapes (0), true /*clear shapes*/); - db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, op); - - } - - if (!lb.empty ()) { - - sp.clear (); - - db::CplxTrans dbu_scale (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); - n = 0; for (db::RecursiveShapeIterator s (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale * s.trans (), n); + sp.insert (s.shape (), dbu_scale_b * s.trans (), n * 2 + 1); } - db::MergeOp op (0); - db::ShapeGenerator sg (merge_helper_cell.shapes (1), true /*clear shapes*/); + db::BooleanOp bool_op (mp_job->op ()); + db::ShapeGenerator sg (xor_results_cell.shapes (0), true /*clear shapes*/); db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, op); + sp.process (out, bool_op); + + } else { + + // This implementation is faster when a lot of overlapping shapes are involved + db::Layout merge_helper; + merge_helper.dbu (mp_job->dbu ()); + db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); + merge_helper.insert_layer (0); + merge_helper.insert_layer (1); + + // This implementation is faster when a lot of overlapping shapes are involved + if (!la.empty ()) { + + sp.clear (); + + db::CplxTrans dbu_scale (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); + + n = 0; + for (db::RecursiveShapeIterator s (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); ! s.at_end (); ++s, ++n) { + sp.insert (s.shape (), dbu_scale * s.trans (), n); + } + + db::MergeOp op (0); + db::ShapeGenerator sg (merge_helper_cell.shapes (0), true /*clear shapes*/); + db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); + sp.process (out, op); + + } + + if (!lb.empty ()) { + + sp.clear (); + + db::CplxTrans dbu_scale (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); + + n = 0; + for (db::RecursiveShapeIterator s (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); ! s.at_end (); ++s, ++n) { + sp.insert (s.shape (), dbu_scale * s.trans (), n); + } + + db::MergeOp op (0); + db::ShapeGenerator sg (merge_helper_cell.shapes (1), true /*clear shapes*/); + db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); + sp.process (out, op); + + } + + sp.boolean (merge_helper, merge_helper_cell, 0, + merge_helper, merge_helper_cell, 1, + xor_results_cell.shapes (0), mp_job->op (), true, false, true); } - sp.boolean (merge_helper, merge_helper_cell, 0, - merge_helper, merge_helper_cell, 1, - xor_results_cell.shapes (0), mp_job->op (), true, false, true); -#endif - } } else if (mp_job->op () == db::BooleanOp::Xor || From f7411b52d2956fe1b0851534fe2daf03804f2fbe Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 21 Feb 2024 22:17:24 +0100 Subject: [PATCH 03/79] Fixed a typo in DRC doc of 'corners' --- src/doc/doc/about/drc_ref.xml | 2 +- src/doc/doc/about/drc_ref_drc.xml | 14 ++++++++------ src/doc/doc/about/drc_ref_global.xml | 7 +------ src/doc/doc/about/drc_ref_layer.xml | 7 ++----- src/doc/doc/about/drc_ref_netter.xml | 2 +- src/doc/doc/about/drc_ref_source.xml | 2 +- src/doc/doc/about/lvs_ref.xml | 2 +- src/doc/doc/about/lvs_ref_global.xml | 2 +- src/doc/doc/about/lvs_ref_netter.xml | 2 +- src/drc/drc/built-in-macros/_drc_complex_ops.rb | 12 +++++++----- src/drc/drc/built-in-macros/_drc_layer.rb | 2 +- 11 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/doc/doc/about/drc_ref.xml b/src/doc/doc/about/drc_ref.xml index 889c3fedc..203941a1d 100644 --- a/src/doc/doc/about/drc_ref.xml +++ b/src/doc/doc/about/drc_ref.xml @@ -1,7 +1,7 @@ - + diff --git a/src/doc/doc/about/drc_ref_drc.xml b/src/doc/doc/about/drc_ref_drc.xml index 7ee678eca..7f121c94a 100644 --- a/src/doc/doc/about/drc_ref_drc.xml +++ b/src/doc/doc/about/drc_ref_drc.xml @@ -1,7 +1,7 @@ - + @@ -358,7 +358,7 @@ The plain function is equivalent to "primary.bbox_width". This method acts on edge expressions and delivers a specific part of each edge. See layer#centers for details about this functionality.

-

"corners" - Applies smoothing

+

"corners" - Selects corners of polygons

Usage:

"edges" - Decomposes the layer into single edges

+

Usage:

+
    +
  • layer.edges
  • +
  • layer.edges(mode)
  • +

Edge pair collections are decomposed into the individual edges that make up the edge pairs. Polygon layers are decomposed into the edges making up the @@ -791,6 +796,36 @@ is called on.

Merged semantics applies, i.e. the result reflects merged polygons rather than individual ones unless raw mode is chosen. +

+The "mode" argument allows selecting specific edges from polygons. +Allowed values are: "convex", "concave", "step", "step_in" and "step_out". +"step" generates edges only if they provide a step between two other +edges. "step_in" creates edges that make a step towards the inside of +the polygon and "step_out" creates edges that make a step towards the +outside: +

+

+out = in.edges(convex)
+
+

+This feature is only available for polygon layers. +

+The following images show the effect of the mode argument: +

+ + + + + + + + + + + + + +

"edges?" - Returns true, if the layer is an edge layer

diff --git a/src/doc/doc/images/drc_edge_modes1.png b/src/doc/doc/images/drc_edge_modes1.png new file mode 100644 index 0000000000000000000000000000000000000000..f5270d9443cde1b1763fae4163ddd44866fb1e01 GIT binary patch literal 7292 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 literal 0 HcmV?d00001 diff --git a/src/doc/doc/images/drc_edge_modes2.png b/src/doc/doc/images/drc_edge_modes2.png new file mode 100644 index 0000000000000000000000000000000000000000..5005e888d34c724542eec5ebba57326e7857b5e9 GIT binary patch literal 6912 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 H{XhH{s;UX3 literal 0 HcmV?d00001 diff --git a/src/doc/doc/images/drc_edge_modes3.png b/src/doc/doc/images/drc_edge_modes3.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc9c978b3aaed8b84c3ab8cf5fe50b77019de74 GIT binary patch literal 6808 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 Xo^M&Cd&}w+w8IWZXNUV+kNo&gVT_MI literal 0 HcmV?d00001 diff --git a/src/doc/doc/images/drc_edge_modes4.png b/src/doc/doc/images/drc_edge_modes4.png new file mode 100644 index 0000000000000000000000000000000000000000..94cf5014040eb688e9df6df502c13df5a83c6791 GIT binary patch literal 7165 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%0ATb!UTTBph zG3MFYctj^1|C8zwht~$f1!^sHi_9gusnLPAr>ZDw*d4P!OUOPy_@DzLJHDTwB~|*OBL%DRka-a<<8>TK*4+`TAgXb24Ajp_E`s54!u+>T^t`;h#N=h$!QopU%f0 z-HdFfVUo1wDRFHB?}kbI79bE$%$HN(q30Lyf;fws9(#Qu#zzz&$@w>5XAq|&QhyRP s#4kn{;rq7`QtUV6-?kUOS9B61Cmvj0)xVr&3gytwcCSsb^^u?d1^W@CUjP6A literal 0 HcmV?d00001 diff --git a/src/doc/doc/images/drc_edge_modes6.png b/src/doc/doc/images/drc_edge_modes6.png new file mode 100644 index 0000000000000000000000000000000000000000..e90b4380f7ab61dd945a9f8340041abb3ef11eed GIT binary patch literal 7052 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 alxTF{(+-PR;-`=V&n-LMOTYT=)c*iE&px&Q literal 0 HcmV?d00001 diff --git a/src/doc/docDRCLVSResources.qrc b/src/doc/docDRCLVSResources.qrc index e91766fe5..acf5f25a2 100644 --- a/src/doc/docDRCLVSResources.qrc +++ b/src/doc/docDRCLVSResources.qrc @@ -54,6 +54,12 @@ doc/images/drc_extended2.png doc/images/drc_extended3.png doc/images/drc_extended4.png + doc/images/drc_edge_modes1.png + doc/images/drc_edge_modes2.png + doc/images/drc_edge_modes3.png + doc/images/drc_edge_modes4.png + doc/images/drc_edge_modes5.png + doc/images/drc_edge_modes6.png doc/images/drc_extents1.png doc/images/drc_extents2.png doc/images/drc_inside.png diff --git a/src/drc/drc/built-in-macros/_drc_complex_ops.rb b/src/drc/drc/built-in-macros/_drc_complex_ops.rb index 23b5b13b5..9950da2e9 100644 --- a/src/drc/drc/built-in-macros/_drc_complex_ops.rb +++ b/src/drc/drc/built-in-macros/_drc_complex_ops.rb @@ -1004,11 +1004,11 @@ CODE # @/code # # The "mode" argument allows selecting specific edges from polygons. - # Allows values are: "convex", "concave", "step", "step_in" and "step_out". - # "step" generates edges only that provide a step between two other + # Allowed values are: "convex", "concave", "step", "step_in" and "step_out". + # "step" generates edges only if they provide a step between two other # edges. "step_in" creates edges that make a step towards the inside of # the polygon and "step_out" creates edges that make a step towards the - # outside (hull contours in clockwise orientation, holes counterclockwise): + # outside: # # @code # out = in.drc(primary.edges(convex)) diff --git a/src/drc/drc/built-in-macros/_drc_layer.rb b/src/drc/drc/built-in-macros/_drc_layer.rb index fe89bb036..5d0409e2a 100644 --- a/src/drc/drc/built-in-macros/_drc_layer.rb +++ b/src/drc/drc/built-in-macros/_drc_layer.rb @@ -3399,17 +3399,34 @@ CODE # individual ones unless raw mode is chosen. # # The "mode" argument allows selecting specific edges from polygons. - # Allows values are: "convex", "concave", "step", "step_in" and "step_out". - # "step" generates edges only that provide a step between two other + # Allowed values are: "convex", "concave", "step", "step_in" and "step_out". + # "step" generates edges only if they provide a step between two other # edges. "step_in" creates edges that make a step towards the inside of # the polygon and "step_out" creates edges that make a step towards the - # outside (hull contours in clockwise orientation, holes counterclockwise): + # outside: # # @code # out = in.edges(convex) # @/code # # This feature is only available for polygon layers. + # + # The following images show the effect of the mode argument: + # + # @table + # @tr + # @td @img(/images/drc_edge_modes1.png) @/td + # @td @img(/images/drc_edge_modes2.png) @/td + # @/tr + # @tr + # @td @img(/images/drc_edge_modes3.png) @/td + # @td @img(/images/drc_edge_modes4.png) @/td + # @/tr + # @tr + # @td @img(/images/drc_edge_modes5.png) @/td + # @td @img(/images/drc_edge_modes6.png) @/td + # @/tr + # @/table %w(edges).each do |f| eval <<"CODE" From 28e96ee0c3d9809a52f77b4d46115c480a345f5f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 7 Mar 2024 22:29:33 +0100 Subject: [PATCH 31/79] Added not_... versions of edge modes --- src/db/db/dbRegionProcessors.cc | 45 +++++++++++++++--- src/db/db/dbRegionProcessors.h | 3 +- src/db/db/gsiDeclDbRegion.cc | 15 ++++++ .../drc/built-in-macros/_drc_complex_ops.rb | 7 +++ src/drc/drc/built-in-macros/_drc_engine.rb | 20 ++++++++ src/drc/drc/built-in-macros/_drc_layer.rb | 9 +++- testdata/drc/drcSimpleTests_92.drc | 11 +++++ testdata/drc/drcSimpleTests_au92.gds | Bin 14666 -> 36266 bytes testdata/drc/drcSimpleTests_au92d.gds | Bin 10176 -> 25296 bytes 9 files changed, 102 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbRegionProcessors.cc b/src/db/db/dbRegionProcessors.cc index 9ba85b006..63fcdea3b 100644 --- a/src/db/db/dbRegionProcessors.cc +++ b/src/db/db/dbRegionProcessors.cc @@ -170,12 +170,45 @@ contour_to_edges (const db::Polygon::contour_type &contour, PolygonToEdgeProcess int s1 = db::vprod_sign (*p0 - *pm1, *p1 - *p0); int s2 = db::vprod_sign (*p1 - *p0, *p2 - *p1); - if (mode == PolygonToEdgeProcessor::All || - (mode == PolygonToEdgeProcessor::Convex && s1 < 0 && s2 < 0) || - (mode == PolygonToEdgeProcessor::Concave && s1 > 0 && s2 > 0) || - (mode == PolygonToEdgeProcessor::StepOut && s1 > 0 && s2 < 0) || - (mode == PolygonToEdgeProcessor::StepIn && s1 < 0 && s2 > 0) || - (mode == PolygonToEdgeProcessor::Step && s1 * s2 < 0)) { + bool take = true; + + switch (mode) { + case PolygonToEdgeProcessor::All: + default: + break; + case PolygonToEdgeProcessor::Convex: + take = s1 < 0 && s2 < 0; + break; + case PolygonToEdgeProcessor::NotConvex: + take = ! (s1 < 0 && s2 < 0); + break; + case PolygonToEdgeProcessor::Concave: + take = s1 > 0 && s2 > 0; + break; + case PolygonToEdgeProcessor::NotConcave: + take = ! (s1 > 0 && s2 > 0); + break; + case PolygonToEdgeProcessor::StepOut: + take = s1 > 0 && s2 < 0; + break; + case PolygonToEdgeProcessor::NotStepOut: + take = ! (s1 > 0 && s2 < 0); + break; + case PolygonToEdgeProcessor::StepIn: + take = s1 < 0 && s2 > 0; + break; + case PolygonToEdgeProcessor::NotStepIn: + take = ! (s1 < 0 && s2 > 0); + break; + case PolygonToEdgeProcessor::Step: + take = s1 * s2 < 0; + break; + case PolygonToEdgeProcessor::NotStep: + take = ! (s1 * s2 < 0); + break; + } + + if (take) { result.push_back (db::Edge (*p0, *p1)); } diff --git a/src/db/db/dbRegionProcessors.h b/src/db/db/dbRegionProcessors.h index 9cfc96fc5..08553ca25 100644 --- a/src/db/db/dbRegionProcessors.h +++ b/src/db/db/dbRegionProcessors.h @@ -293,7 +293,8 @@ class DB_PUBLIC PolygonToEdgeProcessor : public db::PolygonToEdgeProcessorBase { public: - enum EdgeMode { All = 0, Convex, Concave, StepIn, StepOut, Step }; + enum EdgeMode { All = 0, Convex, Concave, StepIn, StepOut, Step, + NotConvex, NotConcave, NotStepIn, NotStepOut, NotStep }; PolygonToEdgeProcessor (EdgeMode mode = All); diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index b51b1f4e9..2e16558ed 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -3258,17 +3258,32 @@ gsi::Enum decl_EdgeMode ("db", "EdgeMode", gsi::enum_const ("Concave", db::PolygonToEdgeProcessor::Concave, "@brief Selects only concave edges\n" ) + + gsi::enum_const ("NotConcave", db::PolygonToEdgeProcessor::NotConcave, + "@brief Selects only edges which are not concave\n" + ) + gsi::enum_const ("Convex", db::PolygonToEdgeProcessor::Convex, "@brief Selects only convex edges\n" ) + + gsi::enum_const ("NotConvex", db::PolygonToEdgeProcessor::NotConvex, + "@brief Selects only edges which are not convex\n" + ) + gsi::enum_const ("Step", db::PolygonToEdgeProcessor::Step, "@brief Selects only step edges leading inside or outside\n" ) + + gsi::enum_const ("NotStep", db::PolygonToEdgeProcessor::NotStep, + "@brief Selects only edges which are not steps\n" + ) + gsi::enum_const ("StepIn", db::PolygonToEdgeProcessor::StepIn, "@brief Selects only step edges leading inside\n" ) + + gsi::enum_const ("NotStepIn", db::PolygonToEdgeProcessor::NotStepIn, + "@brief Selects only edges which are not steps leading inside\n" + ) + gsi::enum_const ("StepOut", db::PolygonToEdgeProcessor::StepOut, "@brief Selects only step edges leading outside\n" + ) + + gsi::enum_const ("NotStepOut", db::PolygonToEdgeProcessor::NotStepOut, + "@brief Selects only edges which are not steps leading outside\n" ), "@brief This class represents the edge mode type for \\Region#edges.\n" "\n" diff --git a/src/drc/drc/built-in-macros/_drc_complex_ops.rb b/src/drc/drc/built-in-macros/_drc_complex_ops.rb index 9950da2e9..93a659a95 100644 --- a/src/drc/drc/built-in-macros/_drc_complex_ops.rb +++ b/src/drc/drc/built-in-macros/_drc_complex_ops.rb @@ -1014,6 +1014,13 @@ CODE # out = in.drc(primary.edges(convex)) # @/code # + # In addition, "not_.." variants are available which selects edges + # not qualifying for the specific mode: + # + # @code + # out = in.drc(primary.edges(not_convex)) + # @/code + # # The mode argument is ignored when translating other objects than # polygons. diff --git a/src/drc/drc/built-in-macros/_drc_engine.rb b/src/drc/drc/built-in-macros/_drc_engine.rb index 3714a325b..e7289f3f6 100644 --- a/src/drc/drc/built-in-macros/_drc_engine.rb +++ b/src/drc/drc/built-in-macros/_drc_engine.rb @@ -259,22 +259,42 @@ module DRC DRCEdgeMode::new(RBA::EdgeMode::Convex) end + def not_convex + DRCEdgeMode::new(RBA::EdgeMode::NotConvex) + end + def concave DRCEdgeMode::new(RBA::EdgeMode::Concave) end + def not_concave + DRCEdgeMode::new(RBA::EdgeMode::NotConcave) + end + def step_in DRCEdgeMode::new(RBA::EdgeMode::StepIn) end + def not_step_in + DRCEdgeMode::new(RBA::EdgeMode::NotStepIn) + end + def step_out DRCEdgeMode::new(RBA::EdgeMode::StepOut) end + def not_step_out + DRCEdgeMode::new(RBA::EdgeMode::NotStepOut) + end + def step DRCEdgeMode::new(RBA::EdgeMode::Step) end + def not_step + DRCEdgeMode::new(RBA::EdgeMode::NotStep) + end + def padding_zero DRCDensityPadding::new(:zero) end diff --git a/src/drc/drc/built-in-macros/_drc_layer.rb b/src/drc/drc/built-in-macros/_drc_layer.rb index 5d0409e2a..fc722810a 100644 --- a/src/drc/drc/built-in-macros/_drc_layer.rb +++ b/src/drc/drc/built-in-macros/_drc_layer.rb @@ -3409,7 +3409,14 @@ CODE # out = in.edges(convex) # @/code # - # This feature is only available for polygon layers. + # In addition, "not_.." variants are available which selects edges + # not qualifying for the specific mode: + # + # @code + # out = in.edges(not_convex) + # @/code + # + # The mode argument is only available for polygon layers. # # The following images show the effect of the mode argument: # diff --git a/testdata/drc/drcSimpleTests_92.drc b/testdata/drc/drcSimpleTests_92.drc index 5894b4c93..7187fe7aa 100644 --- a/testdata/drc/drcSimpleTests_92.drc +++ b/testdata/drc/drcSimpleTests_92.drc @@ -19,6 +19,12 @@ l2.edges(step).output(103, 0) l2.edges(step_in).output(104, 0) l2.edges(step_out).output(105, 0) +l2.edges(not_convex).output(111, 0) +l2.edges(not_concave).output(112, 0) +l2.edges(not_step).output(113, 0) +l2.edges(not_step_in).output(114, 0) +l2.edges(not_step_out).output(115, 0) + l2.drc(primary.edges).output(200, 0) l2.drc(primary.edges(convex)).output(201, 0) l2.drc(primary.edges(concave)).output(202, 0) @@ -26,4 +32,9 @@ l2.drc(primary.edges(step)).output(203, 0) l2.drc(primary.edges(step_in)).output(204, 0) l2.drc(primary.edges(step_out)).output(205, 0) +l2.drc(primary.edges(not_convex)).output(211, 0) +l2.drc(primary.edges(not_concave)).output(212, 0) +l2.drc(primary.edges(not_step)).output(213, 0) +l2.drc(primary.edges(not_step_in)).output(214, 0) +l2.drc(primary.edges(not_step_out)).output(215, 0) diff --git a/testdata/drc/drcSimpleTests_au92.gds b/testdata/drc/drcSimpleTests_au92.gds index 2ce998226d5f99532ba5ed4577e969a40e7ba7e6..26068b9b3bb8abd2c88391f2ce863219a089854d 100644 GIT binary patch delta 3467 zcmZXXJ8xW76oqGu@em$ik|+syl559O$OB;+#NZSZ{sTxZBSevZz|6gWfPX;9DFG=p zqA)^q6mCHjNOR}jHWi{wO~v}wzUK@U&Cxoq{a9?HQt*1 zJ$hv{8QmD|j%NSG-yGb#^1sEOKL4#6f0<5p<{qo`-G?`Yp6)UK^Bu;Q6UL)kK5>Wf z#chqx-m21%pXe}PdXHPDZ&c~&$DpI*D!sUw(ezEwSG(NZ|HyZNN5_mW9x8C#LbP!%lPBvU56WWg(R&%4-v>dXE)S+2I<~V1 zReF4#-Nkim!K~sFvti>%q6YfMr=Gme&h!Ju%)EIT_YzopO7iEPZ;&?CkP< zytFRMqDw}h%d+UQEV?Z1jS^dCRagpDGO{X5tAfQ)Vp)^`;Tt7%MFokc7()Y{7&HLI zPH3P=q`}gRFH4a!uM#{5g6E|Rb%|O~%*CKsjzw`Cgw{aNDmp}~0vD~3C}pe^L}tm& zWNv1V2|e?1Z8GaZW=26~UC68pnROwvcA+!6(Afw|Gcu*MDa9_{GO=|b7Q_z3>Y|9P zUE=r#=MvYsfnHGT1igw)^wzl{)aJP^JO`q(*$Ku2!FX-Pb$PG=?HCN&6_#jMK&t7u z1NngQRT zCdkHeuMR>@21EA!X7d-?lihCG4LH@RJqO#GJs+yWKe99p~;=5u?&pS zon>_B&ap<}2SSF%4W_XeHh~UU3>_4gbif27Cea}fI*32%pd6(`a6(rPgd)mVIut^z z!)AsKFgs7*@6Xih&3gLmV3y90Wi`Wj;6E)L1%+{)d z{fV}Ynu8&KYq?uX-`at&MAf?JZcQpH@wDiK=x?1NDYOm_`djBNXQIE&&C6c>70993 z=OQC{x32me@l5ml;&E!z|HB2PvROy1)?WngTWjuQPqk;)K}DugIZW+tD5Pu#m${4r zQH3%PvBi7N26I|h9O7q2_~zxeKOWO;)n6L>@vVU7%uz*LNDzon|1jtK+JQ^tzBfygF>hZhftN*XF}vo#)0^l0-@&GI^he} zG1a-kbz6L4lQI8>)O<(>o0~chYcQJEXF|C^10h%5-S+RH&T@AYEx|J8x(|df1QNnv zhBNtxt1d<}DOS;n{m=@;dA@3&r6(&p{S5Cf$j}#)eHNj&CcXO&heLqg0`ykAcfZk! z1n4b*)`w2hTS9tFAgJ%1Eb~omhhyZ(>ocKT+kvR^; z2sR2ZyV&;Y5hhVgiKs31?nB`C3!;=%L$WzE9;}B9++-)e++m5%!fEXg99^t9L>5vF RSwOyj=Wu5-8f|Zn{slrPHyr=~ delta 97 zcmZ2Ao9R@M5(66p6H^3(3?mc!3kGHeb_P)fT?SQT_CzIhK@7o-Q77dlpY@WSyg`6v da$J%4@|VP7%NI+HSF-l3ucr zjFU(I~=467rl`p z^UB_yVho7!uwyZW#$c~v3e8q%WDz4l(-cpOEHx5q90RhvrAC)A z8Z=Gu(P;N>X?%LN_;tZubb9GLZW54fGFKv%Cc;{x%FiOKiU~lB1HD?KuvfxrB~`~5 z&@{!zBsCg?y^3ixTceRpj08(1-OPQy8PMbVpyNU2_8)>itgH7P_GmkEe|MODvcWhf zQoZtB8Yo}E`a}TjGD);A+e^Rsl;S9XB(k|1tA_9niDgAn>SpfunDu-mb3fNW(704| z-p}00gt_xR-mE<92Op^BN;P+fW7aQjo6X$w2j<22cz_LJK#YeIESy)@@rBu|0k;F0 z(*ItUjC}!Z4mBWrDBg^Ms0JcU!z^l;33Jl`!aHb~Dd(AT#u{hV@q)A5KH+Ft;mE9U zl$$3U3q1k3Z=R{ldZvar0b7MLh!{8vmg*C4%-PSF7m;}pnS<~S%nPk~q5KQwk2U^y z;R}CQU{PT_P{Eq1C{;xX3p!V>z87MM?iCj=$>tCO;)w{YRH`K1MvsAQO-vcZlu-yl_5+Ja~R{L)=wC zvYCx3DTr|>oFIRLtC+Bg#ni2})V2c!sA7RZ`oKzoEC!Mw#^LNMEjDA#tAs;wt5|$8 zvCh4Q9X1?XrLyH|_DxgA(%BrkWX`ujO*xdat-`rhPIcr|D<{T0_MrhljLA-fy+HCa z5Ph|3#o8UWb>1$ru+D9hpMd8mKMCK?hB#hXm9sD(I5#nd*}%Wi% Date: Thu, 7 Mar 2024 23:03:30 +0100 Subject: [PATCH 32/79] Region#edges: Don't include an polygon to edge processor unless required --- src/db/db/gsiDeclDbRegion.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index 2e16558ed..700cd2162 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -783,8 +783,13 @@ size_dvm (db::Region *region, const db::Vector &dv, unsigned int mode) static db::Edges edges (const db::Region *region, db::PolygonToEdgeProcessor::EdgeMode mode) { - db::PolygonToEdgeProcessor proc (mode); - return region->edges (proc); + if (mode != db::PolygonToEdgeProcessor::All) { + db::PolygonToEdgeProcessor proc (mode); + return region->edges (proc); + } else { + // this version is more efficient in the hierarchical case + return region->edges (); + } } static db::Point default_origin; From ea21a30367d63fd27351de5f41d7d558c7b35b1e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 7 Mar 2024 23:06:09 +0100 Subject: [PATCH 33/79] Update of test data --- testdata/drc/drcSimpleTests_au92d.gds | Bin 25296 -> 24756 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/testdata/drc/drcSimpleTests_au92d.gds b/testdata/drc/drcSimpleTests_au92d.gds index 775f8f9fa1d94e3d1750f202ee871fac0359777f..e14a2cce22ad1f442fb8b4b5cf14b3457a5b34c7 100644 GIT binary patch delta 427 zcmZXPze)o^5XNWsHaT;WKMK0W@h(R|qL3nrrn0yqAXtPnL9xj_f~BR85dAs}wX#zq zu@sDmU}2F*u(Z<$5OMd8fRJMOX1>|^&CK{!JUojkWl72dS`pIyB!^tmq^S5mKCRZ~ zrp)`p3xN+;qbM0WvuxE<10p9RQUm;odclV7OlpZfO3qrr9Z!B(wHCsh!ih>iUN$1i z9Gk8&u4EmtY$C{{Y+JIhY?PFaT!!y(0!%w5K#$&t(r33Y5QTHOiIQrXSv-7l;`!-& z&{%v&TvcfAYJ6$NXjS2MPun2~*V%X#4BAQUtjoA8SEOtqsx6q1(cehcLC05~`$!}T zM7itazK+khS?(g<)s_7@Dy4D1YI4AKmi$n1$q>Vg=88>8kiPLAOfpUlrB zJz0U1W%2`d2)lrtWwITREz2xDxqw|7OwVAG2C563EWpAt`2&ymua01^^MbG+cu7y5FDX6Q!4E`B zPM#oTF}WaCdh%MSpvnB!Qb1aIazHSMFFkpK0)#g3gwO%95LzG#DsK&OVu2HczMuu7 jWhToiLY$Vb40hV&278Fx3arE@uLp(>)SH|ArBhu2aPxcx From ffffe7327c349e4cb92201e6bae1df1a69191777 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 9 Mar 2024 01:10:08 +0100 Subject: [PATCH 34/79] Preparing for merge with master --- src/drc/unit_tests/drcSimpleTests.cc | 24 +++++++++--------- ...pleTests_90.drc => drcSimpleTests_100.drc} | 0 ...pleTests_90.gds => drcSimpleTests_100.gds} | Bin ...pleTests_91.drc => drcSimpleTests_101.drc} | 0 ...pleTests_91.gds => drcSimpleTests_101.gds} | Bin ...pleTests_92.drc => drcSimpleTests_102.drc} | 0 ...pleTests_92.gds => drcSimpleTests_102.gds} | Bin ...ests_au90.gds => drcSimpleTests_au100.gds} | Bin ...ts_au90d.gds => drcSimpleTests_au100d.gds} | Bin ...ests_au91.gds => drcSimpleTests_au101.gds} | Bin ...ts_au91d.gds => drcSimpleTests_au101d.gds} | Bin ...ests_au92.gds => drcSimpleTests_au102.gds} | Bin ...ts_au92d.gds => drcSimpleTests_au102d.gds} | Bin 13 files changed, 12 insertions(+), 12 deletions(-) rename testdata/drc/{drcSimpleTests_90.drc => drcSimpleTests_100.drc} (100%) rename testdata/drc/{drcSimpleTests_90.gds => drcSimpleTests_100.gds} (100%) rename testdata/drc/{drcSimpleTests_91.drc => drcSimpleTests_101.drc} (100%) rename testdata/drc/{drcSimpleTests_91.gds => drcSimpleTests_101.gds} (100%) rename testdata/drc/{drcSimpleTests_92.drc => drcSimpleTests_102.drc} (100%) rename testdata/drc/{drcSimpleTests_92.gds => drcSimpleTests_102.gds} (100%) rename testdata/drc/{drcSimpleTests_au90.gds => drcSimpleTests_au100.gds} (100%) rename testdata/drc/{drcSimpleTests_au90d.gds => drcSimpleTests_au100d.gds} (100%) rename testdata/drc/{drcSimpleTests_au91.gds => drcSimpleTests_au101.gds} (100%) rename testdata/drc/{drcSimpleTests_au91d.gds => drcSimpleTests_au101d.gds} (100%) rename testdata/drc/{drcSimpleTests_au92.gds => drcSimpleTests_au102.gds} (100%) rename testdata/drc/{drcSimpleTests_au92d.gds => drcSimpleTests_au102d.gds} (100%) diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index 64e8b84ec..690f2b644 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -1617,32 +1617,32 @@ TEST(89_deep_with_mag_cop_size_aniso) run_test (_this, "89", true); } -TEST(90_edge_interaction_with_count) +TEST(100_edge_interaction_with_count) { - run_test (_this, "90", false); + run_test (_this, "100", false); } -TEST(90d_edge_interaction_with_count) +TEST(100d_edge_interaction_with_count) { - run_test (_this, "90", true); + run_test (_this, "100", true); } -TEST(91_edge_booleans_with_dots) +TEST(101_edge_booleans_with_dots) { - run_test (_this, "91", false); + run_test (_this, "101", false); } -TEST(91d_edge_booleans_with_dots) +TEST(101d_edge_booleans_with_dots) { - run_test (_this, "91", true); + run_test (_this, "101", true); } -TEST(92_edge_modes) +TEST(102_edge_modes) { - run_test (_this, "92", false); + run_test (_this, "102", false); } -TEST(92d_edge_modes) +TEST(102d_edge_modes) { - run_test (_this, "92", true); + run_test (_this, "102", true); } diff --git a/testdata/drc/drcSimpleTests_90.drc b/testdata/drc/drcSimpleTests_100.drc similarity index 100% rename from testdata/drc/drcSimpleTests_90.drc rename to testdata/drc/drcSimpleTests_100.drc diff --git a/testdata/drc/drcSimpleTests_90.gds b/testdata/drc/drcSimpleTests_100.gds similarity index 100% rename from testdata/drc/drcSimpleTests_90.gds rename to testdata/drc/drcSimpleTests_100.gds diff --git a/testdata/drc/drcSimpleTests_91.drc b/testdata/drc/drcSimpleTests_101.drc similarity index 100% rename from testdata/drc/drcSimpleTests_91.drc rename to testdata/drc/drcSimpleTests_101.drc diff --git a/testdata/drc/drcSimpleTests_91.gds b/testdata/drc/drcSimpleTests_101.gds similarity index 100% rename from testdata/drc/drcSimpleTests_91.gds rename to testdata/drc/drcSimpleTests_101.gds diff --git a/testdata/drc/drcSimpleTests_92.drc b/testdata/drc/drcSimpleTests_102.drc similarity index 100% rename from testdata/drc/drcSimpleTests_92.drc rename to testdata/drc/drcSimpleTests_102.drc diff --git a/testdata/drc/drcSimpleTests_92.gds b/testdata/drc/drcSimpleTests_102.gds similarity index 100% rename from testdata/drc/drcSimpleTests_92.gds rename to testdata/drc/drcSimpleTests_102.gds diff --git a/testdata/drc/drcSimpleTests_au90.gds b/testdata/drc/drcSimpleTests_au100.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au90.gds rename to testdata/drc/drcSimpleTests_au100.gds diff --git a/testdata/drc/drcSimpleTests_au90d.gds b/testdata/drc/drcSimpleTests_au100d.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au90d.gds rename to testdata/drc/drcSimpleTests_au100d.gds diff --git a/testdata/drc/drcSimpleTests_au91.gds b/testdata/drc/drcSimpleTests_au101.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au91.gds rename to testdata/drc/drcSimpleTests_au101.gds diff --git a/testdata/drc/drcSimpleTests_au91d.gds b/testdata/drc/drcSimpleTests_au101d.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au91d.gds rename to testdata/drc/drcSimpleTests_au101d.gds diff --git a/testdata/drc/drcSimpleTests_au92.gds b/testdata/drc/drcSimpleTests_au102.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au92.gds rename to testdata/drc/drcSimpleTests_au102.gds diff --git a/testdata/drc/drcSimpleTests_au92d.gds b/testdata/drc/drcSimpleTests_au102d.gds similarity index 100% rename from testdata/drc/drcSimpleTests_au92d.gds rename to testdata/drc/drcSimpleTests_au102d.gds From d906f870b0f5b6ff9c0769d7504dc07e9c3ec61c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 25 Feb 2024 22:37:39 +0100 Subject: [PATCH 35/79] Warning level was ignored for some warnings in LEF/DEF reader --- .../lefdef/db_plugin/dbLEFDEFImporter.cc | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc index 5f0394057..803cca456 100644 --- a/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc +++ b/src/plugins/streamers/lefdef/db_plugin/dbLEFDEFImporter.cc @@ -1117,7 +1117,7 @@ LEFDEFReaderState::read_single_map_file (const std::string &path, std::map::const_iterator l = layers.begin (); l != layers.end (); ++l) { @@ -1176,7 +1176,7 @@ LEFDEFReaderState::read_single_map_file (const std::string &path, std::mapsecond == ViaGeometry) { @@ -1284,7 +1284,7 @@ LEFDEFReaderState::read_single_map_file (const std::string &path, std::mapsecond == All) { @@ -1364,21 +1364,22 @@ LEFDEFReaderState::open_layer (db::Layout &layout, const std::string &n, LayerPu m_layers.insert (std::make_pair (std::make_pair (n, LayerDetailsKey (purpose, mask)), ll)); if (ll.empty () && ! has_fallback (purpose)) { + std::string msg; if (n.empty ()) { - tl::warn << tl::to_string (tr ("No mapping for purpose")) << " '" << purpose_to_name (purpose) << "'" << tl::noendl; + msg = tl::to_string (tr ("No mapping for purpose")) + " '" + purpose_to_name (purpose) + "'"; } else { - tl::warn << tl::to_string (tr ("No mapping for layer")) << " '" << n << "', purpose '" << purpose_to_name (purpose) << "'" << tl::noendl; + msg = tl::to_string (tr ("No mapping for layer")) + " '" + n + "', purpose '" + purpose_to_name (purpose) + "'"; } if (mask > 0) { - tl::warn << tl::to_string (tr (" Mask ")) << mask << tl::noendl; + msg += tl::to_string (tr (" Mask ")) + tl::to_string (mask); } // not printing via size - too confusing? #if 0 if (via_size != db::DVector ()) { - tl::warn << tl::to_string (tr (" Via size ")) << via_size.to_string () << tl::noendl; + msg += tl::to_string (tr (" Via size ")) + via_size.to_string (); } #endif - tl::warn << tl::to_string (tr (" - layer is ignored")); + common_reader_warn (msg + tl::to_string (tr (" - layer is ignored"))); } return ll; From 8886c152bec35d891695d49813e4ecc35e67a999 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 9 Mar 2024 09:35:24 +0100 Subject: [PATCH 36/79] Changing location of test file so we don't spoil WebDAV tests from previous versions --- src/tl/unit_tests/tlHttpStreamTests.cc | 2 +- src/tl/unit_tests/tlWebDAVTests.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tl/unit_tests/tlHttpStreamTests.cc b/src/tl/unit_tests/tlHttpStreamTests.cc index 4acf10f3c..203ff8e1e 100644 --- a/src/tl/unit_tests/tlHttpStreamTests.cc +++ b/src/tl/unit_tests/tlHttpStreamTests.cc @@ -27,7 +27,7 @@ #include "tlStream.h" static std::string test_url1 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text"); -static std::string test_url1_gz ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text.gz"); +static std::string test_url1_gz ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata2/text.gz"); static std::string test_url2 ("http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir1"); TEST(1) diff --git a/src/tl/unit_tests/tlWebDAVTests.cc b/src/tl/unit_tests/tlWebDAVTests.cc index 67598d832..6d2948e7f 100644 --- a/src/tl/unit_tests/tlWebDAVTests.cc +++ b/src/tl/unit_tests/tlWebDAVTests.cc @@ -70,7 +70,6 @@ TEST(1) "[dir] dir1 http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir1/\n" "[dir] dir2 http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/dir2/\n" "text http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text\n" - "text.gz http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text.gz\n" "text2 http://www.klayout.org/svn-public/klayout-resources/trunk/testdata/text2" ); } From d60583a9b46debcb25f03dcba5a6f7965e6b085d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 9 Mar 2024 18:46:45 +0100 Subject: [PATCH 37/79] Robustness of tests --- src/db/unit_tests/dbDeepEdgesTests.cc | 64 +++++++++++++-------------- src/db/unit_tests/dbEdgesTests.cc | 30 ++++++------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/db/unit_tests/dbDeepEdgesTests.cc b/src/db/unit_tests/dbDeepEdgesTests.cc index 3dc27c43c..7d992997e 100644 --- a/src/db/unit_tests/dbDeepEdgesTests.cc +++ b/src/db/unit_tests/dbDeepEdgesTests.cc @@ -1454,55 +1454,55 @@ TEST(22_InteractingWithCount) db::Edges edup; - EXPECT_EQ (e.selected_interacting (e2).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2), size_t(2)).to_string (), "(0,10;200,10)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2), size_t(3)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (3)).to_string (), "(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (4)).to_string (), ""); + EXPECT_EQ (db::compare (e.selected_interacting (e2), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2), size_t(2)), "(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2), size_t(3)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (3)), "(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (4)), ""), true); edup = e; edup.select_interacting (e2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (edup, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); - EXPECT_EQ (e.selected_not_interacting (e2).to_string (), ""); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2), size_t(2)).to_string (), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2), size_t(3)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (3)).to_string (), "(0,0;200,0);(0,10;200,10)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (4)).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2), ""), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2), size_t(2)), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2), size_t(3)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (3)), "(0,0;200,0);(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (4)), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); edup = e; edup.select_not_interacting (e2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (edup, "(0,0;200,0)"), true); - EXPECT_EQ (e.selected_interacting_differential (e2, size_t (2), size_t(3)).first.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting_differential (e2, size_t (2), size_t(3)).second.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (e.selected_interacting_differential (e2, size_t (2), size_t(3)).first, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting_differential (e2, size_t (2), size_t(3)).second, "(0,0;200,0)"), true); - EXPECT_EQ (e.selected_interacting (r2).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2), size_t(2)).to_string (), "(0,10;200,10)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2), size_t(3)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (3)).to_string (), "(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (4)).to_string (), ""); + EXPECT_EQ (db::compare (e.selected_interacting (r2), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2), size_t(2)), "(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2), size_t(3)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (3)), "(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (4)), ""), true); edup = e; edup.select_interacting (r2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (edup, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); - EXPECT_EQ (e.selected_not_interacting (r2).to_string (), ""); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2), size_t(2)).to_string (), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2), size_t(3)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (3)).to_string (), "(0,0;200,0);(0,10;200,10)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (4)).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2), ""), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2), size_t(2)), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2), size_t(3)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (3)), "(0,0;200,0);(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (4)), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); edup = e; edup.select_not_interacting (r2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (edup, "(0,0;200,0)"), true); - EXPECT_EQ (e.selected_interacting_differential (r2, size_t (2), size_t(3)).first.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting_differential (r2, size_t (2), size_t(3)).second.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (e.selected_interacting_differential (r2, size_t (2), size_t(3)).first, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting_differential (r2, size_t (2), size_t(3)).second, "(0,0;200,0)"), true); } diff --git a/src/db/unit_tests/dbEdgesTests.cc b/src/db/unit_tests/dbEdgesTests.cc index 727405280..97f0d890c 100644 --- a/src/db/unit_tests/dbEdgesTests.cc +++ b/src/db/unit_tests/dbEdgesTests.cc @@ -789,27 +789,27 @@ TEST(20) EXPECT_EQ (r2.has_valid_edges (), false); db::Region rr1 (db::RecursiveShapeIterator (ly, ly.cell (top), lp1), db::ICplxTrans (), false); EXPECT_EQ (rr1.has_valid_polygons (), false); - EXPECT_EQ ((r1 & r2).to_string (100), "(80,70;80,40)"); - EXPECT_EQ ((r1 + r2).to_string (100), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(50,70;80,70);(80,70;80,40);(80,40;50,40);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(80,40;80,70);(80,70;110,70);(110,70;110,40);(110,40;80,40);(110,40;110,70);(110,70;140,70);(140,70;140,40);(140,40;110,40)"); - EXPECT_EQ ((r1 + r2).merged ().to_string (100), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"); - EXPECT_EQ ((r1 | r2).to_string (100), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"); - EXPECT_EQ ((r1 ^ r2).to_string (100), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"); - EXPECT_EQ ((r1 ^ r1).to_string (100), ""); - EXPECT_EQ ((r1 - r2).to_string (100), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(50,70;80,70);(80,40;50,40)"); - EXPECT_EQ ((r1 - r1).to_string (100), ""); - EXPECT_EQ (r2.merged ().to_string (100), "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,70;140,40);(140,40;80,40)"); - EXPECT_EQ (rr1.to_string (100), "(0,0;0,30;30,30;30,0);(50,0;50,30;80,30;80,0);(50,40;50,70;80,70;80,40)"); - EXPECT_EQ (r2.selected_interacting (rr1).to_string (100), "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,40;80,40)"); - EXPECT_EQ (r2.selected_interacting_differential (rr1).first.to_string (100), "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,40;80,40)"); - EXPECT_EQ (r2.selected_not_interacting (rr1).to_string (100), "(10,40;40,40);(40,40;40,10);(140,70;140,40)"); - EXPECT_EQ (r2.selected_interacting_differential (rr1).second.to_string (100), "(10,40;40,40);(40,40;40,10);(140,70;140,40)"); + EXPECT_EQ (db::compare (r1 & r2, "(80,70;80,40)"), true); + EXPECT_EQ (db::compare (r1 + r2, "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(50,70;80,70);(80,70;80,40);(80,40;50,40);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(80,40;80,70);(80,70;110,70);(110,70;110,40);(110,40;80,40);(110,40;110,70);(110,70;140,70);(140,70;140,40);(140,40;110,40)"), true); + EXPECT_EQ (db::compare ((r1 + r2).merged (), "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"), true); + EXPECT_EQ (db::compare (r1 | r2, "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"), true); + EXPECT_EQ (db::compare (r1 ^ r2, "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(50,70;140,70);(140,70;140,40);(140,40;50,40)"), true); + EXPECT_EQ (db::compare (r1 ^ r1, ""), true); + EXPECT_EQ (db::compare (r1 - r2, "(0,0;0,30);(0,30;30,30);(30,30;30,0);(30,0;0,0);(50,0;50,30);(50,30;80,30);(80,30;80,0);(80,0;50,0);(50,40;50,70);(50,70;80,70);(80,40;50,40)"), true); + EXPECT_EQ (db::compare (r1 - r1, ""), true); + EXPECT_EQ (db::compare (r2.merged (), "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(10,40;40,40);(40,40;40,10);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,70;140,40);(140,40;80,40)"), true); + EXPECT_EQ (db::compare (rr1, "(0,0;0,30;30,30;30,0);(50,0;50,30;80,30;80,0);(50,40;50,70;80,70;80,40)"), true); + EXPECT_EQ (db::compare (r2.selected_interacting (rr1), "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,40;80,40)"), true); + EXPECT_EQ (db::compare (r2.selected_interacting_differential (rr1).first, "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,40;80,40)"), true); + EXPECT_EQ (db::compare (r2.selected_not_interacting (rr1), "(10,40;40,40);(40,40;40,10);(140,70;140,40)"), true); + EXPECT_EQ (db::compare (r2.selected_interacting_differential (rr1).second, "(10,40;40,40);(40,40;40,10);(140,70;140,40)"), true); db::Edges r2dup = r2; r2.select_interacting (rr1); EXPECT_EQ (db::compare (r2, "(60,10;60,20);(60,20;70,20);(70,20;70,10);(70,10;60,10);(10,10;10,40);(40,10;10,10);(80,40;80,70);(80,70;140,70);(140,40;80,40)"), true); r2 = r2dup; r2.select_not_interacting (rr1); - EXPECT_EQ (r2.to_string (100), "(10,40;40,40);(40,40;40,10);(140,70;140,40)"); + EXPECT_EQ (db::compare (r2, "(10,40;40,40);(40,40;40,10);(140,70;140,40)"), true); r2 = db::Edges (db::RecursiveShapeIterator (ly, ly.cell (top), l2), false); EXPECT_EQ (r2.has_valid_edges (), false); From c134b6c55cfc320c96b04482a962a153d4ecef53 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 9 Mar 2024 18:47:13 +0100 Subject: [PATCH 38/79] Update of test data needed, because OASIS layer names are present now even if there is no shape --- testdata/lefdef/blend_mode/au1.oas.gz | Bin 630 -> 531 bytes testdata/lefdef/blend_mode/au2.oas.gz | Bin 610 -> 503 bytes testdata/lefdef/blend_mode/au3.oas.gz | Bin 607 -> 500 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/testdata/lefdef/blend_mode/au1.oas.gz b/testdata/lefdef/blend_mode/au1.oas.gz index e0e95c3a56e40b4127e3ef8b83e69be54b9ab0ea..a1115551b6b1cecfbb2adca5e326afabda1514f5 100644 GIT binary patch literal 531 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKC?n3q!6L)YEF;ds&mben(Z>XUoMnybM; zfb~F;;|1o9>4KX(8~>b$4qRRSKbqrK6n{_8gJqf+!3PTDn6Noy&$jcyjfKf)Bk%N&REb@Y#8Dyi3I0MH$MrM$`Am({S eW{7h@oNJ6sj2{>o85q?W%NaX>jE0c~7#IM2=-d|o literal 630 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>uojmlsTj%#@-Ua=7qIgM$Gf`(#|H%Y z2e<}>L~=3%Wtl-T%wQHoF*mz^Xo!!epDS|;GXoDYhg;a!P|wdbL_fgOPv6bc$46gJ zPmh@gs0x<^P=^tw4nD9B>=N9fVV;gyY~cm!!7athC~`Q3A%&L-M4e#dWe_~TD5K86 S!N|`55_!SS)G(3(0|NlH-_Rof diff --git a/testdata/lefdef/blend_mode/au2.oas.gz b/testdata/lefdef/blend_mode/au2.oas.gz index b05825a58ce1a8deb53006e0634912275e5c8bee..091ede9a861f2450c28b08c9bf6fecc7ec4a800c 100644 GIT binary patch delta 270 zcmaFF@|}5tXg#BhI1>kp3_r7sI14|65<{v_?ip*Y1_J@s14WJ(m^-EmZtiUSb0Ru$ zb@~5jj$2XuJv|SWX>P3IH=TLl!GUYpm-DutNr=-|YFpH|aR%F4o5h=Br=9Qnw3<0% z>)xNtoXjQp1)R*qrAbN*yBM7wr+w$={rK@qajIWp+5^XD1>N;Oq+b2p+4h3H;@3-d z_J)Y6s;V+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>Fqh;Pu=54SySoI(2L$;CxCVtpaxxc} zCNYC#m_aOVcK^^2A5TA5<`iZI9%K%;u&<$>pKFMIfTy3no2QSDzMh^QGY?P|E(xFx zBTOB9U>(>cxJAP}9kJNL3)F*KikDI3a0kp3_r7sI14|65<{v_?ip*Y1_J@s14WJ(m^-EmZtiUSb0Ru$ zb@~5jj$2XuJv|SWX>P3IH=TLl!GUYpm-DutNr=-|YFpH|aR%F4o5h=Br=9Qnw3<0% z>)xNtoXjQp1)R*qrAbN*yBM7wr+w$={rK@qajIWp+5^XD1>Jc+q+b2p+4h3H;@3-d z_J)Y6s;VGJisWU y&d9;Y4;FdB&J40kMx24;3?nnhMiBD|BNO92Mn(okWyWI0T1JM+iHskZ7#IL}wO+jd literal 607 zcmY!lcJ=kt^>+;R4CduxWH!_@V0gjKfDB|rrGn#q9V6m{J>C6WUE)3cLR{TlgW|(I zT|zuKSY&u*Akv|J*c8Z!as|hS_y@#0yZZR>Fqh;Pu=54SySoI(2L$;CxCVtpaxxc} zCNYC#m_aOVcK^^2A5TA5<`iZI9%K%;u&<$>pKFMIfTy3no2QSDzMh^QGY?P|E(xFx zBTOB9U>(>cxJAP}9kJNL3)F*KikDI3a0=L73?Pvg>`V Date: Sat, 9 Mar 2024 21:54:17 +0100 Subject: [PATCH 39/79] Fixed issue #1632 (at least partially): introducing non-const versions of RDB iterators and access methods --- src/rdb/rdb/gsiDeclRdb.cc | 256 +++++++++++++++++++++++++++++++++++++- src/rdb/rdb/rdb.cc | 39 +++++- src/rdb/rdb/rdb.h | 119 ++++++++++-------- testdata/ruby/rdbTest.rb | 72 +++++++++++ 4 files changed, 425 insertions(+), 61 deletions(-) diff --git a/src/rdb/rdb/gsiDeclRdb.cc b/src/rdb/rdb/gsiDeclRdb.cc index 00392affa..2b467f2ed 100644 --- a/src/rdb/rdb/gsiDeclRdb.cc +++ b/src/rdb/rdb/gsiDeclRdb.cc @@ -88,6 +88,49 @@ private: rdb::Database::const_item_ref_iterator m_iter; }; +class ItemRefUnwrappingNonConstIterator +{ +public: + typedef rdb::Database::const_item_ref_iterator::iterator_category iterator_category; + typedef rdb::Database::const_item_ref_iterator::difference_type difference_type; + typedef rdb::Item value_type; + typedef rdb::Item &reference; + typedef rdb::Item *pointer; + + ItemRefUnwrappingNonConstIterator (rdb::Database::item_ref_iterator i) + : m_iter (i) + { } + + bool operator== (const ItemRefUnwrappingNonConstIterator &d) const + { + return m_iter == d.m_iter; + } + + bool operator!= (const ItemRefUnwrappingNonConstIterator &d) const + { + return m_iter != d.m_iter; + } + + ItemRefUnwrappingNonConstIterator &operator++ () + { + ++m_iter; + return *this; + } + + rdb::Item &operator* () const + { + return (*m_iter).operator* (); + } + + rdb::Item *operator-> () const + { + return (*m_iter).operator-> (); + } + +private: + rdb::Database::item_ref_iterator m_iter; +}; + // --------------------------------------------------------------- // rdb::Reference binding @@ -105,7 +148,12 @@ Class decl_RdbReference ("rdb", "RdbReference", "\n" "This method has been introduced in version 0.23." ) + - gsi::method ("trans", &rdb::Reference::trans, + gsi::method ("database", (rdb::Database *(rdb::Reference::*)()) &rdb::Reference::database, + "@brief Gets the database object that category is associated with (non-const version)\n" + "\n" + "This method has been introduced in version 0.29." + ) + + gsi::method ("trans", &rdb::Reference::trans, "@brief Gets the transformation for this reference\n" "The transformation describes the transformation of the child cell into the parent cell. In that sense that is the " "usual transformation of a cell reference.\n" @@ -141,6 +189,16 @@ static rdb::References::const_iterator end_references (const rdb::Cell *cell) return cell->references ().end (); } +static rdb::References::iterator begin_references_nc (rdb::Cell *cell) +{ + return cell->references ().begin (); +} + +static rdb::References::iterator end_references_nc (rdb::Cell *cell) +{ + return cell->references ().end (); +} + static void add_reference (rdb::Cell *cell, const rdb::Reference &ref) { cell->references ().insert (ref); @@ -163,6 +221,18 @@ ItemRefUnwrappingIterator cell_items_end (const rdb::Cell *cell) return cell->database ()->items_by_cell (cell->id ()).second; } +ItemRefUnwrappingNonConstIterator cell_items_begin_non_const (rdb::Cell *cell) +{ + tl_assert (cell->database ()); + return cell->database ()->items_by_cell (cell->id ()).first; +} + +ItemRefUnwrappingNonConstIterator cell_items_end_non_const (rdb::Cell *cell) +{ + tl_assert (cell->database ()); + return cell->database ()->items_by_cell (cell->id ()).second; +} + Class decl_RdbCell ("rdb", "RdbCell", gsi::method ("rdb_id", &rdb::Cell::id, "@brief Gets the cell ID\n" @@ -175,12 +245,22 @@ Class decl_RdbCell ("rdb", "RdbCell", "\n" "This method has been introduced in version 0.23." ) + + gsi::method ("database", (rdb::Database *(rdb::Cell::*)()) &rdb::Cell::database, + "@brief Gets the database object that category is associated with (non-const version)\n" + "\n" + "This method has been introduced in version 0.29." + ) + gsi::iterator_ext ("each_item", &cell_items_begin, &cell_items_end, "@brief Iterates over all items inside the database which are associated with this cell\n" "\n" "This method has been introduced in version 0.23." ) + - gsi::method ("name", &rdb::Cell::name, + gsi::iterator_ext ("each_item", &cell_items_begin_non_const, &cell_items_end_non_const, + "@brief Iterates over all items inside the database which are associated with this cell (non-const version)\n" + "\n" + "This method has been introduced in version 0.29." + ) + + gsi::method ("name", &rdb::Cell::name, "@brief Gets the cell name\n" "The cell name is an string that identifies the category in the database. " "Additionally, a cell may carry a variant identifier which is a string that uniquely identifies a cell " @@ -215,6 +295,11 @@ Class decl_RdbCell ("rdb", "RdbCell", ) + gsi::iterator_ext ("each_reference", &begin_references, &end_references, "@brief Iterates over all references\n" + ) + + gsi::iterator_ext ("each_reference", &begin_references_nc, &end_references_nc, + "@brief Iterates over all references (non-const version)\n" + "\n" + "This method has been introduced in version 0.23." ), "@brief A cell inside the report database\n" "This class represents a cell in the report database. There is not necessarily a 1:1 correspondence of RDB cells " @@ -226,12 +311,22 @@ Class decl_RdbCell ("rdb", "RdbCell", // --------------------------------------------------------------- // rdb::Category binding -static rdb::Categories::iterator begin_sub_categories (rdb::Category *cat) +static rdb::Categories::const_iterator begin_sub_categories (const rdb::Category *cat) { return cat->sub_categories ().begin (); } -static rdb::Categories::iterator end_sub_categories (rdb::Category *cat) +static rdb::Categories::const_iterator end_sub_categories (const rdb::Category *cat) +{ + return cat->sub_categories ().end (); +} + +static rdb::Categories::iterator begin_sub_categories_non_const (rdb::Category *cat) +{ + return cat->sub_categories ().begin (); +} + +static rdb::Categories::iterator end_sub_categories_non_const (rdb::Category *cat) { return cat->sub_categories ().end (); } @@ -248,6 +343,18 @@ ItemRefUnwrappingIterator category_items_end (const rdb::Category *cat) return cat->database ()->items_by_category (cat->id ()).second; } +ItemRefUnwrappingNonConstIterator category_items_begin_non_const (rdb::Category *cat) +{ + tl_assert (cat->database ()); + return cat->database ()->items_by_category (cat->id ()).first; +} + +ItemRefUnwrappingNonConstIterator category_items_end_non_const (rdb::Category *cat) +{ + tl_assert (cat->database ()); + return cat->database ()->items_by_category (cat->id ()).second; +} + static void scan_layer (rdb::Category *cat, const db::Layout &layout, unsigned int layer, const db::Cell *from_cell, int levels, bool with_properties) { rdb::scan_layer (cat, layout, layer, from_cell, levels, with_properties); @@ -299,6 +406,11 @@ Class decl_RdbCategory ("rdb", "RdbCategory", "\n" "This method has been introduced in version 0.23." ) + + gsi::iterator_ext ("each_item", &category_items_begin_non_const, &category_items_end_non_const, + "@brief Iterates over all items inside the database which are associated with this category (non-const version)\n" + "\n" + "This method has been introduced in version 0.29." + ) + gsi::method_ext ("scan_shapes", &scan_shapes, gsi::arg ("iter"), gsi::arg ("flat", false), gsi::arg ("with_properties", true), "@brief Scans the polygon or edge shapes from the shape iterator into the category\n" "Creates RDB items for each polygon or edge shape read from the iterator and puts them into this category.\n" @@ -379,12 +491,23 @@ Class decl_RdbCategory ("rdb", "RdbCategory", ) + gsi::iterator_ext ("each_sub_category", &begin_sub_categories, &end_sub_categories, "@brief Iterates over all sub-categories\n" + "\n" + "The const version has been added in version 0.29." ) + - gsi::method ("parent", (rdb::Category *(rdb::Category::*) ()) &rdb::Category::parent, + gsi::iterator_ext ("each_sub_category", &begin_sub_categories_non_const, &end_sub_categories_non_const, + "@brief Iterates over all sub-categories (non-const version)\n" + ) + + gsi::method ("parent", (const rdb::Category *(rdb::Category::*) () const) &rdb::Category::parent, "@brief Gets the parent category of this category\n" "@return The parent category or nil if this category is a top-level category\n" + "\n" + "The const version has been added in version 0.29." ) + - gsi::method ("num_items", &rdb::Category::num_items, + gsi::method ("parent", (rdb::Category *(rdb::Category::*) ()) &rdb::Category::parent, + "@brief Gets the parent category of this category (non-const version)\n" + "@return The parent category or nil if this category is a top-level category\n" + ) + + gsi::method ("num_items", &rdb::Category::num_items, "@brief Gets the number of items in this category\n" "The number of items includes the items in sub-categories of this category.\n" ) + @@ -923,6 +1046,16 @@ rdb::Items::const_iterator database_items_end (const rdb::Database *db) return db->items ().end (); } +rdb::Items::iterator database_items_begin_nc (rdb::Database *db) +{ + return db->items_non_const ().begin (); +} + +rdb::Items::iterator database_items_end_nc (rdb::Database *db) +{ + return db->items_non_const ().end (); +} + ItemRefUnwrappingIterator database_items_begin_cell (const rdb::Database *db, rdb::id_type cell_id) { return db->items_by_cell (cell_id).first; @@ -933,6 +1066,16 @@ ItemRefUnwrappingIterator database_items_end_cell (const rdb::Database *db, rdb: return db->items_by_cell (cell_id).second; } +ItemRefUnwrappingNonConstIterator database_items_begin_cell_nc (rdb::Database *db, rdb::id_type cell_id) +{ + return db->items_by_cell (cell_id).first; +} + +ItemRefUnwrappingNonConstIterator database_items_end_cell_nc (rdb::Database *db, rdb::id_type cell_id) +{ + return db->items_by_cell (cell_id).second; +} + ItemRefUnwrappingIterator database_items_begin_cat (const rdb::Database *db, rdb::id_type cat_id) { return db->items_by_category (cat_id).first; @@ -943,6 +1086,16 @@ ItemRefUnwrappingIterator database_items_end_cat (const rdb::Database *db, rdb:: return db->items_by_category (cat_id).second; } +ItemRefUnwrappingNonConstIterator database_items_begin_cat_nc (rdb::Database *db, rdb::id_type cat_id) +{ + return db->items_by_category (cat_id).first; +} + +ItemRefUnwrappingNonConstIterator database_items_end_cat_nc (rdb::Database *db, rdb::id_type cat_id) +{ + return db->items_by_category (cat_id).second; +} + ItemRefUnwrappingIterator database_items_begin_cc (const rdb::Database *db, rdb::id_type cell_id, rdb::id_type cat_id) { return db->items_by_cell_and_category (cell_id, cat_id).first; @@ -953,6 +1106,16 @@ ItemRefUnwrappingIterator database_items_end_cc (const rdb::Database *db, rdb::i return db->items_by_cell_and_category (cell_id, cat_id).second; } +ItemRefUnwrappingNonConstIterator database_items_begin_cc_nc (rdb::Database *db, rdb::id_type cell_id, rdb::id_type cat_id) +{ + return db->items_by_cell_and_category (cell_id, cat_id).first; +} + +ItemRefUnwrappingNonConstIterator database_items_end_cc_nc (rdb::Database *db, rdb::id_type cell_id, rdb::id_type cat_id) +{ + return db->items_by_cell_and_category (cell_id, cat_id).second; +} + rdb::Categories::const_iterator database_begin_categories (const rdb::Database *db) { return db->categories ().begin (); @@ -963,6 +1126,16 @@ rdb::Categories::const_iterator database_end_categories (const rdb::Database *db return db->categories ().end (); } +rdb::Categories::iterator database_end_categories_nc (rdb::Database *db) +{ + return db->categories_non_const ().end (); +} + +rdb::Categories::iterator database_begin_categories_nc (rdb::Database *db) +{ + return db->categories_non_const ().begin (); +} + rdb::Cells::const_iterator database_begin_cells (const rdb::Database *db) { return db->cells ().begin (); @@ -973,6 +1146,16 @@ rdb::Cells::const_iterator database_end_cells (const rdb::Database *db) return db->cells ().end (); } +rdb::Cells::iterator database_begin_cells_nc (rdb::Database *db) +{ + return db->cells_non_const ().begin (); +} + +rdb::Cells::iterator database_end_cells_nc (rdb::Database *db) +{ + return db->cells_non_const ().end (); +} + const std::string &database_tag_name (const rdb::Database *db, rdb::id_type tag) { return db->tags ().tag (tag).name (); @@ -1121,6 +1304,11 @@ Class decl_ReportDatabase ("rdb", "ReportDatabase", gsi::iterator_ext ("each_category", &database_begin_categories, &database_end_categories, "@brief Iterates over all top-level categories\n" ) + + gsi::iterator_ext ("each_category", &database_begin_categories_nc, &database_end_categories_nc, + "@brief Iterates over all top-level categories (non-const version)\n" + "\n" + "The non-const variant has been added in version 0.29." + ) + gsi::method ("create_category", (rdb::Category *(rdb::Database::*) (const std::string &)) &rdb::Database::create_category, gsi::arg ("name"), "@brief Creates a new top level category\n" "@param name The name of the category\n" @@ -1135,10 +1323,23 @@ Class decl_ReportDatabase ("rdb", "ReportDatabase", "@param path The full path to the category starting from the top level (subcategories separated by dots)\n" "@return The (const) category object or nil if the name is not valid\n" ) + + gsi::method ("category_by_path", &rdb::Database::category_by_name_non_const, gsi::arg ("path"), + "@brief Gets a category by path (non-const version)\n" + "@param path The full path to the category starting from the top level (subcategories separated by dots)\n" + "@return The (const) category object or nil if the name is not valid\n" + "\n" + "This non-const variant has been introduced in version 0.29." + ) + gsi::method ("category_by_id", &rdb::Database::category_by_id, gsi::arg ("id"), "@brief Gets a category by ID\n" "@return The (const) category object or nil if the ID is not valid\n" ) + + gsi::method ("category_by_id", &rdb::Database::category_by_id_non_const, gsi::arg ("id"), + "@brief Gets a category by ID (non-const version)\n" + "@return The (const) category object or nil if the ID is not valid\n" + "\n" + "This non-const variant has been introduced in version 0.29." + ) + gsi::method ("create_cell", (rdb::Cell *(rdb::Database::*) (const std::string &)) &rdb::Database::create_cell, gsi::arg ("name"), "@brief Creates a new cell\n" "@param name The name of the cell\n" @@ -1158,14 +1359,33 @@ Class decl_ReportDatabase ("rdb", "ReportDatabase", "@param qname The qualified name of the cell (name plus variant name optionally)\n" "@return The cell object or nil if no such cell exists\n" ) + + gsi::method ("cell_by_qname", &rdb::Database::cell_by_qname_non_const, gsi::arg ("qname"), + "@brief Returns the cell for a given qualified name (non-const version)\n" + "@param qname The qualified name of the cell (name plus variant name optionally)\n" + "@return The cell object or nil if no such cell exists\n" + "\n" + "This non-const variant has been added version 0.29." + ) + gsi::method ("cell_by_id", &rdb::Database::cell_by_id, gsi::arg ("id"), "@brief Returns the cell for a given ID\n" "@param id The ID of the cell\n" "@return The cell object or nil if no cell with that ID exists\n" ) + + gsi::method ("cell_by_id", &rdb::Database::cell_by_id_non_const, gsi::arg ("id"), + "@brief Returns the cell for a given ID (non-const version)\n" + "@param id The ID of the cell\n" + "@return The cell object or nil if no cell with that ID exists\n" + "\n" + "This non-const variant has been added version 0.29." + ) + gsi::iterator_ext ("each_cell", &database_begin_cells, &database_end_cells, "@brief Iterates over all cells\n" ) + + gsi::iterator_ext ("each_cell", &database_begin_cells_nc, &database_end_cells_nc, + "@brief Iterates over all cells (non-const version)\n" + "\n" + "This non-const variant has been added version 0.29." + ) + gsi::method ("num_items", (size_t (rdb::Database::*) () const) &rdb::Database::num_items, "@brief Returns the number of items inside the database\n" "@return The total number of items\n" @@ -1351,19 +1571,43 @@ Class decl_ReportDatabase ("rdb", "ReportDatabase", gsi::iterator_ext ("each_item", &database_items_begin, &database_items_end, "@brief Iterates over all items inside the database\n" ) + + gsi::iterator_ext ("each_item", &database_items_begin_nc, &database_items_end_nc, + "@brief Iterates over all items inside the database (non-const version)\n" + "\n" + "This non-const variant has been added in version 0.29." + ) + gsi::iterator_ext ("each_item_per_cell", &database_items_begin_cell, &database_items_end_cell, gsi::arg ("cell_id"), "@brief Iterates over all items inside the database which are associated with the given cell\n" "@param cell_id The ID of the cell for which all associated items should be retrieved\n" ) + + gsi::iterator_ext ("each_item_per_cell", &database_items_begin_cell_nc, &database_items_end_cell_nc, gsi::arg ("cell_id"), + "@brief Iterates over all items inside the database which are associated with the given cell (non-const version)\n" + "@param cell_id The ID of the cell for which all associated items should be retrieved\n" + "\n" + "This non-const variant has been added in version 0.29." + ) + gsi::iterator_ext ("each_item_per_category", &database_items_begin_cat, &database_items_end_cat, gsi::arg ("category_id"), "@brief Iterates over all items inside the database which are associated with the given category\n" "@param category_id The ID of the category for which all associated items should be retrieved\n" ) + + gsi::iterator_ext ("each_item_per_category", &database_items_begin_cat_nc, &database_items_end_cat_nc, gsi::arg ("category_id"), + "@brief Iterates over all items inside the database which are associated with the given category (non-const version)\n" + "@param category_id The ID of the category for which all associated items should be retrieved\n" + "\n" + "This non-const variant has been added in version 0.29." + ) + gsi::iterator_ext ("each_item_per_cell_and_category", &database_items_begin_cc, &database_items_end_cc, gsi::arg ("cell_id"), gsi::arg ("category_id"), "@brief Iterates over all items inside the database which are associated with the given cell and category\n" "@param cell_id The ID of the cell for which all associated items should be retrieved\n" "@param category_id The ID of the category for which all associated items should be retrieved\n" ) + + gsi::iterator_ext ("each_item_per_cell_and_category", &database_items_begin_cc_nc, &database_items_end_cc_nc, gsi::arg ("cell_id"), gsi::arg ("category_id"), + "@brief Iterates over all items inside the database which are associated with the given cell and category\n" + "@param cell_id The ID of the cell for which all associated items should be retrieved\n" + "@param category_id The ID of the category for which all associated items should be retrieved\n" + "\n" + "This non-const variant has been added in version 0.29." + ) + gsi::method ("set_item_visited", &rdb::Database::set_item_visited, gsi::arg ("item"), gsi::arg ("visited"), "@brief Modifies the visited state of an item\n" "@param item The item to modify\n" diff --git a/src/rdb/rdb/rdb.cc b/src/rdb/rdb/rdb.cc index 887383198..464d31409 100644 --- a/src/rdb/rdb/rdb.cc +++ b/src/rdb/rdb/rdb.cc @@ -1488,7 +1488,18 @@ Database::items_by_cell_and_category (id_type cell_id, id_type category_id) cons } } -std::pair +std::pair +Database::items_by_cell_and_category (id_type cell_id, id_type category_id) +{ + std::map , std::list >::iterator i = m_items_by_cell_and_category_id.find (std::make_pair (cell_id, category_id)); + if (i != m_items_by_cell_and_category_id.end ()) { + return std::make_pair (i->second.begin (), i->second.end ()); + } else { + return std::make_pair (empty_list.begin (), empty_list.end ()); + } +} + +std::pair Database::items_by_cell (id_type cell_id) const { std::map >::const_iterator i = m_items_by_cell_id.find (cell_id); @@ -1499,7 +1510,18 @@ Database::items_by_cell (id_type cell_id) const } } -std::pair +std::pair +Database::items_by_cell (id_type cell_id) +{ + std::map >::iterator i = m_items_by_cell_id.find (cell_id); + if (i != m_items_by_cell_id.end ()) { + return std::make_pair (i->second.begin (), i->second.end ()); + } else { + return std::make_pair (empty_list.begin (), empty_list.end ()); + } +} + +std::pair Database::items_by_category (id_type category_id) const { std::map >::const_iterator i = m_items_by_category_id.find (category_id); @@ -1510,7 +1532,18 @@ Database::items_by_category (id_type category_id) const } } -size_t +std::pair +Database::items_by_category (id_type category_id) +{ + std::map >::iterator i = m_items_by_category_id.find (category_id); + if (i != m_items_by_category_id.end ()) { + return std::make_pair (i->second.begin (), i->second.end ()); + } else { + return std::make_pair (empty_list.begin (), empty_list.end ()); + } +} + +size_t Database::num_items (id_type cell_id, id_type category_id) const { std::map , size_t>::const_iterator n = m_num_items_by_cell_and_category.find (std::make_pair (cell_id, category_id)); diff --git a/src/rdb/rdb/rdb.h b/src/rdb/rdb/rdb.h index a7859f60e..6b5069bda 100644 --- a/src/rdb/rdb/rdb.h +++ b/src/rdb/rdb/rdb.h @@ -2082,6 +2082,14 @@ public: return *mp_categories; } + /** + * @brief Get the reference to the categories collection (non-const version) + */ + Categories &categories_non_const () + { + return *mp_categories; + } + /** * @brief Import categories * @@ -2129,6 +2137,20 @@ public: return const_cast (this)->category_by_id_non_const (id); } + /** + * @brief Get the category pointer for a category name (non-const version) + * + * This method returns 0 if the category name is invalid. + */ + Category *category_by_name_non_const (const std::string &name); + + /** + * @brief Get the category pointer for a category id (non-const version) + * + * This method returns 0 if the category is invalid. + */ + Category *category_by_id_non_const (id_type id); + /** * @brief Access to the cell collection (const) */ @@ -2137,6 +2159,14 @@ public: return m_cells; } + /** + * @brief Access to the cell collection + */ + Cells &cells_non_const () + { + return m_cells; + } + /** * @brief Import cells * @@ -2190,6 +2220,20 @@ public: return const_cast (this)->cell_by_id_non_const (id); } + /** + * @brief Get the cell pointer for a cell name or name:variant combination (non-const version) + * + * This method returns 0 if the cell name or name:variant combination is invalid. + */ + Cell *cell_by_qname_non_const (const std::string &qname); + + /** + * @brief Get the cell pointer for a cell id (non-const version) + * + * This method returns 0 if the cell id is invalid. + */ + Cell *cell_by_id_non_const (id_type id); + /** * @brief Report the number of items in total */ @@ -2266,6 +2310,14 @@ public: return *mp_items; } + /** + * @brief Get the items collection (non-const version) + */ + Items &items_non_const () + { + return *mp_items; + } + /** * @brief Set the items collection * @@ -2279,16 +2331,31 @@ public: */ std::pair items_by_cell (id_type cell_id) const; + /** + * @brief Get an iterator pair that delivers the non-const items (ItemRef) for a given cell + */ + std::pair items_by_cell (id_type cell_id); + /** * @brief Get an iterator that delivers the const items (ItemRef) for a given category */ std::pair items_by_category (id_type category_id) const; + /** + * @brief Get an iterator that delivers the non-const items (ItemRef) for a given category + */ + std::pair items_by_category (id_type category_id); + /** * @brief Get an iterator that delivers the const items (ItemRef) for a given cell and category */ std::pair items_by_cell_and_category (id_type cell_id, id_type category_id) const; + /** + * @brief Get an iterator that delivers the non-const items (ItemRef) for a given cell and category + */ + std::pair items_by_cell_and_category (id_type cell_id, id_type category_id); + /** * @brief Returns true, if the database was modified */ @@ -2349,14 +2416,6 @@ private: m_modified = true; } - /** - * @brief Get the items collection (non-const version) - */ - Items &items_non_const () - { - return *mp_items; - } - /** * @brief Get the reference to the tags collection (non-const version) */ @@ -2364,50 +2423,6 @@ private: { return m_tags; } - - /** - * @brief Get the reference to the categories collection (non-const version) - */ - Categories &categories_non_const () - { - return *mp_categories; - } - - /** - * @brief Get the category pointer for a category name - * - * This method returns 0 if the category name is invalid. - */ - Category *category_by_name_non_const (const std::string &name); - - /** - * @brief Get the category pointer for a category id - * - * This method returns 0 if the category is invalid. - */ - Category *category_by_id_non_const (id_type id); - - /** - * @brief Access to the cell collection - */ - Cells &cells_non_const () - { - return m_cells; - } - - /** - * @brief Get the cell pointer for a cell name or name:variant combination (non-const version) - * - * This method returns 0 if the cell name or name:variant combination is invalid. - */ - Cell *cell_by_qname_non_const (const std::string &qname); - - /** - * @brief Get the cell pointer for a cell id (non-const version) - * - * This method returns 0 if the cell id is invalid. - */ - Cell *cell_by_id_non_const (id_type id); }; } diff --git a/testdata/ruby/rdbTest.rb b/testdata/ruby/rdbTest.rb index e6e1ace7d..8b1c2b13d 100644 --- a/testdata/ruby/rdbTest.rb +++ b/testdata/ruby/rdbTest.rb @@ -935,6 +935,78 @@ class RDB_TestClass < TestBase end + def test_13 + + # manipulations + rdb = RBA::ReportDatabase::new("") + + _cell = rdb.create_cell("CELL") + _cat = rdb.create_category("cat") + _subcat = rdb.create_category(_cat, "subcat") + _subcat.description = "subcat_d" + _item1 = rdb.create_item(_cell.rdb_id, _subcat.rdb_id) + _item1.add_value(17.5) + _item1.add_value("string") + _item2 = rdb.create_item(_cell.rdb_id, _subcat.rdb_id) + _item2.add_value("b") + _subsubcat = rdb.create_category(_subcat, "subsubcat") + _cat2 = rdb.create_category("cat2") + + cell = rdb.cell_by_id(_cell.rdb_id) + assert_equal(cell._is_const_object?, false) + assert_equal(rdb.each_cell.first._is_const_object?, false) + + cell = rdb.cell_by_qname("CELL") + assert_equal(cell._is_const_object?, false) + + cat = rdb.category_by_id(_cat.rdb_id) + assert_equal(cat._is_const_object?, false) + + cat = rdb.category_by_path("cat") + assert_equal(cat._is_const_object?, false) + subcat = rdb.category_by_path("cat.subcat") + + assert_equal(rdb.each_category.first._is_const_object?, false) + assert_equal(rdb.each_category.collect { |c| c.name }.join(","), "cat,cat2") + assert_equal(subcat._is_const_object?, false) + assert_equal(subcat.database._is_const_object?, false) + assert_equal(subcat.name, "subcat") + assert_equal(subcat.parent.name, "cat") + + assert_equal(subcat.description, "subcat_d") + subcat.description = "changed" + assert_equal(subcat.description, "changed") + + assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), "float: 17.5/text: string;text: b") + + item1 = rdb.each_item_per_category(subcat.rdb_id).first + assert_equal(item1._is_const_object?, false) + item1.clear_values + assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), ";text: b") + item1.add_value("x") + assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), "text: x;text: b") + item1.add_tag(17) + assert_equal(item1.has_tag?(17), true) + assert_equal(item1.has_tag?(16), false) + + item1 = rdb.each_item.first + assert_equal(item1._is_const_object?, false) + assert_equal(item1.has_tag?(17), true) + + item1 = rdb.each_item_per_cell(cell.rdb_id).first + assert_equal(item1._is_const_object?, false) + assert_equal(item1.has_tag?(17), true) + + item1 = rdb.each_item_per_cell_and_category(cell.rdb_id, subcat.rdb_id).first + assert_equal(item1._is_const_object?, false) + assert_equal(item1.has_tag?(17), true) + + item1 = cell.each_item.first + assert_equal(item1._is_const_object?, false) + assert_equal(item1.has_tag?(17), true) + + end + end load("test_epilogue.rb") From f2d61e1dee6da22720978d63b39e996e8d146836 Mon Sep 17 00:00:00 2001 From: klayoutmatthias Date: Mon, 11 Mar 2024 22:39:59 +0000 Subject: [PATCH 40/79] Fixed a crash with Ruby 2.0.0 on CentOS7 --- testdata/ruby/rdbTest.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/testdata/ruby/rdbTest.rb b/testdata/ruby/rdbTest.rb index 8b1c2b13d..abc40519f 100644 --- a/testdata/ruby/rdbTest.rb +++ b/testdata/ruby/rdbTest.rb @@ -954,7 +954,7 @@ class RDB_TestClass < TestBase cell = rdb.cell_by_id(_cell.rdb_id) assert_equal(cell._is_const_object?, false) - assert_equal(rdb.each_cell.first._is_const_object?, false) + assert_equal(rdb.each_cell.to_a[0]._is_const_object?, false) cell = rdb.cell_by_qname("CELL") assert_equal(cell._is_const_object?, false) @@ -966,7 +966,7 @@ class RDB_TestClass < TestBase assert_equal(cat._is_const_object?, false) subcat = rdb.category_by_path("cat.subcat") - assert_equal(rdb.each_category.first._is_const_object?, false) + assert_equal(rdb.each_category.to_a[0]._is_const_object?, false) assert_equal(rdb.each_category.collect { |c| c.name }.join(","), "cat,cat2") assert_equal(subcat._is_const_object?, false) assert_equal(subcat.database._is_const_object?, false) @@ -979,7 +979,7 @@ class RDB_TestClass < TestBase assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), "float: 17.5/text: string;text: b") - item1 = rdb.each_item_per_category(subcat.rdb_id).first + item1 = rdb.each_item_per_category(subcat.rdb_id).to_a[0] assert_equal(item1._is_const_object?, false) item1.clear_values assert_equal(rdb.each_item_per_category(subcat.rdb_id).collect { |item| item.each_value.collect { |v| v.to_s }.join("/") }.join(";"), ";text: b") @@ -989,19 +989,19 @@ class RDB_TestClass < TestBase assert_equal(item1.has_tag?(17), true) assert_equal(item1.has_tag?(16), false) - item1 = rdb.each_item.first + item1 = rdb.each_item.to_a[0] assert_equal(item1._is_const_object?, false) assert_equal(item1.has_tag?(17), true) - item1 = rdb.each_item_per_cell(cell.rdb_id).first + item1 = rdb.each_item_per_cell(cell.rdb_id).to_a[0] assert_equal(item1._is_const_object?, false) assert_equal(item1.has_tag?(17), true) - item1 = rdb.each_item_per_cell_and_category(cell.rdb_id, subcat.rdb_id).first + item1 = rdb.each_item_per_cell_and_category(cell.rdb_id, subcat.rdb_id).to_a[0] assert_equal(item1._is_const_object?, false) assert_equal(item1.has_tag?(17), true) - item1 = cell.each_item.first + item1 = cell.each_item.to_a[0] assert_equal(item1._is_const_object?, false) assert_equal(item1.has_tag?(17), true) From 2d91f7f90c9341289ae9f6a3f7c01cff5d1c6ae0 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 11 Mar 2024 22:42:33 +0100 Subject: [PATCH 41/79] [consider merging] Bugfix: connect_explicit did not accept an array of nets as single argument --- src/drc/drc/built-in-macros/_drc_netter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drc/drc/built-in-macros/_drc_netter.rb b/src/drc/drc/built-in-macros/_drc_netter.rb index 1985cc67c..8c970483c 100644 --- a/src/drc/drc/built-in-macros/_drc_netter.rb +++ b/src/drc/drc/built-in-macros/_drc_netter.rb @@ -379,7 +379,8 @@ module DRC arg1.is_a?(String) || raise("The first argument has to be a string") @pre_extract_config << lambda { |l2n| l2n.join_nets(arg1, arg2) } else - arg1.is_a?(String) || raise("The argument has to be a string") + arg1.is_a?(Array) || raise("The argument has to be an array of strings") + arg1.find { |a| !a.is_a?(String) } && raise("The argument has to be an array of strings") @pre_extract_config << lambda { |l2n| l2n.join_nets(arg1) } end From fa14afbbf30ba287e647cd684b38952efb08f43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6fferlein?= Date: Wed, 13 Mar 2024 21:50:48 +0100 Subject: [PATCH 42/79] Pcell limits (#1654) * Klayout PyCell integration -added tl::optional as derivate of std::optional for c++17 and above, reduced implementation otherwise -fixed missing include for c++17 and above -added range constraints for PCell parameter Signed-off-by: ThomasZecha * tl::optional now based on internal implementation, added tests and tl::to_string binding * Refactoring the range into min_value and max_value attributes without action and resolution. * Integration of feature into PCell framework * Cleanup and fixed some compile issues * Cleanup, added tests * [consider merging] Added pymod distutil_src files to dependencies. * Updated Python stubs * User feedback: upon entering an invalid value string into an edit box, do not reset the field --------- Signed-off-by: ThomasZecha Co-authored-by: ThomasZecha Co-authored-by: Matthias Koefferlein --- .../pcell_declaration_helper.lym | 10 + .../pcell_declaration_helper.lym | 6 + src/db/db/dbPCellDeclaration.h | 56 +- src/db/db/gsiDeclDbLibrary.cc | 84 +- src/edt/edt/edtPCellParametersPage.cc | 37 +- src/edt/edt/edtPCellParametersPage.h | 1 + .../klayout/db/pcell_declaration_helper.py | 6 +- src/pymod/distutils_src/klayout/dbcore.pyi | 1129 +++++++++++------ src/pymod/distutils_src/klayout/laycore.pyi | 64 +- src/pymod/distutils_src/klayout/tlcore.pyi | 27 +- src/pymod/pymod.pri | 2 + src/tl/tl/tl.pro | 6 +- src/tl/tl/tlOptional.cc | 30 + src/tl/tl/tlOptional.h | 156 +++ src/tl/unit_tests/tlOptionalTests.cc | 97 ++ src/tl/unit_tests/unit_tests.pro | 1 + testdata/ruby/dbPCells.rb | 72 ++ 17 files changed, 1330 insertions(+), 454 deletions(-) create mode 100644 src/tl/tl/tlOptional.cc create mode 100644 src/tl/tl/tlOptional.h create mode 100644 src/tl/unit_tests/tlOptionalTests.cc diff --git a/src/db/db/built-in-macros/pcell_declaration_helper.lym b/src/db/db/built-in-macros/pcell_declaration_helper.lym index 43754b65d..ba97fac7d 100644 --- a/src/db/db/built-in-macros/pcell_declaration_helper.lym +++ b/src/db/db/built-in-macros/pcell_declaration_helper.lym @@ -118,6 +118,12 @@ Optional, named parameters are @li @b:unit@/b: the unit string @/li + @li + @b:min_value@/b: the minimum value (effective for numerical types and if no choices are present) + @/li + @li + @b:max_value@/b: the maximum value (effective for numerical types and if no choices are present) + @/li @li @b:default@/b: the default value @/li @@ -335,6 +341,8 @@ module RBA # :hidden -> (boolean) true, if the parameter is not shown in the dialog # :readonly -> (boolean) true, if the parameter cannot be edited # :unit -> the unit string + # :min_value -> the minimum value (only effective for numerical types and if no choices are present) + # :max_value -> the maximum value (only effective for numerical types and if no choices are present) # :default -> the default value # :choices -> ([ [ d, v ], ...) choice descriptions/value for choice type # this method defines accessor methods for the parameters @@ -373,6 +381,8 @@ module RBA args[:hidden] && pdecl.hidden = args[:hidden] args[:readonly] && pdecl.readonly = args[:readonly] args[:unit] && pdecl.unit = args[:unit] + args[:min_value] && pdecl.min_value = args[:min_value] + args[:max_value] && pdecl.max_value = args[:max_value] if args[:choices] if !args[:choices].is_a?(Array) raise ":choices value must be an array of two-element arrays (description, value)" diff --git a/src/db/db/built-in-pymacros/pcell_declaration_helper.lym b/src/db/db/built-in-pymacros/pcell_declaration_helper.lym index 462883154..2b3113ca0 100644 --- a/src/db/db/built-in-pymacros/pcell_declaration_helper.lym +++ b/src/db/db/built-in-pymacros/pcell_declaration_helper.lym @@ -127,6 +127,12 @@ Optional, named parameters are @li @bunit@/b: the unit string @/li + @li + @bmin_value@/b: the minimum value (effective for numerical types and if no choices are present) + @/li + @li + @bmax_value@/b: the maximum value (effective for numerical types and if no choices are present) + @/li @li @bdefault@/b: the default value @/li diff --git a/src/db/db/dbPCellDeclaration.h b/src/db/db/dbPCellDeclaration.h index 08e058683..3687ef71a 100644 --- a/src/db/db/dbPCellDeclaration.h +++ b/src/db/db/dbPCellDeclaration.h @@ -30,6 +30,7 @@ #include "dbLayout.h" #include "tlVariant.h" #include "tlObject.h" +#include "tlOptional.h" namespace db { @@ -267,6 +268,56 @@ public: m_choice_descriptions = choice_descriptions; } + /** + * @brief Sets the minimum value + * + * The minimum value is a visual feature and limits the allowed values for numerical + * entry boxes. This applies to parameters of type int or double. The minimum value + * is not effective if choices are present. + * + * The minimum value is not enforced - for example there is no restriction implemented + * when setting values programmatically. + * + * Setting this attribute to "nil" (the default) implies "no limit". + */ + void set_min_value (const tl::Variant &min) + { + m_min_value = min; + } + + /** + * @brief Gets the minimum value (see \set_min_value) + */ + const tl::Variant &min_value () const + { + return m_min_value; + } + + /** + * @brief Sets the maximum value + * + * The maximum value is a visual feature and limits the allowed values for numerical + * entry boxes. This applies to parameters of type int or double. The maximum value + * is not effective if choices are present. + * + * The maximum value is not enforced - for example there is no restriction implemented + * when setting values programmatically. + * + * Setting this attribute to "nil" (the default) implies "no limit". + */ + void set_max_value (const tl::Variant &max) + { + m_max_value = max; + } + + /** + * @brief Gets the maximum value (see \set_max_value) + */ + const tl::Variant &max_value () const + { + return m_max_value; + } + /** * @brief Equality */ @@ -280,7 +331,9 @@ public: m_type == d.m_type && m_name == d.m_name && m_description == d.m_description && - m_unit == d.m_unit; + m_unit == d.m_unit && + m_min_value == d.m_min_value && + m_max_value == d.m_max_value; } private: @@ -291,6 +344,7 @@ private: type m_type; std::string m_name; std::string m_description, m_unit; + tl::Variant m_min_value, m_max_value; }; /** diff --git a/src/db/db/gsiDeclDbLibrary.cc b/src/db/db/gsiDeclDbLibrary.cc index 8f739a5ee..8fd578392 100644 --- a/src/db/db/gsiDeclDbLibrary.cc +++ b/src/db/db/gsiDeclDbLibrary.cc @@ -29,6 +29,7 @@ #include "dbPCellDeclaration.h" #include "dbLibrary.h" #include "dbLibraryManager.h" +#include "tlLog.h" namespace gsi { @@ -701,23 +702,23 @@ Class decl_PCellDeclaration (decl_PCellDeclaration_Native, // --------------------------------------------------------------- // db::PCellParameterDeclaration binding -unsigned int get_type (const db::PCellParameterDeclaration *pd) +static unsigned int get_type (const db::PCellParameterDeclaration *pd) { return (unsigned int) pd->get_type (); } -void set_type (db::PCellParameterDeclaration *pd, unsigned int t) +static void set_type (db::PCellParameterDeclaration *pd, unsigned int t) { pd->set_type (db::PCellParameterDeclaration::type (t)); } -void clear_choices (db::PCellParameterDeclaration *pd) +static void clear_choices (db::PCellParameterDeclaration *pd) { pd->set_choices (std::vector ()); pd->set_choice_descriptions (std::vector ()); } -void add_choice (db::PCellParameterDeclaration *pd, const std::string &d, const tl::Variant &v) +static void add_choice (db::PCellParameterDeclaration *pd, const std::string &d, const tl::Variant &v) { std::vector vv = pd->get_choices (); std::vector dd = pd->get_choice_descriptions (); @@ -772,26 +773,7 @@ static unsigned int pd_type_none () return (unsigned int) db::PCellParameterDeclaration::t_none; } -db::PCellParameterDeclaration *ctor_pcell_parameter (const std::string &name, unsigned int type, const std::string &description) -{ - db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration (); - pd->set_name (name); - pd->set_type (db::PCellParameterDeclaration::type (type)); - pd->set_description (description); - return pd; -} - -db::PCellParameterDeclaration *ctor_pcell_parameter_2 (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def) -{ - db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration (); - pd->set_name (name); - pd->set_type (db::PCellParameterDeclaration::type (type)); - pd->set_description (description); - pd->set_default (def); - return pd; -} - -db::PCellParameterDeclaration *ctor_pcell_parameter_3 (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def, const std::string &unit) +db::PCellParameterDeclaration *ctor_pcell_parameter (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def, const std::string &unit) { db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration (); pd->set_name (name); @@ -803,20 +785,7 @@ db::PCellParameterDeclaration *ctor_pcell_parameter_3 (const std::string &name, } Class decl_PCellParameterDeclaration ("db", "PCellParameterDeclaration", - gsi::constructor ("new", &ctor_pcell_parameter, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), - "@brief Create a new parameter declaration with the given name and type\n" - "@param name The parameter name\n" - "@param type One of the Type... constants describing the type of the parameter\n" - "@param description The description text\n" - ) + - gsi::constructor ("new", &ctor_pcell_parameter_2, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default"), - "@brief Create a new parameter declaration with the given name, type and default value\n" - "@param name The parameter name\n" - "@param type One of the Type... constants describing the type of the parameter\n" - "@param description The description text\n" - "@param default The default (initial) value\n" - ) + - gsi::constructor ("new", &ctor_pcell_parameter_3, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default"), gsi::arg ("unit"), + gsi::constructor ("new", &ctor_pcell_parameter, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default", tl::Variant (), "nil"), gsi::arg ("unit", std::string ()), "@brief Create a new parameter declaration with the given name, type, default value and unit string\n" "@param name The parameter name\n" "@param type One of the Type... constants describing the type of the parameter\n" @@ -874,6 +843,7 @@ Class decl_PCellParameterDeclaration ("db", "PCel "This method will add the given value with the given description to the list of\n" "choices. If choices are defined, KLayout will show a drop-down box instead of an\n" "entry field in the parameter user interface.\n" + "If a range is already set for this parameter the choice will not be added and a warning message is showed.\n" ) + gsi::method ("choice_values", &db::PCellParameterDeclaration::get_choices, "@brief Returns a list of choice values\n" @@ -881,6 +851,44 @@ Class decl_PCellParameterDeclaration ("db", "PCel gsi::method ("choice_descriptions", &db::PCellParameterDeclaration::get_choice_descriptions, "@brief Returns a list of choice descriptions\n" ) + + gsi::method ("min_value", &db::PCellParameterDeclaration::min_value, + "@brief Gets the minimum value allowed\n" + "See \\min_value= for a description of this attribute.\n" + "\n" + "This attribute has been added in version 0.29." + ) + + gsi::method ("min_value=", &db::PCellParameterDeclaration::set_min_value, gsi::arg ("value"), + "@brief Sets the minimum value allowed\n" + "The minimum value is a visual feature and limits the allowed values for numerical\n" + "entry boxes. This applies to parameters of type int or double. The minimum value\n" + "is not effective if choices are present.\n" + "\n" + "The minimum value is not enforced - for example there is no restriction implemented\n" + "when setting values programmatically.\n" + "\n" + "Setting this attribute to \"nil\" (the default) implies \"no limit\".\n" + "\n" + "This attribute has been added in version 0.29." + ) + + gsi::method ("max_value", &db::PCellParameterDeclaration::max_value, + "@brief Gets the maximum value allowed\n" + "See \\max_value= for a description of this attribute.\n" + "\n" + "This attribute has been added in version 0.29." + ) + + gsi::method ("max_value=", &db::PCellParameterDeclaration::set_max_value, gsi::arg ("value"), + "@brief Sets the maximum value allowed\n" + "The maximum value is a visual feature and limits the allowed values for numerical\n" + "entry boxes. This applies to parameters of type int or double. The maximum value\n" + "is not effective if choices are present.\n" + "\n" + "The maximum value is not enforced - for example there is no restriction implemented\n" + "when setting values programmatically.\n" + "\n" + "Setting this attribute to \"nil\" (the default) implies \"no limit\".\n" + "\n" + "This attribute has been added in version 0.29." + ) + gsi::method ("default", &db::PCellParameterDeclaration::get_default, "@brief Gets the default value\n" ) + diff --git a/src/edt/edt/edtPCellParametersPage.cc b/src/edt/edt/edtPCellParametersPage.cc index 2e5488d2e..bcd9ae8a2 100644 --- a/src/edt/edt/edtPCellParametersPage.cc +++ b/src/edt/edt/edtPCellParametersPage.cc @@ -399,6 +399,16 @@ PCellParametersPage::setup (lay::LayoutViewBase *view, int cv_index, const db::P m_icon_widgets.push_back (icon_label); m_all_widgets.back ().push_back (icon_label); + std::string range; + + if (! p->min_value ().is_nil () || ! p->max_value ().is_nil ()) { + range = tl::sprintf ( + " [%s, %s]" , + p->min_value ().is_nil () ? "-\u221e" /*infinity*/ : p->min_value ().to_string (), + p->max_value ().is_nil () ? "\u221e" /*infinity*/ : p->max_value ().to_string () + ); + } + if (p->get_type () != db::PCellParameterDeclaration::t_callback) { std::string leader; @@ -406,7 +416,8 @@ PCellParametersPage::setup (lay::LayoutViewBase *view, int cv_index, const db::P leader = tl::sprintf ("[%s] ", p->get_name ()); } - QLabel *l = new QLabel (tl::to_qstring (leader + description), inner_frame); + QLabel *l = new QLabel (tl::to_qstring (leader + description + range), inner_frame); + inner_grid->addWidget (l, row, 1); m_all_widgets.back ().push_back (l); @@ -702,9 +713,11 @@ PCellParametersPage::do_parameter_changed () bool ok = true; db::ParameterStates states = m_states; get_parameters (states, &ok); // includes coerce - update_widgets_from_states (states); - if (ok && ! lazy_evaluation ()) { - emit edited (); + if (ok) { + update_widgets_from_states (states); + if (! lazy_evaluation ()) { + emit edited (); + } } } @@ -762,6 +775,8 @@ PCellParametersPage::get_parameters_internal (db::ParameterStates &states, bool ps.set_value (tl::Variant (v)); lay::indicate_error (le, (tl::Exception *) 0); + check_range(tl::Variant (v), *p); + } catch (tl::Exception &ex) { lay::indicate_error (le, &ex); @@ -786,6 +801,8 @@ PCellParametersPage::get_parameters_internal (db::ParameterStates &states, bool ps.set_value (tl::Variant (v)); lay::indicate_error (le, (tl::Exception *) 0); + check_range(tl::Variant (v), *p); + } catch (tl::Exception &ex) { lay::indicate_error (le, &ex); @@ -1085,6 +1102,18 @@ PCellParametersPage::states_from_parameters (db::ParameterStates &states, const } } +void +PCellParametersPage::check_range (const tl::Variant &value, const db::PCellParameterDeclaration &decl) +{ + if (! decl.min_value ().is_nil () && value < decl.min_value ()) { + throw tl::Exception (tl::sprintf (tl::to_string (tr ("The value is lower than the minimum allowed value: given value is %s, minimum value is %s")), value.to_string (), decl.min_value ().to_string ())); + } + + if (! decl.max_value ().is_nil () && ! (value < decl.max_value () || value == decl.max_value ())) { + throw tl::Exception (tl::sprintf (tl::to_string (tr ("The value is higher than the maximum allowed value: given value is %s, maximum value is %s")), value.to_string (), decl.max_value ().to_string ())); + } +} + } #endif diff --git a/src/edt/edt/edtPCellParametersPage.h b/src/edt/edt/edtPCellParametersPage.h index e6e501399..a7b528371 100644 --- a/src/edt/edt/edtPCellParametersPage.h +++ b/src/edt/edt/edtPCellParametersPage.h @@ -181,6 +181,7 @@ private: void get_parameters_internal (db::ParameterStates &states, bool &edit_error); std::vector parameter_from_states (const db::ParameterStates &states) const; void states_from_parameters (db::ParameterStates &states, const std::vector ¶meters); + void check_range (const tl::Variant& value, const db::PCellParameterDeclaration &decl); }; } diff --git a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py index 5bdb73e4e..5beff2043 100644 --- a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py +++ b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py @@ -66,7 +66,7 @@ class _PCellDeclarationHelperMixin: self.layer = None self.cell = None - def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None): + def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None, min_value = None, max_value = None): """ Defines a parameter name -> the short name of the parameter @@ -76,6 +76,8 @@ class _PCellDeclarationHelperMixin: hidden -> (boolean) true, if the parameter is not shown in the dialog readonly -> (boolean) true, if the parameter cannot be edited unit -> the unit string + min_value -> the minimum value (only effective for numerical types and if no choices are present) + max_value -> the maximum value (only effective for numerical types and if no choices are present) default -> the default value choices -> ([ [ d, v ], ...) choice descriptions/value for choice type this method defines accessor methods for the parameters @@ -102,6 +104,8 @@ class _PCellDeclarationHelperMixin: pdecl.readonly = readonly if not (default is None): pdecl.default = default + pdecl.min_value = min_value + pdecl.max_value = max_value if not (unit is None): pdecl.unit = unit if not (choices is None): diff --git a/src/pymod/distutils_src/klayout/dbcore.pyi b/src/pymod/distutils_src/klayout/dbcore.pyi index 8cd688a4f..b6244d346 100644 --- a/src/pymod/distutils_src/klayout/dbcore.pyi +++ b/src/pymod/distutils_src/klayout/dbcore.pyi @@ -3941,12 +3941,16 @@ class CompoundRegionOperationNode: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -3958,6 +3962,10 @@ class CompoundRegionOperationNode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: CompoundRegionOperationNode.GeometricalOp) -> bool: r""" @@ -3986,6 +3994,10 @@ class CompoundRegionOperationNode: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -4034,6 +4046,10 @@ class CompoundRegionOperationNode: r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -4044,6 +4060,10 @@ class CompoundRegionOperationNode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: CompoundRegionOperationNode.LogicalOp) -> bool: r""" @@ -4072,6 +4092,10 @@ class CompoundRegionOperationNode: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -4125,12 +4149,16 @@ class CompoundRegionOperationNode: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -4142,6 +4170,10 @@ class CompoundRegionOperationNode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: CompoundRegionOperationNode.ParameterType) -> bool: r""" @@ -4170,6 +4202,10 @@ class CompoundRegionOperationNode: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -4215,12 +4251,16 @@ class CompoundRegionOperationNode: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -4232,6 +4272,10 @@ class CompoundRegionOperationNode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: CompoundRegionOperationNode.RatioParameterType) -> bool: r""" @@ -4260,6 +4304,10 @@ class CompoundRegionOperationNode: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -4305,12 +4353,16 @@ class CompoundRegionOperationNode: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -4322,6 +4374,10 @@ class CompoundRegionOperationNode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: CompoundRegionOperationNode.ResultType) -> bool: r""" @@ -4335,12 +4391,12 @@ class CompoundRegionOperationNode: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ def __repr__(self) -> str: r""" @@ -4350,6 +4406,10 @@ class CompoundRegionOperationNode: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -5069,11 +5129,12 @@ class CplxTrans: "mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation.@param m The new mirror flag """ @classmethod - def from_dtrans(cls, trans: DCplxTrans) -> CplxTrans: + def from_dtrans(cls, trans: DCplxTrans, dbu: Optional[float] = ...) -> CplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @classmethod def from_s(cls, s: str) -> CplxTrans: @@ -5091,7 +5152,7 @@ class CplxTrans: """ @overload @classmethod - def new(cls, c: CplxTrans, m: Optional[float] = ..., u: Optional[DVector] = ...) -> CplxTrans: + def new(cls, c: CplxTrans, mag: Optional[float] = ..., u: Optional[DVector] = ...) -> CplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -5104,7 +5165,7 @@ class CplxTrans: """ @overload @classmethod - def new(cls, c: CplxTrans, m: float, x: int, y: int) -> CplxTrans: + def new(cls, c: CplxTrans, mag: Optional[float] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> CplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -5118,15 +5179,7 @@ class CplxTrans: """ @overload @classmethod - def new(cls, m: float) -> CplxTrans: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, u: DVector) -> CplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> CplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -5140,7 +5193,7 @@ class CplxTrans: """ @overload @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, x: float, y: float) -> CplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> CplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -5155,15 +5208,7 @@ class CplxTrans: """ @overload @classmethod - def new(cls, t: Trans) -> CplxTrans: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - @classmethod - def new(cls, t: Trans, m: float) -> CplxTrans: + def new(cls, t: Trans, mag: Optional[float] = ...) -> CplxTrans: r""" @brief Creates a transformation from a simple transformation and a magnification @@ -5171,27 +5216,30 @@ class CplxTrans: """ @overload @classmethod - def new(cls, trans: DCplxTrans) -> CplxTrans: + def new(cls, trans: DCplxTrans, dbu: Optional[float] = ...) -> CplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: ICplxTrans) -> CplxTrans: + def new(cls, trans: ICplxTrans, dbu: Optional[float] = ...) -> CplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the output space from integer units to floating-point units. Formally, the CplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: VCplxTrans) -> CplxTrans: + def new(cls, trans: VCplxTrans, dbu: Optional[float] = ...) -> CplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod @@ -5240,7 +5288,7 @@ class CplxTrans: @brief Creates a unit transformation """ @overload - def __init__(self, c: CplxTrans, m: Optional[float] = ..., u: Optional[DVector] = ...) -> None: + def __init__(self, c: CplxTrans, mag: Optional[float] = ..., u: Optional[DVector] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -5252,7 +5300,7 @@ class CplxTrans: @param u The Additional displacement """ @overload - def __init__(self, c: CplxTrans, m: float, x: int, y: int) -> None: + def __init__(self, c: CplxTrans, mag: Optional[float] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -5265,14 +5313,7 @@ class CplxTrans: @param y The Additional displacement (y) """ @overload - def __init__(self, m: float) -> None: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - def __init__(self, mag: float, rot: float, mirrx: bool, u: DVector) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -5285,7 +5326,7 @@ class CplxTrans: @param u The displacement """ @overload - def __init__(self, mag: float, rot: float, mirrx: bool, x: float, y: float) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -5299,39 +5340,35 @@ class CplxTrans: @param y The y displacement """ @overload - def __init__(self, t: Trans) -> None: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - def __init__(self, t: Trans, m: float) -> None: + def __init__(self, t: Trans, mag: Optional[float] = ...) -> None: r""" @brief Creates a transformation from a simple transformation and a magnification Creates a magnifying transformation from a simple transformation and a magnification. """ @overload - def __init__(self, trans: DCplxTrans) -> None: + def __init__(self, trans: DCplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: ICplxTrans) -> None: + def __init__(self, trans: ICplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the output space from integer units to floating-point units. Formally, the CplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: VCplxTrans) -> None: + def __init__(self, trans: VCplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload def __init__(self, u: DVector) -> None: @@ -5769,9 +5806,13 @@ class CplxTrans: r""" @brief Converts the transformation to another transformation with integer input and output coordinates - The database unit can be specified to translate the floating-point coordinate displacement in micron units to an integer-coordinate displacement in database units. The displacement's' coordinates will be divided by the database unit. + This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor: - This method has been introduced in version 0.25. + @code + itrans = RBA::ICplxTrans::new(trans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_s(self, lazy: Optional[bool] = ..., dbu: Optional[float] = ...) -> str: r""" @@ -5781,19 +5822,29 @@ class CplxTrans: The lazy and DBU arguments have been added in version 0.27.6. """ - def to_trans(self) -> DCplxTrans: + def to_trans(self, dbu: Optional[float] = ...) -> DCplxTrans: r""" @brief Converts the transformation to another transformation with floating-point input coordinates - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor: + + @code + dtrans = RBA::DCplxTrans::new(trans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_vtrans(self, dbu: Optional[float] = ...) -> VCplxTrans: r""" @brief Converts the transformation to another transformation with integer output and floating-point input coordinates - The database unit can be specified to translate the floating-point coordinate displacement in micron units to an integer-coordinate displacement in database units. The displacement's' coordinates will be divided by the database unit. + This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor: - This method has been introduced in version 0.25. + @code + vtrans = RBA::VCplxTrans::new(trans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ @overload def trans(self, box: Box) -> DBox: @@ -7236,11 +7287,12 @@ class DCplxTrans: "mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation.@param m The new mirror flag """ @classmethod - def from_itrans(cls, trans: CplxTrans) -> DCplxTrans: + def from_itrans(cls, trans: CplxTrans, dbu: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from integer units to floating-point units. Formally, the DCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_itrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @classmethod def from_s(cls, s: str) -> DCplxTrans: @@ -7258,7 +7310,7 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, c: DCplxTrans, m: Optional[float] = ..., u: Optional[DVector] = ...) -> DCplxTrans: + def new(cls, c: DCplxTrans, mag: Optional[float] = ..., u: Optional[DVector] = ...) -> DCplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -7271,7 +7323,7 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, c: DCplxTrans, m: float, x: float, y: float) -> DCplxTrans: + def new(cls, c: DCplxTrans, mag: Optional[float] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -7285,15 +7337,7 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, m: float) -> DCplxTrans: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, u: DVector) -> DCplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> DCplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -7307,7 +7351,7 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, x: float, y: float) -> DCplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -7322,15 +7366,7 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, t: DTrans) -> DCplxTrans: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - @classmethod - def new(cls, t: DTrans, m: float) -> DCplxTrans: + def new(cls, t: DTrans, mag: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a transformation from a simple transformation and a magnification @@ -7338,27 +7374,30 @@ class DCplxTrans: """ @overload @classmethod - def new(cls, trans: CplxTrans) -> DCplxTrans: + def new(cls, trans: CplxTrans, dbu: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from integer units to floating-point units. Formally, the DCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_itrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: ICplxTrans) -> DCplxTrans: + def new(cls, trans: ICplxTrans, dbu: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: VCplxTrans) -> DCplxTrans: + def new(cls, trans: VCplxTrans, dbu: Optional[float] = ...) -> DCplxTrans: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the output space from integer units to floating-point units. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod @@ -7407,7 +7446,7 @@ class DCplxTrans: @brief Creates a unit transformation """ @overload - def __init__(self, c: DCplxTrans, m: Optional[float] = ..., u: Optional[DVector] = ...) -> None: + def __init__(self, c: DCplxTrans, mag: Optional[float] = ..., u: Optional[DVector] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -7419,7 +7458,7 @@ class DCplxTrans: @param u The Additional displacement """ @overload - def __init__(self, c: DCplxTrans, m: float, x: float, y: float) -> None: + def __init__(self, c: DCplxTrans, mag: Optional[float] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -7432,14 +7471,7 @@ class DCplxTrans: @param y The Additional displacement (y) """ @overload - def __init__(self, m: float) -> None: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - def __init__(self, mag: float, rot: float, mirrx: bool, u: DVector) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -7452,7 +7484,7 @@ class DCplxTrans: @param u The displacement """ @overload - def __init__(self, mag: float, rot: float, mirrx: bool, x: float, y: float) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -7466,39 +7498,35 @@ class DCplxTrans: @param y The y displacement """ @overload - def __init__(self, t: DTrans) -> None: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - def __init__(self, t: DTrans, m: float) -> None: + def __init__(self, t: DTrans, mag: Optional[float] = ...) -> None: r""" @brief Creates a transformation from a simple transformation and a magnification Creates a magnifying transformation from a simple transformation and a magnification. """ @overload - def __init__(self, trans: CplxTrans) -> None: + def __init__(self, trans: CplxTrans, dbu: Optional[float] = ...) -> None: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input space from integer units to floating-point units. Formally, the DCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_itrans'. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: ICplxTrans) -> None: + def __init__(self, trans: ICplxTrans, dbu: Optional[float] = ...) -> None: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: VCplxTrans) -> None: + def __init__(self, trans: VCplxTrans, dbu: Optional[float] = ...) -> None: r""" @brief Creates a floating-point coordinate transformation from another coordinate flavour + The 'dbu' argument is used to transform the output space from integer units to floating-point units. Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. - This constructor has been introduced in version 0.25. + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload def __init__(self, u: DVector) -> None: @@ -7928,7 +7956,13 @@ class DCplxTrans: The database unit can be specified to translate the floating-point coordinate displacement in micron units to an integer-coordinate displacement in database units. The displacement's' coordinates will be divided by the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor: + + @code + itrans = RBA::ICplxTrans::new(dtrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_s(self, lazy: Optional[bool] = ..., dbu: Optional[float] = ...) -> str: r""" @@ -7938,11 +7972,17 @@ class DCplxTrans: The lazy and DBU arguments have been added in version 0.27.6. """ - def to_trans(self) -> CplxTrans: + def to_trans(self, dbu: Optional[float] = ...) -> CplxTrans: r""" @brief Converts the transformation to another transformation with integer input coordinates - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor: + + @code + trans = RBA::CplxTrans::new(dtrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_vtrans(self, dbu: Optional[float] = ...) -> VCplxTrans: r""" @@ -7950,7 +7990,13 @@ class DCplxTrans: The database unit can be specified to translate the floating-point coordinate displacement in micron units to an integer-coordinate displacement in database units. The displacement's' coordinates will be divided by the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor: + + @code + vtrans = RBA::VCplxTrans::new(dtrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ @overload def trans(self, box: DBox) -> DBox: @@ -11339,8 +11385,7 @@ class DText: Setter: @brief Sets the horizontal alignment - This property specifies how the text is aligned relative to the anchor point. - This property has been introduced in version 0.22 and extended to enums in 0.28. + This is the version accepting integer values. It's provided for backward compatibility. """ size: float r""" @@ -11886,7 +11931,7 @@ class DTrans: """ @overload @classmethod - def new(cls, c: DTrans, x: float, y: float) -> DTrans: + def new(cls, c: DTrans, x: Optional[float] = ..., y: Optional[float] = ...) -> DTrans: r""" @brief Creates a transformation from another transformation plus a displacement @@ -11900,7 +11945,7 @@ class DTrans: """ @overload @classmethod - def new(cls, rot: int, mirr: Optional[bool] = ..., u: Optional[DVector] = ...) -> DTrans: + def new(cls, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> DTrans: r""" @brief Creates a transformation using angle and mirror flag @@ -11913,7 +11958,7 @@ class DTrans: """ @overload @classmethod - def new(cls, rot: int, mirr: bool, x: float, y: float) -> DTrans: + def new(cls, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> DTrans: r""" @brief Creates a transformation using angle and mirror flag and two coordinate values for displacement @@ -11987,7 +12032,7 @@ class DTrans: @param u The Additional displacement """ @overload - def __init__(self, c: DTrans, x: float, y: float) -> None: + def __init__(self, c: DTrans, x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a displacement @@ -12000,7 +12045,7 @@ class DTrans: @param y The Additional displacement (y) """ @overload - def __init__(self, rot: int, mirr: Optional[bool] = ..., u: Optional[DVector] = ...) -> None: + def __init__(self, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., u: Optional[DVector] = ...) -> None: r""" @brief Creates a transformation using angle and mirror flag @@ -12012,7 +12057,7 @@ class DTrans: @param u The displacement """ @overload - def __init__(self, rot: int, mirr: bool, x: float, y: float) -> None: + def __init__(self, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., x: Optional[float] = ..., y: Optional[float] = ...) -> None: r""" @brief Creates a transformation using angle and mirror flag and two coordinate values for displacement @@ -19038,6 +19083,10 @@ class Edges(ShapeCollection): r""" @brief Compares an enum with an integer value """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -19048,6 +19097,10 @@ class Edges(ShapeCollection): r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Edges.EdgeType) -> bool: r""" @@ -19076,6 +19129,10 @@ class Edges(ShapeCollection): r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -21852,12 +21909,16 @@ class HAlign: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -21869,6 +21930,10 @@ class HAlign: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: HAlign) -> bool: r""" @@ -21882,12 +21947,12 @@ class HAlign: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ def __repr__(self) -> str: r""" @@ -21959,6 +22024,10 @@ class HAlign: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -22090,11 +22159,13 @@ class ICplxTrans: "mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation.@param m The new mirror flag """ @classmethod - def from_dtrans(cls, trans: DCplxTrans) -> ICplxTrans: + def from_dtrans(cls, trans: DCplxTrans, dbu: Optional[float] = ...) -> ICplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + The 'dbu' argument is used to transform the input space and output space from floating-point units to integer units and vice versa. Formally, the ICplxTrans transformation is initialized with 'to_dbu * trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)' and 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @classmethod def from_s(cls, s: str) -> ICplxTrans: @@ -22105,11 +22176,13 @@ class ICplxTrans: This method has been added in version 0.23. """ @classmethod - def from_trans(cls, trans: CplxTrans) -> ICplxTrans: + def from_trans(cls, trans: CplxTrans, dbu: Optional[float] = ...) -> ICplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'. + The 'dbu' argument is used to transform the output space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod @@ -22119,7 +22192,7 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, c: ICplxTrans, m: Optional[float] = ..., u: Optional[Vector] = ...) -> ICplxTrans: + def new(cls, c: ICplxTrans, mag: Optional[float] = ..., u: Optional[Vector] = ...) -> ICplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -22132,7 +22205,7 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, c: ICplxTrans, m: float, x: int, y: int) -> ICplxTrans: + def new(cls, c: ICplxTrans, mag: Optional[float] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> ICplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -22146,15 +22219,7 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, m: float) -> ICplxTrans: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, u: Vector) -> ICplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> ICplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -22168,7 +22233,7 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, x: int, y: int) -> ICplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> ICplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -22183,15 +22248,7 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, t: Trans) -> ICplxTrans: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - @classmethod - def new(cls, t: Trans, m: float) -> ICplxTrans: + def new(cls, t: Trans, mag: Optional[float] = ...) -> ICplxTrans: r""" @brief Creates a transformation from a simple transformation and a magnification @@ -22199,27 +22256,33 @@ class ICplxTrans: """ @overload @classmethod - def new(cls, trans: CplxTrans) -> ICplxTrans: + def new(cls, trans: CplxTrans, dbu: Optional[float] = ...) -> ICplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'. + The 'dbu' argument is used to transform the output space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: DCplxTrans) -> ICplxTrans: + def new(cls, trans: DCplxTrans, dbu: Optional[float] = ...) -> ICplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + The 'dbu' argument is used to transform the input space and output space from floating-point units to integer units and vice versa. Formally, the ICplxTrans transformation is initialized with 'to_dbu * trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)' and 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: VCplxTrans) -> ICplxTrans: + def new(cls, trans: VCplxTrans, dbu: Optional[float] = ...) -> ICplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25. + The 'dbu' argument is used to transform the input space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload @classmethod @@ -22268,7 +22331,7 @@ class ICplxTrans: @brief Creates a unit transformation """ @overload - def __init__(self, c: ICplxTrans, m: Optional[float] = ..., u: Optional[Vector] = ...) -> None: + def __init__(self, c: ICplxTrans, mag: Optional[float] = ..., u: Optional[Vector] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -22280,7 +22343,7 @@ class ICplxTrans: @param u The Additional displacement """ @overload - def __init__(self, c: ICplxTrans, m: float, x: int, y: int) -> None: + def __init__(self, c: ICplxTrans, mag: Optional[float] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -22293,14 +22356,7 @@ class ICplxTrans: @param y The Additional displacement (y) """ @overload - def __init__(self, m: float) -> None: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - def __init__(self, mag: float, rot: float, mirrx: bool, u: Vector) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -22313,7 +22369,7 @@ class ICplxTrans: @param u The displacement """ @overload - def __init__(self, mag: float, rot: float, mirrx: bool, x: int, y: int) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -22327,39 +22383,38 @@ class ICplxTrans: @param y The y displacement """ @overload - def __init__(self, t: Trans) -> None: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - def __init__(self, t: Trans, m: float) -> None: + def __init__(self, t: Trans, mag: Optional[float] = ...) -> None: r""" @brief Creates a transformation from a simple transformation and a magnification Creates a magnifying transformation from a simple transformation and a magnification. """ @overload - def __init__(self, trans: CplxTrans) -> None: + def __init__(self, trans: CplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'. + The 'dbu' argument is used to transform the output space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: DCplxTrans) -> None: + def __init__(self, trans: DCplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. + The 'dbu' argument is used to transform the input space and output space from floating-point units to integer units and vice versa. Formally, the ICplxTrans transformation is initialized with 'to_dbu * trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)' and 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: VCplxTrans) -> None: + def __init__(self, trans: VCplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates an integer coordinate transformation from another coordinate flavour - This constructor has been introduced in version 0.25. + The 'dbu' argument is used to transform the input space from floating-point units to integer units. Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation into micrometer space, or more precisely 'CplxTrans(mag=dbu)'. + + This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29. """ @overload def __init__(self, u: Vector) -> None: @@ -22789,7 +22844,13 @@ class ICplxTrans: The database unit can be specified to translate the integer coordinate displacement in database units to a floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_itrans' use the conversion constructor: + + @code + dtrans = RBA::DCplxTrans::new(itrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_s(self, lazy: Optional[bool] = ..., dbu: Optional[float] = ...) -> str: r""" @@ -22799,11 +22860,17 @@ class ICplxTrans: The lazy and DBU arguments have been added in version 0.27.6. """ - def to_trans(self) -> VCplxTrans: + def to_trans(self, dbu: Optional[float] = ...) -> VCplxTrans: r""" @brief Converts the transformation to another transformation with floating-point input coordinates - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_trans' use the conversion constructor: + + @code + vtrans = RBA::VCplxTrans::new(itrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ def to_vtrans(self, dbu: Optional[float] = ...) -> CplxTrans: r""" @@ -22811,7 +22878,13 @@ class ICplxTrans: The database unit can be specified to translate the integer coordinate displacement in database units to a floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_vtrans' use the conversion constructor: + + @code + trans = RBA::CplxTrans::new(itrans, dbu) + @/code + + This method has been introduced in version 0.25 and was deprecated in version 0.29. """ @overload def trans(self, box: Box) -> Box: @@ -23917,11 +23990,11 @@ class Instance: Starting with version 0.25 the displacement is of vector type. Setter: - @brief Sets the displacement vector for the 'b' axis + @brief Sets the displacement vector for the 'b' axis in micrometer units - If the instance was not an array instance before it is made one. + Like \b= with an integer displacement, this method will set the displacement vector but it accepts a vector in micrometer units that is of \DVector type. The vector will be translated to database units internally. - This method has been introduced in version 0.23. Starting with version 0.25 the displacement is of vector type. + This method has been introduced in version 0.25. """ cell: Cell r""" @@ -24096,10 +24169,9 @@ class Instance: @brief Gets the transformation of the instance or the first instance in the array The transformation returned is only valid if the array does not represent a complex transformation array Setter: - @brief Sets the transformation of the instance or the first instance in the array (in micrometer units) - This method sets the transformation the same way as \cplx_trans=, but the displacement of this transformation is given in micrometer units. It is internally translated into database units. + @brief Sets the transformation of the instance or the first instance in the array - This method has been introduced in version 0.25. + This method has been introduced in version 0.23. """ @classmethod def new(cls) -> Instance: @@ -25906,7 +25978,7 @@ class LayerMap: The LayerMap class has been introduced in version 0.18. Target layer have been introduced in version 0.20. 1:n mapping and unmapping has been introduced in version 0.27. """ @classmethod - def from_string(cls, arg0: str) -> LayerMap: + def from_string(cls, s: str) -> LayerMap: r""" @brief Creates a layer map from the given string The format of the string is that used in layer mapping files: one mapping entry per line, comments are allowed using '#' or '//'. The format of each line is that used in the 'map(string, index)' method. @@ -29212,6 +29284,10 @@ class LayoutToNetlist: r""" @brief Compares an enum with an integer value """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -29222,6 +29298,10 @@ class LayoutToNetlist: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: LayoutToNetlist.BuildNetHierarchyMode) -> bool: r""" @@ -29235,12 +29315,12 @@ class LayoutToNetlist: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ def __repr__(self) -> str: r""" @@ -29250,6 +29330,10 @@ class LayoutToNetlist: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -30524,12 +30608,16 @@ class LoadLayoutOptions: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -30541,6 +30629,10 @@ class LoadLayoutOptions: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: LoadLayoutOptions.CellConflictResolution) -> bool: r""" @@ -30569,6 +30661,10 @@ class LoadLayoutOptions: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -32740,6 +32836,10 @@ class Metrics: r""" @brief Compares an enum with an integer value """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -32750,6 +32850,10 @@ class Metrics: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Metrics) -> bool: r""" @@ -32840,6 +32944,10 @@ class Metrics: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -33260,14 +33368,14 @@ class NetPinRef: @overload def net(self) -> Net: r""" - @brief Gets the net this pin reference is attached to (non-const version). - - This constness variant has been introduced in version 0.26.8 + @brief Gets the net this pin reference is attached to. """ @overload def net(self) -> Net: r""" - @brief Gets the net this pin reference is attached to. + @brief Gets the net this pin reference is attached to (non-const version). + + This constness variant has been introduced in version 0.26.8 """ def pin(self) -> Pin: r""" @@ -33488,12 +33596,6 @@ class NetTerminalRef: The latter may happen, if the object is owned by a C++ object which got destroyed itself. """ @overload - def device(self) -> Device: - r""" - @brief Gets the device reference. - Gets the device object that this connection is made to. - """ - @overload def device(self) -> Device: r""" @brief Gets the device reference (non-const version). @@ -33501,6 +33603,12 @@ class NetTerminalRef: This constness variant has been introduced in version 0.26.8 """ + @overload + def device(self) -> Device: + r""" + @brief Gets the device reference. + Gets the device object that this connection is made to. + """ def device_class(self) -> DeviceClass: r""" @brief Gets the class of the device which is addressed. @@ -33518,14 +33626,14 @@ class NetTerminalRef: @overload def net(self) -> Net: r""" - @brief Gets the net this terminal reference is attached to. + @brief Gets the net this terminal reference is attached to (non-const version). + + This constness variant has been introduced in version 0.26.8 """ @overload def net(self) -> Net: r""" - @brief Gets the net this terminal reference is attached to (non-const version). - - This constness variant has been introduced in version 0.26.8 + @brief Gets the net this terminal reference is attached to. """ def terminal_def(self) -> DeviceTerminalDefinition: r""" @@ -34314,6 +34422,14 @@ class Netlist: This constness variant has been introduced in version 0.26.8. """ @overload + def circuits_by_name(self, name_pattern: str) -> List[Circuit]: + r""" + @brief Gets the circuit objects for a given name filter. + The name filter is a glob pattern. This method will return all \Circuit objects matching the glob pattern. + + This method has been introduced in version 0.26.4. + """ + @overload def circuits_by_name(self, name_pattern: str) -> List[Circuit]: r""" @brief Gets the circuit objects for a given name filter (const version). @@ -34322,14 +34438,6 @@ class Netlist: This constness variant has been introduced in version 0.26.8. """ - @overload - def circuits_by_name(self, name_pattern: str) -> List[Circuit]: - r""" - @brief Gets the circuit objects for a given name filter. - The name filter is a glob pattern. This method will return all \Circuit objects matching the glob pattern. - - This method has been introduced in version 0.26.4. - """ def combine_devices(self) -> None: r""" @brief Combines devices where possible @@ -34384,24 +34492,16 @@ class Netlist: This constness variant has been introduced in version 0.26.8. """ @overload - def each_circuit_bottom_up(self) -> Iterator[Circuit]: - r""" - @brief Iterates over the circuits bottom-up (const version) - Iterating bottom-up means the parent circuits come after the child circuits. This is the basically the reverse order as delivered by \each_circuit_top_down. - - This constness variant has been introduced in version 0.26.8. - """ - @overload def each_circuit_bottom_up(self) -> Iterator[Circuit]: r""" @brief Iterates over the circuits bottom-up Iterating bottom-up means the parent circuits come after the child circuits. This is the basically the reverse order as delivered by \each_circuit_top_down. """ @overload - def each_circuit_top_down(self) -> Iterator[Circuit]: + def each_circuit_bottom_up(self) -> Iterator[Circuit]: r""" - @brief Iterates over the circuits top-down (const version) - Iterating top-down means the parent circuits come before the child circuits. The first \top_circuit_count circuits are top circuits - i.e. those which are not referenced by other circuits. + @brief Iterates over the circuits bottom-up (const version) + Iterating bottom-up means the parent circuits come after the child circuits. This is the basically the reverse order as delivered by \each_circuit_top_down. This constness variant has been introduced in version 0.26.8. """ @@ -34412,6 +34512,14 @@ class Netlist: Iterating top-down means the parent circuits come before the child circuits. The first \top_circuit_count circuits are top circuits - i.e. those which are not referenced by other circuits. """ @overload + def each_circuit_top_down(self) -> Iterator[Circuit]: + r""" + @brief Iterates over the circuits top-down (const version) + Iterating top-down means the parent circuits come before the child circuits. The first \top_circuit_count circuits are top circuits - i.e. those which are not referenced by other circuits. + + This constness variant has been introduced in version 0.26.8. + """ + @overload def each_device_class(self) -> Iterator[DeviceClass]: r""" @brief Iterates over the device classes of the netlist @@ -34440,7 +34548,7 @@ class Netlist: @brief Flattens circuits matching a certain pattern This method will substitute all instances (subcircuits) of all circuits with names matching the given name pattern. The name pattern is a glob expression. For example, 'flatten_circuit("np*")' will flatten all circuits with names starting with 'np'. """ - def flatten_circuits(self, arg0: Sequence[Circuit]) -> None: + def flatten_circuits(self, circuits: Sequence[Circuit]) -> None: r""" @brief Flattens all given circuits of the netlist This method is equivalent to calling \flatten_circuit for all given circuits, but more efficient. @@ -35084,6 +35192,10 @@ class NetlistCrossReference(NetlistCompareLogger): r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -35094,6 +35206,10 @@ class NetlistCrossReference(NetlistCompareLogger): r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: NetlistCrossReference.Status) -> bool: r""" @@ -35122,6 +35238,10 @@ class NetlistCrossReference(NetlistCompareLogger): r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -36013,7 +36133,7 @@ class NetlistSpiceWriter(NetlistWriter): """ @overload @classmethod - def new(cls, arg0: NetlistSpiceWriterDelegate) -> NetlistSpiceWriter: + def new(cls, delegate: NetlistSpiceWriterDelegate) -> NetlistSpiceWriter: r""" @brief Creates a new writer with a delegate. """ @@ -36031,7 +36151,7 @@ class NetlistSpiceWriter(NetlistWriter): @brief Creates a new writer without delegate. """ @overload - def __init__(self, arg0: NetlistSpiceWriterDelegate) -> None: + def __init__(self, delegate: NetlistSpiceWriterDelegate) -> None: r""" @brief Creates a new writer with a delegate. """ @@ -36597,6 +36717,46 @@ class PCellParameterDeclaration: Setter: @brief Makes the parameter hidden if this attribute is set to true """ + max_value: Any + r""" + Getter: + @brief Gets the maximum value allowed + See \max_value= for a description of this attribute. + + This attribute has been added in version 0.29. + Setter: + @brief Sets the maximum value allowed + The maximum value is a visual feature and limits the allowed values for numerical + entry boxes. This applies to parameters of type int or double. The maximum value + is not effective if choices are present. + + The maximum value is not enforced - for example there is no restriction implemented + when setting values programmatically. + + Setting this attribute to "nil" (the default) implies "no limit". + + This attribute has been added in version 0.29. + """ + min_value: Any + r""" + Getter: + @brief Gets the minimum value allowed + See \min_value= for a description of this attribute. + + This attribute has been added in version 0.29. + Setter: + @brief Sets the minimum value allowed + The minimum value is a visual feature and limits the allowed values for numerical + entry boxes. This applies to parameters of type int or double. The minimum value + is not effective if choices are present. + + The minimum value is not enforced - for example there is no restriction implemented + when setting values programmatically. + + Setting this attribute to "nil" (the default) implies "no limit". + + This attribute has been added in version 0.29. + """ name: str r""" Getter: @@ -36632,28 +36792,8 @@ class PCellParameterDeclaration: @brief Sets the unit string The unit string is shown right to the edit fields for numeric parameters. """ - @overload @classmethod - def new(cls, name: str, type: int, description: str) -> PCellParameterDeclaration: - r""" - @brief Create a new parameter declaration with the given name and type - @param name The parameter name - @param type One of the Type... constants describing the type of the parameter - @param description The description text - """ - @overload - @classmethod - def new(cls, name: str, type: int, description: str, default: Any) -> PCellParameterDeclaration: - r""" - @brief Create a new parameter declaration with the given name, type and default value - @param name The parameter name - @param type One of the Type... constants describing the type of the parameter - @param description The description text - @param default The default (initial) value - """ - @overload - @classmethod - def new(cls, name: str, type: int, description: str, default: Any, unit: str) -> PCellParameterDeclaration: + def new(cls, name: str, type: int, description: str, default: Optional[Any] = ..., unit: Optional[str] = ...) -> PCellParameterDeclaration: r""" @brief Create a new parameter declaration with the given name, type, default value and unit string @param name The parameter name @@ -36670,25 +36810,7 @@ class PCellParameterDeclaration: r""" @brief Creates a copy of self """ - @overload - def __init__(self, name: str, type: int, description: str) -> None: - r""" - @brief Create a new parameter declaration with the given name and type - @param name The parameter name - @param type One of the Type... constants describing the type of the parameter - @param description The description text - """ - @overload - def __init__(self, name: str, type: int, description: str, default: Any) -> None: - r""" - @brief Create a new parameter declaration with the given name, type and default value - @param name The parameter name - @param type One of the Type... constants describing the type of the parameter - @param description The description text - @param default The default (initial) value - """ - @overload - def __init__(self, name: str, type: int, description: str, default: Any, unit: str) -> None: + def __init__(self, name: str, type: int, description: str, default: Optional[Any] = ..., unit: Optional[str] = ...) -> None: r""" @brief Create a new parameter declaration with the given name, type, default value and unit string @param name The parameter name @@ -36740,6 +36862,7 @@ class PCellParameterDeclaration: This method will add the given value with the given description to the list of choices. If choices are defined, KLayout will show a drop-down box instead of an entry field in the parameter user interface. + If a range is already set for this parameter the choice will not be added and a warning message is showed. """ def assign(self, other: PCellParameterDeclaration) -> None: r""" @@ -36837,6 +36960,10 @@ class PCellParameterState: r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -36847,6 +36974,10 @@ class PCellParameterState: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: PCellParameterState.ParameterStateIcon) -> bool: r""" @@ -36860,12 +36991,12 @@ class PCellParameterState: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ def __repr__(self) -> str: r""" @@ -36875,6 +37006,10 @@ class PCellParameterState: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -39459,6 +39594,10 @@ class PreferredOrientation: r""" @brief Compares an enum with an integer value """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -39469,6 +39608,10 @@ class PreferredOrientation: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: PreferredOrientation) -> bool: r""" @@ -39559,6 +39702,10 @@ class PreferredOrientation: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -39637,12 +39784,16 @@ class PropertyConstraint: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -39654,6 +39805,10 @@ class PropertyConstraint: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: PropertyConstraint) -> bool: r""" @@ -39667,12 +39822,12 @@ class PropertyConstraint: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ def __repr__(self) -> str: r""" @@ -39744,6 +39899,10 @@ class PropertyConstraint: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -41112,6 +41271,10 @@ class Region(ShapeCollection): r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -41122,6 +41285,10 @@ class Region(ShapeCollection): r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Region.OppositeFilter) -> bool: r""" @@ -41135,12 +41302,12 @@ class Region(ShapeCollection): @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ def __repr__(self) -> str: r""" @@ -41150,6 +41317,10 @@ class Region(ShapeCollection): r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -41218,6 +41389,10 @@ class Region(ShapeCollection): r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -41228,6 +41403,10 @@ class Region(ShapeCollection): r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Region.RectFilter) -> bool: r""" @@ -41241,12 +41420,12 @@ class Region(ShapeCollection): @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ def __repr__(self) -> str: r""" @@ -41256,6 +41435,10 @@ class Region(ShapeCollection): r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -42142,6 +42325,32 @@ class Region(ShapeCollection): This method has been introduced in version 0.25. """ + @overload + def delaunay(self) -> Region: + r""" + @brief Computes a constrained Delaunay triangulation from the given region + + @return A new region holding the triangles of the constrained Delaunay triangulation. + + Note that the result is a region in raw mode as otherwise the triangles are likely to get merged later on. + + This method has been introduced in version 0.29. + """ + @overload + def delaunay(self, max_area: float, min_b: Optional[float] = ...) -> Region: + r""" + @brief Computes a refined, constrained Delaunay triangulation from the given region + + @return A new region holding the triangles of the refined, constrained Delaunay triangulation. + + Refinement is implemented by Chew's second algorithm. A maximum area can be given. Triangles larger than this area will be split. In addition 'skinny' triangles will be resolved where possible. 'skinny' is defined in terms of shortest edge to circumcircle radius ratio (b). A minimum number for b can be given. The default of 1.0 corresponds to a minimum angle of 30 degree and is usually a good choice. The algorithm is stable up to roughly 1.2 which corresponds to a minimum angle of abouth 37 degree. + + The area value is given in terms of DBU units. Picking a value of 0.0 for area and min b will make the implementation skip the refinement step. In that case, the results are identical to the standard constrained Delaunay triangulation. + + Note that the result is a region in raw mode as otherwise the triangles are likely to get merged later on. + + This method has been introduced in version 0.29. + """ def destroy(self) -> None: r""" @brief Explicitly destroys the object @@ -43246,6 +43455,40 @@ class Region(ShapeCollection): This method has been introduced in version 0.26.1 """ + @overload + def rasterize(self, origin: Point, pixel_distance: Vector, pixel_size: Vector, nx: int, ny: int) -> List[List[float]]: + r""" + @brief A version of 'rasterize' that allows a pixel step distance which is larger than the pixel size + This version behaves like the first variant of 'rasterize', but the pixel distance (pixel-to-pixel step raster) + can be specified separately from the pixel size. Currently, the pixel size must be equal or smaller than the + pixel distance - i.e. the pixels must not overlap. + + This method has been added in version 0.29. + """ + @overload + def rasterize(self, origin: Point, pixel_size: Vector, nx: int, ny: int) -> List[List[float]]: + r""" + @brief A grayscale rasterizer delivering the area covered per pixel + @param origin The lower-left corner of the lowest-left pixel + @param pixel_size The dimension of each pixel (the x component gives the width, the y component the height) + @param nx The number of pixels in horizontal direction + @param ny The number of pixels in vertical direction + The method will create a grayscale, high-resolution density map of a rectangular region. + The scan region is defined by the origin, the pixel size and the number of pixels in horizontal (nx) and + vertical (ny) direction. The resulting array will contain the area covered by polygons from the region + in square database units. + + For non-overlapping polygons, the maximum density value is px*py. Overlapping polygons are counted multiple + times, so the actual values may be larger. If you want overlaps removed, you have to + merge the region before. Merge semantics does not apply for the 'rasterize' method. + + The resulting area values are precise within the limits of double-precision floating point arithmetics. + + A second version exists that allows specifying an active pixel size which is smaller than the + pixel distance hence allowing pixels samples that do not cover the full area, but leave gaps between the pixels. + + This method has been added in version 0.29. + """ def rectangles(self) -> Region: r""" @brief Returns all polygons which are rectangles @@ -44891,6 +45134,10 @@ class Severity: r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -44901,6 +45148,10 @@ class Severity: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Severity) -> bool: r""" @@ -44991,6 +45242,10 @@ class Severity: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -45265,11 +45520,12 @@ class Shape: This method has been introduced in version 0.23. Setter: - @brief Sets the upper right point of the box + @brief Sets the upper right corner of the box with the point being given in micrometer units Applies to boxes only. Changes the upper right point of the box and throws an exception if the shape is not a box. + Translation from micrometer units to database units is done internally. - This method has been introduced in version 0.23. + This method has been introduced in version 0.25. """ box_width: int r""" @@ -45588,11 +45844,10 @@ class Shape: Starting with version 0.23, this method returns nil, if the shape does not represent a geometrical primitive that can be converted to a polygon. Setter: - @brief Replaces the shape by the given polygon object - This method replaces the shape by the given polygon object. This method can only be called for editable layouts. It does not change the user properties of the shape. - Calling this method will invalidate any iterators. It should not be called inside a loop iterating over shapes. + @brief Replaces the shape by the given polygon (in micrometer units) + This method replaces the shape by the given polygon, like \polygon= with a \Polygon argument does. This version translates the polygon from micrometer units to database units internally. - This method has been introduced in version 0.22. + This method has been introduced in version 0.25. """ prop_id: int r""" @@ -48839,12 +49094,6 @@ class SubCircuit(NetlistObject): Usually it's not required to call this method. It has been introduced in version 0.24. """ @overload - def circuit(self) -> Circuit: - r""" - @brief Gets the circuit the subcircuit lives in. - This is NOT the circuit which is referenced. For getting the circuit that the subcircuit references, use \circuit_ref. - """ - @overload def circuit(self) -> Circuit: r""" @brief Gets the circuit the subcircuit lives in (non-const version). @@ -48853,6 +49102,12 @@ class SubCircuit(NetlistObject): This constness variant has been introduced in version 0.26.8 """ @overload + def circuit(self) -> Circuit: + r""" + @brief Gets the circuit the subcircuit lives in. + This is NOT the circuit which is referenced. For getting the circuit that the subcircuit references, use \circuit_ref. + """ + @overload def circuit_ref(self) -> Circuit: r""" @brief Gets the circuit referenced by the subcircuit (non-const version). @@ -48958,6 +49213,20 @@ class Technology: Setter: @hide """ + default_grids: List[float] + r""" + Getter: + @brief Gets the default grids + + See \default_grids for details. + + This property has been introduced in version 0.28.17. + Setter: + @brief Sets the default grids + If not empty, this list replaces the global grid list for this technology. + + This property has been introduced in version 0.28.17. + """ description: str r""" Getter: @@ -49410,8 +49679,7 @@ class Text: Setter: @brief Sets the horizontal alignment - This property specifies how the text is aligned relative to the anchor point. - This property has been introduced in version 0.22 and extended to enums in 0.28. + This is the version accepting integer values. It's provided for backward compatibility. """ size: int r""" @@ -49447,7 +49715,8 @@ class Text: Setter: @brief Sets the vertical alignment - This is the version accepting integer values. It's provided for backward compatibility. + This property specifies how the text is aligned relative to the anchor point. + This property has been introduced in version 0.22 and extended to enums in 0.28. """ x: int r""" @@ -49886,7 +50155,7 @@ class TextGenerator: @brief Creates a new object of this class """ @classmethod - def set_font_paths(cls, arg0: Sequence[str]) -> None: + def set_font_paths(cls, paths: Sequence[str]) -> None: r""" @brief Sets the paths where to look for font files This function sets the paths where to look for font files. After setting such a path, each font found will render a specific generator. The generator can be found under the font file's name. As the text generator is also the basis for the Basic.TEXT PCell, using this function also allows configuring custom fonts for this library cell. @@ -51267,6 +51536,14 @@ class TilingProcessor: @param edges The \Edges object to which the data is sent """ @overload + def output(self, name: str, image: lay.BasicImage) -> None: + r""" + @brief Specifies output to an image + This method will establish an output channel which delivers float data to image data. The image is a monochrome image where each pixel corresponds to a single tile. This method for example is useful to collect density information into an image. The image is configured such that each pixel covers one tile. + + The name is the name which must be used in the _output function of the scripts in order to address that channel. + """ + @overload def output(self, name: str, layout: Layout, cell: int, layer_index: int) -> None: r""" @brief Specifies output to a layout layer @@ -51293,6 +51570,14 @@ class TilingProcessor: @param lp The layer specification where the output will be sent to """ @overload + def output(self, name: str, rdb: rdb.ReportDatabase, cell_id: int, category_id: int) -> None: + r""" + @brief Specifies output to a report database + This method will establish an output channel for the processor. The output sent to that channel will be put into the report database given by the "rdb" parameter. "cell_id" specifies the cell and "category_id" the category to use. + + The name is the name which must be used in the _output function of the scripts in order to address that channel. + """ + @overload def output(self, name: str, rec: TileOutputReceiverBase) -> None: r""" @brief Specifies output for the tiling processor @@ -51553,7 +51838,7 @@ class Trans: """ @overload @classmethod - def new(cls, c: Trans, x: int, y: int) -> Trans: + def new(cls, c: Trans, x: Optional[int] = ..., y: Optional[int] = ...) -> Trans: r""" @brief Creates a transformation from another transformation plus a displacement @@ -51575,7 +51860,7 @@ class Trans: """ @overload @classmethod - def new(cls, rot: int, mirr: Optional[bool] = ..., u: Optional[Vector] = ...) -> Trans: + def new(cls, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> Trans: r""" @brief Creates a transformation using angle and mirror flag @@ -51588,7 +51873,7 @@ class Trans: """ @overload @classmethod - def new(cls, rot: int, mirr: bool, x: int, y: int) -> Trans: + def new(cls, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> Trans: r""" @brief Creates a transformation using angle and mirror flag and two coordinate values for displacement @@ -51654,7 +51939,7 @@ class Trans: @param u The Additional displacement """ @overload - def __init__(self, c: Trans, x: int, y: int) -> None: + def __init__(self, c: Trans, x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a displacement @@ -51674,7 +51959,7 @@ class Trans: This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'. """ @overload - def __init__(self, rot: int, mirr: Optional[bool] = ..., u: Optional[Vector] = ...) -> None: + def __init__(self, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> None: r""" @brief Creates a transformation using angle and mirror flag @@ -51686,7 +51971,7 @@ class Trans: @param u The displacement """ @overload - def __init__(self, rot: int, mirr: bool, x: int, y: int) -> None: + def __init__(self, rot: Optional[int] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation using angle and mirror flag and two coordinate values for displacement @@ -52202,12 +52487,16 @@ class TrapezoidDecompositionMode: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -52219,6 +52508,10 @@ class TrapezoidDecompositionMode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: TrapezoidDecompositionMode) -> bool: r""" @@ -52232,12 +52525,12 @@ class TrapezoidDecompositionMode: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ def __repr__(self) -> str: r""" @@ -52309,6 +52602,10 @@ class TrapezoidDecompositionMode: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -52511,12 +52808,16 @@ class VAlign: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -52528,6 +52829,10 @@ class VAlign: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: VAlign) -> bool: r""" @@ -52541,12 +52846,12 @@ class VAlign: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ def __repr__(self) -> str: r""" @@ -52618,6 +52923,10 @@ class VAlign: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -52766,7 +53075,7 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, c: VCplxTrans, m: Optional[float] = ..., u: Optional[Vector] = ...) -> VCplxTrans: + def new(cls, c: VCplxTrans, mag: Optional[float] = ..., u: Optional[Vector] = ...) -> VCplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -52779,7 +53088,7 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, c: VCplxTrans, m: float, x: float, y: float) -> VCplxTrans: + def new(cls, c: VCplxTrans, mag: Optional[float] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> VCplxTrans: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -52793,15 +53102,7 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, m: float) -> VCplxTrans: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, u: Vector) -> VCplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> VCplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -52815,7 +53116,7 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, mag: float, rot: float, mirrx: bool, x: int, y: int) -> VCplxTrans: + def new(cls, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> VCplxTrans: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -52830,15 +53131,7 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, t: DTrans) -> VCplxTrans: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - @classmethod - def new(cls, t: DTrans, m: float) -> VCplxTrans: + def new(cls, t: DTrans, mag: Optional[float] = ...) -> VCplxTrans: r""" @brief Creates a transformation from a simple transformation and a magnification @@ -52846,21 +53139,33 @@ class VCplxTrans: """ @overload @classmethod - def new(cls, trans: CplxTrans) -> VCplxTrans: + def new(cls, trans: CplxTrans, dbu: Optional[float] = ...) -> VCplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: DCplxTrans) -> VCplxTrans: + def new(cls, trans: DCplxTrans, dbu: Optional[float] = ...) -> VCplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the output space from floating-point units to integer units. Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload @classmethod - def new(cls, trans: ICplxTrans) -> VCplxTrans: + def new(cls, trans: ICplxTrans, dbu: Optional[float] = ...) -> VCplxTrans: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. Formally, the VCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload @classmethod @@ -52909,7 +53214,7 @@ class VCplxTrans: @brief Creates a unit transformation """ @overload - def __init__(self, c: VCplxTrans, m: Optional[float] = ..., u: Optional[Vector] = ...) -> None: + def __init__(self, c: VCplxTrans, mag: Optional[float] = ..., u: Optional[Vector] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -52921,7 +53226,7 @@ class VCplxTrans: @param u The Additional displacement """ @overload - def __init__(self, c: VCplxTrans, m: float, x: float, y: float) -> None: + def __init__(self, c: VCplxTrans, mag: Optional[float] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation from another transformation plus a magnification and displacement @@ -52934,14 +53239,7 @@ class VCplxTrans: @param y The Additional displacement (y) """ @overload - def __init__(self, m: float) -> None: - r""" - @brief Creates a transformation from a magnification - - Creates a magnifying transformation without displacement and rotation given the magnification m. - """ - @overload - def __init__(self, mag: float, rot: float, mirrx: bool, u: Vector) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., u: Optional[Vector] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -52954,7 +53252,7 @@ class VCplxTrans: @param u The displacement """ @overload - def __init__(self, mag: float, rot: float, mirrx: bool, x: int, y: int) -> None: + def __init__(self, mag: Optional[float] = ..., rot: Optional[float] = ..., mirrx: Optional[bool] = ..., x: Optional[int] = ..., y: Optional[int] = ...) -> None: r""" @brief Creates a transformation using magnification, angle, mirror flag and displacement @@ -52968,33 +53266,38 @@ class VCplxTrans: @param y The y displacement """ @overload - def __init__(self, t: DTrans) -> None: - r""" - @brief Creates a transformation from a simple transformation alone - - Creates a magnifying transformation from a simple transformation and a magnification of 1.0. - """ - @overload - def __init__(self, t: DTrans, m: float) -> None: + def __init__(self, t: DTrans, mag: Optional[float] = ...) -> None: r""" @brief Creates a transformation from a simple transformation and a magnification Creates a magnifying transformation from a simple transformation and a magnification. """ @overload - def __init__(self, trans: CplxTrans) -> None: + def __init__(self, trans: CplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: DCplxTrans) -> None: + def __init__(self, trans: DCplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the output space from floating-point units to integer units. Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload - def __init__(self, trans: ICplxTrans) -> None: + def __init__(self, trans: ICplxTrans, dbu: Optional[float] = ...) -> None: r""" - @brief Creates a floating-point coordinate transformation from another coordinate flavour + @brief Creates a floating-point to integer coordinate transformation from another coordinate flavour + + The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. Formally, the VCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. + + The 'dbu' argument has been added in version 0.29. """ @overload def __init__(self, u: Vector) -> None: @@ -53434,7 +53737,13 @@ class VCplxTrans: The database unit can be specified to translate the integer coordinate displacement in database units to a floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_itrans' use the conversion constructor: + + @code + dtrans = RBA::DCplxTrans::new(vtrans, dbu) + @/code + + This method has been deprecated in version 0.29. """ def to_s(self, lazy: Optional[bool] = ..., dbu: Optional[float] = ...) -> str: r""" @@ -53444,11 +53753,17 @@ class VCplxTrans: The lazy and DBU arguments have been added in version 0.27.6. """ - def to_trans(self) -> ICplxTrans: + def to_trans(self, arg0: float) -> ICplxTrans: r""" @brief Converts the transformation to another transformation with integer input coordinates - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_trans' use the conversion constructor: + + @code + itrans = RBA::ICplxTrans::new(vtrans, dbu) + @/code + + This method has been deprecated in version 0.29. """ def to_vtrans(self, dbu: Optional[float] = ...) -> CplxTrans: r""" @@ -53456,7 +53771,13 @@ class VCplxTrans: The database unit can be specified to translate the integer coordinate displacement in database units to an floating-point displacement in micron units. The displacement's' coordinates will be multiplied with the database unit. - This method has been introduced in version 0.25. + This method is redundant with the conversion constructors and is ill-named. Instead of 'to_vtrans' use the conversion constructor: + + @code + trans = RBA::CplxTrans::new(vtrans, dbu) + @/code + + This method has been deprecated in version 0.29. """ @overload def trans(self, box: DBox) -> Box: @@ -53961,6 +54282,10 @@ class ZeroDistanceMode: r""" @brief Compares an enum with an integer value """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -53971,6 +54296,10 @@ class ZeroDistanceMode: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: ZeroDistanceMode) -> bool: r""" @@ -54061,6 +54390,10 @@ class ZeroDistanceMode: r""" @brief Creates a copy of self """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string diff --git a/src/pymod/distutils_src/klayout/laycore.pyi b/src/pymod/distutils_src/klayout/laycore.pyi index f5e2077b4..9ca149db3 100644 --- a/src/pymod/distutils_src/klayout/laycore.pyi +++ b/src/pymod/distutils_src/klayout/laycore.pyi @@ -838,6 +838,13 @@ class Annotation(BasicAnnotation): This constant has been introduced in version 0.25 """ + RulerModeAutoMetricEdge: ClassVar[int] + r""" + @brief Specifies edge-sensitive auto-metric ruler mode for the \register_template method + In auto-metric mode, a ruler can be placed with a single click and p1/p2 will be determined from the edge it is placed on. + + This constant has been introduced in version 0.29 + """ RulerModeNormal: ClassVar[int] r""" @brief Specifies normal ruler mode for the \register_template method @@ -4249,7 +4256,7 @@ class LayerProperties: This method has been introduced in version 0.22. """ @overload - def lower_hier_level_mode(self, arg0: bool) -> int: + def lower_hier_level_mode(self, real: bool) -> int: r""" @brief Gets the mode for the lower hierarchy level. @param real If true, the computed value is returned, otherwise the local node value @@ -4994,6 +5001,10 @@ class LayoutViewBase: r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -5004,6 +5015,10 @@ class LayoutViewBase: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: LayoutViewBase.SelectionMode) -> bool: r""" @@ -5032,6 +5047,10 @@ class LayoutViewBase: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -6364,6 +6383,13 @@ class LayoutViewBase: This method returns true, if self is a const reference. In that case, only const methods may be called on self. """ + def is_dirty(self) -> bool: + r""" + @brief Gets a flag indicating whether one of the layouts displayed needs saving + A layout is 'dirty' if it is modified and needs saving. This method returns true if this is the case for at least one of the layouts shown in the view. + + This method has been introduced in version 0.29. + """ def is_editable(self) -> bool: r""" @brief Returns true if the view is in editable mode @@ -6681,7 +6707,7 @@ class LayoutViewBase: See \set_title and \title for a description about how titles are handled. """ - def resize(self, arg0: int, arg1: int) -> None: + def resize(self, w: int, h: int) -> None: r""" @brief Resizes the layout view to the given dimension @@ -7062,7 +7088,7 @@ class LayoutViewBase: It is very important to stop the redraw thread before applying changes to the layout or the cell views and the LayoutView configuration. This is usually done automatically. For rare cases, where this is not the case, this method is provided. """ - def switch_mode(self, arg0: str) -> None: + def switch_mode(self, mode: str) -> None: r""" @brief Switches the mode. @@ -7204,12 +7230,16 @@ class Macro: @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares two enums + @brief Compares an enum with an integer value """ @overload def __eq__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer value + @brief Compares two enums + """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum """ @overload def __init__(self, i: int) -> None: @@ -7221,6 +7251,10 @@ class Macro: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Macro.Format) -> bool: r""" @@ -7249,6 +7283,10 @@ class Macro: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string @@ -7308,6 +7346,10 @@ class Macro: r""" @brief Compares two enums """ + def __hash__(self) -> int: + r""" + @brief Gets the hash value from the enum + """ @overload def __init__(self, i: int) -> None: r""" @@ -7318,6 +7360,10 @@ class Macro: r""" @brief Creates an enum from a string value """ + def __int__(self) -> int: + r""" + @brief Gets the integer value from the enum + """ @overload def __lt__(self, other: Macro.Interpreter) -> bool: r""" @@ -7331,12 +7377,12 @@ class Macro: @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares two enums for inequality + @brief Compares an enum with an integer for inequality """ @overload def __ne__(self, other: object) -> bool: r""" - @brief Compares an enum with an integer for inequality + @brief Compares two enums for inequality """ def __repr__(self) -> str: r""" @@ -7346,6 +7392,10 @@ class Macro: r""" @brief Gets the symbolic string from an enum """ + def hash(self) -> int: + r""" + @brief Gets the hash value from the enum + """ def inspect(self) -> str: r""" @brief Converts an enum to a visual string diff --git a/src/pymod/distutils_src/klayout/tlcore.pyi b/src/pymod/distutils_src/klayout/tlcore.pyi index ae853b477..f821e70bf 100644 --- a/src/pymod/distutils_src/klayout/tlcore.pyi +++ b/src/pymod/distutils_src/klayout/tlcore.pyi @@ -308,7 +308,7 @@ class ArgType: r""" @brief Creates a copy of self """ - def __eq__(self, arg0: object) -> bool: + def __eq__(self, other: object) -> bool: r""" @brief Equality of two types """ @@ -316,7 +316,7 @@ class ArgType: r""" @brief Creates a new object of this class """ - def __ne__(self, arg0: object) -> bool: + def __ne__(self, other: object) -> bool: r""" @brief Inequality of two types """ @@ -1423,6 +1423,20 @@ class Method: r""" @brief Creates a new object of this class """ + def __repr__(self) -> str: + r""" + @brief Describes the method + This attribute returns a string description of the method and its signature. + + This method has been introduced in version 0.29. + """ + def __str__(self) -> str: + r""" + @brief Describes the method + This attribute returns a string description of the method and its signature. + + This method has been introduced in version 0.29. + """ def _create(self) -> None: r""" @brief Ensures the C++ object is created @@ -1460,7 +1474,7 @@ class Method: Usually it's not required to call this method. It has been introduced in version 0.24. """ - def accepts_num_args(self, arg0: int) -> bool: + def accepts_num_args(self, n: int) -> bool: r""" @brief True, if this method is compatible with the given number of arguments @@ -1569,6 +1583,13 @@ class Method: r""" @brief The return type of this method """ + def to_s(self) -> str: + r""" + @brief Describes the method + This attribute returns a string description of the method and its signature. + + This method has been introduced in version 0.29. + """ class MethodOverload: r""" diff --git a/src/pymod/pymod.pri b/src/pymod/pymod.pri index 7670517de..e030d0528 100644 --- a/src/pymod/pymod.pri +++ b/src/pymod/pymod.pri @@ -84,6 +84,8 @@ INSTALLS = lib_target QMAKE_POST_LINK += && $(MKDIR) $$DESTDIR_PYMOD/$$REALMODULE && $(COPY) $$PWD/distutils_src/klayout/$$REALMODULE/*.py $$DESTDIR_PYMOD/$$REALMODULE } + POST_TARGETDEPS += $$files($$PWD/distutils_src/klayout/$$REALMODULE/*.py, false) + # INSTALLS needs to be inside a lib or app templates. modsrc_target.path = $$PREFIX/pymod/klayout/$$REALMODULE # This would be nice: diff --git a/src/tl/tl/tl.pro b/src/tl/tl/tl.pro index 5a9f73562..7d1cf0c15 100644 --- a/src/tl/tl/tl.pro +++ b/src/tl/tl/tl.pro @@ -55,7 +55,8 @@ SOURCES = \ tlEquivalenceClusters.cc \ tlUniqueName.cc \ tlRecipe.cc \ - tlEnv.cc + tlEnv.cc \ + tlOptional.cc HEADERS = \ tlAlgorithm.h \ @@ -121,7 +122,8 @@ HEADERS = \ tlUniqueName.h \ tlRecipe.h \ tlSelect.h \ - tlEnv.h + tlEnv.h \ + tlOptional.h equals(HAVE_GIT2, "1") { diff --git a/src/tl/tl/tlOptional.cc b/src/tl/tl/tlOptional.cc new file mode 100644 index 000000000..ba2774439 --- /dev/null +++ b/src/tl/tl/tlOptional.cc @@ -0,0 +1,30 @@ +/* + + KLayout Layout Viewer + Copyright (C) 2006-2024 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#include "tlOptional.h" + +namespace tl +{ + +extern const nullopt_t nullopt = nullopt_t (); + +} // namespace tl diff --git a/src/tl/tl/tlOptional.h b/src/tl/tl/tlOptional.h new file mode 100644 index 000000000..c30fa6679 --- /dev/null +++ b/src/tl/tl/tlOptional.h @@ -0,0 +1,156 @@ +/* + + KLayout Layout Viewer + Copyright (C) 2006-2024 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#ifndef HDR_tlOptional +#define HDR_tlOptional + +#include "tlAssert.h" +#include "tlString.h" +#include "tlCommon.h" + +#include + +namespace tl +{ + +struct nullopt_t {}; + +extern const nullopt_t nullopt; + +/** + * @brief Poor man's partial implementation of C++17's std::optional + */ +template +class TL_PUBLIC_TEMPLATE optional +{ +public: + optional () : + m_value (), + m_is_valid (false) + {} + + optional (const nullopt_t &) : + m_value (), + m_is_valid (false) + {} + + optional (const T &value) : + m_value (value), + m_is_valid (true) + {} + + void reset () + { + m_is_valid = false; + } + + bool has_value() const { return m_is_valid; } + + T &value () + { + tl_assert (m_is_valid); + + return m_value; + } + + const T &value () const + { + tl_assert (m_is_valid); + + return m_value; + } + + T& operator* () + { + return value (); + } + + const T& operator* () const + { + return value (); + } + + T* operator-> () + { + return m_is_valid ? &m_value : 0; + } + + const T* operator-> () const + { + return m_is_valid ? &m_value : 0; + } + +private: + T m_value; + bool m_is_valid; +}; + +template +optional make_optional (const T &value) +{ + return optional (value); +} + +template +bool operator== (const optional &lhs, const optional &rhs) +{ + if (lhs.has_value () != rhs.has_value ()) { + return false; + } + if (!lhs.has_value ()) { + return true; + } + + return lhs.value() == rhs.value(); +} + +template +bool operator!= (const optional &lhs, const optional &rhs) +{ + return !(lhs == rhs); +} + +template +std::ostream &operator<< (std::ostream &ostr, const optional &rhs) +{ + if (rhs.has_value()) { + ostr << rhs.value(); + } else { + ostr << ""; + } + + return ostr; +} + +template +std::string to_string (const optional &opt) +{ + if (opt.has_value ()) { + return tl::to_string (*opt); + } else { + return std::string (); + } +} + +} // namespace tl + +#endif /* HDR_tlOptional */ diff --git a/src/tl/unit_tests/tlOptionalTests.cc b/src/tl/unit_tests/tlOptionalTests.cc new file mode 100644 index 000000000..182d0048d --- /dev/null +++ b/src/tl/unit_tests/tlOptionalTests.cc @@ -0,0 +1,97 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2024 Matthias Koefferlein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "tlOptional.h" +#include "tlUnitTest.h" + +namespace +{ + +TEST(1_Basic) +{ + tl::optional opt; + + // value not set + + EXPECT_EQ (opt.has_value (), false); + EXPECT_EQ (opt.operator-> (), (int *) 0); + EXPECT_EQ (((const tl::optional &) opt).operator-> (), (const int *) 0); + EXPECT_EQ (tl::to_string (opt), ""); + + try { + opt.value (); // asserts + EXPECT_EQ (true, false); + } catch (...) { + } + + // make_optional, assignment + + opt = tl::make_optional (17); + + // value set + + EXPECT_EQ (opt.has_value (), true); + EXPECT_EQ (opt.value (), 17); + EXPECT_EQ (tl::to_string (opt), "17"); + EXPECT_EQ (((const tl::optional &) opt).value (), 17); + EXPECT_EQ (*opt, 17); + EXPECT_EQ (*((const tl::optional &) opt), 17); + EXPECT_EQ (*(opt.operator-> ()), 17); + EXPECT_EQ (*(((const tl::optional &) opt).operator-> ()), 17); + + // compare operators + + EXPECT_EQ (opt == tl::make_optional (-1), false); + EXPECT_EQ (opt == tl::make_optional (17), true); + EXPECT_EQ (opt == tl::optional (), false); + + EXPECT_EQ (opt != tl::make_optional (-1), true); + EXPECT_EQ (opt != tl::make_optional (17), false); + EXPECT_EQ (opt != tl::optional (), true); + + // copy ctor + + tl::optional opt2 (opt); + + EXPECT_EQ (opt2.has_value (), true); + EXPECT_EQ (opt2.value (), 17); + + // reset method + + opt = tl::make_optional (17); + opt.reset (); + + EXPECT_EQ (opt.has_value (), false); + EXPECT_EQ (opt == tl::optional (), true); + EXPECT_EQ (opt != tl::optional (), false); + + // tl::nullopt tag + + opt = tl::make_optional (17); + opt = tl::optional (tl::nullopt); + + EXPECT_EQ (opt.has_value (), false); + EXPECT_EQ (opt == tl::optional (), true); + EXPECT_EQ (opt != tl::optional (), false); +} + +} diff --git a/src/tl/unit_tests/unit_tests.pro b/src/tl/unit_tests/unit_tests.pro index 0e4bcc449..3d8b06676 100644 --- a/src/tl/unit_tests/unit_tests.pro +++ b/src/tl/unit_tests/unit_tests.pro @@ -31,6 +31,7 @@ SOURCES = \ tlLongIntTests.cc \ tlMathTests.cc \ tlObjectTests.cc \ + tlOptionalTests.cc \ tlPixelBufferTests.cc \ tlResourcesTests.cc \ tlReuseVectorTests.cc \ diff --git a/testdata/ruby/dbPCells.rb b/testdata/ruby/dbPCells.rb index ac96c68d3..d65150618 100644 --- a/testdata/ruby/dbPCells.rb +++ b/testdata/ruby/dbPCells.rb @@ -190,6 +190,78 @@ def norm_hash(hash) end +class DBPCellAPI_TestClass < TestBase + + def test_1 + + # PCellParameterDeclaration + + decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description") + + assert_equal(decl.name, "name") + assert_equal(decl.description, "description") + assert_equal(decl.default.inspect, "nil") + assert_equal(decl.unit, "") + assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString) + + decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17") + + assert_equal(decl.name, "name") + assert_equal(decl.description, "description") + assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString) + assert_equal(decl.default.to_s, "17") + assert_equal(decl.unit, "") + + decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17", "unit") + + assert_equal(decl.name, "name") + assert_equal(decl.description, "description") + assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString) + assert_equal(decl.default.to_s, "17") + assert_equal(decl.unit, "unit") + + decl.name = "n" + assert_equal(decl.name, "n") + decl.description = "d" + assert_equal(decl.description, "d") + decl.unit = "u" + assert_equal(decl.unit, "u") + decl.type = RBA::PCellParameterDeclaration::TypeBoolean + assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeBoolean) + decl.default = true + assert_equal(decl.default.to_s, "true") + + decl.type = RBA::PCellParameterDeclaration::TypeInt + assert_equal(decl.min_value.inspect, "nil") + assert_equal(decl.max_value.inspect, "nil") + decl.min_value = "-1" + assert_equal(decl.min_value.to_s, "-1") + decl.max_value = "42" + assert_equal(decl.max_value.to_s, "42") + decl.min_value = nil + decl.max_value = nil + assert_equal(decl.min_value.inspect, "nil") + assert_equal(decl.max_value.inspect, "nil") + + assert_equal(decl.hidden?, false) + decl.hidden = true + assert_equal(decl.hidden?, true) + + assert_equal(decl.readonly?, false) + decl.readonly = true + assert_equal(decl.readonly?, true) + + decl.add_choice("first", 42) + assert_equal(decl.choice_values, [42]) + assert_equal(decl.choice_descriptions, ["first"]) + decl.clear_choices + assert_equal(decl.choice_values, []) + assert_equal(decl.choice_descriptions, []) + + end + +end + class DBPCell_TestClass < TestBase def test_1 From ea645b7cf07d7009e35ea8a94df06acd491c6307 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 19 Mar 2024 00:53:55 +0100 Subject: [PATCH 43/79] Enabling Python 3.12 for Windows for PyPI. Needs a new release --- azure-pipelines.yml | 6 ++++++ version.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a4061e230..780263f47 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,6 +32,9 @@ jobs: cp311-cp311-win_amd64.whl: python.version: '3.11' python.architecture: 'x64' + cp312-cp312-win_amd64.whl: + python.version: '3.12' + python.architecture: 'x64' cp36-cp36m-win32.whl: python.version: '3.6' python.architecture: 'x86' @@ -50,6 +53,9 @@ jobs: cp311-cp311-win32.whl: python.version: '3.11' python.architecture: 'x86' + cp312-cp312-win32.whl: + python.version: '3.12' + python.architecture: 'x86' maxParallel: 6 steps: diff --git a/version.sh b/version.sh index 9163a6f1d..efaa36f03 100644 --- a/version.sh +++ b/version.sh @@ -5,7 +5,7 @@ KLAYOUT_VERSION="0.28.17" # The version used for PyPI (don't use variables here!) -KLAYOUT_PYPI_VERSION="0.28.17" +KLAYOUT_PYPI_VERSION="0.28.17-1" # The build date KLAYOUT_VERSION_DATE=$(date "+%Y-%m-%d") From 6faf3335882e4c289e9f59584572da509f0eae22 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 19 Mar 2024 18:24:31 +0100 Subject: [PATCH 44/79] Include deployment of Python 3.12 support for klayout PyPI module --- azure-pipelines.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 780263f47..fe6cbc813 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -136,6 +136,11 @@ jobs: vmImage: 'windows-2019' # other options: 'macOS-10.13', 'ubuntu-16.04' steps: - checkout: none #skip checking out the default repository resource + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts wheel-3.12.x64' + inputs: + artifactName: 'wheel-3.12.x64' + downloadPath: '$(System.DefaultWorkingDirectory)' - task: DownloadBuildArtifacts@0 displayName: 'Download Build Artifacts wheel-3.11.x64' inputs: @@ -166,6 +171,11 @@ jobs: inputs: artifactName: 'wheel-3.6.x64' downloadPath: '$(System.DefaultWorkingDirectory)' + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts wheel-3.12.x86' + inputs: + artifactName: 'wheel-3.12.x86' + downloadPath: '$(System.DefaultWorkingDirectory)' - task: DownloadBuildArtifacts@0 displayName: 'Download Build Artifacts wheel-3.11.x86' inputs: From b4d90ef94ced1c3635ce4e2856ff7078c3718501 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 20 Mar 2024 00:08:47 +0100 Subject: [PATCH 45/79] New version for future release --- version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.sh b/version.sh index efaa36f03..43b2ae5b6 100644 --- a/version.sh +++ b/version.sh @@ -2,10 +2,10 @@ # This script is sourced to define the main version parameters # The main version -KLAYOUT_VERSION="0.28.17" +KLAYOUT_VERSION="0.29.0" # The version used for PyPI (don't use variables here!) -KLAYOUT_PYPI_VERSION="0.28.17-1" +KLAYOUT_PYPI_VERSION="0.29.0" # The build date KLAYOUT_VERSION_DATE=$(date "+%Y-%m-%d") From b4d170fa66cb8b41bfb45454d311bb6716a85ffc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 09:07:26 +0100 Subject: [PATCH 46/79] Implemented issue #1656 (Display-->Goto Position dialog should accept + as well as - for number prefixes) --- src/db/unit_tests/dbTransTests.cc | 4 ++-- src/tl/tl/tlString.cc | 2 -- src/tl/unit_tests/tlStringTests.cc | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/db/unit_tests/dbTransTests.cc b/src/db/unit_tests/dbTransTests.cc index 85f9a5188..622b94428 100644 --- a/src/db/unit_tests/dbTransTests.cc +++ b/src/db/unit_tests/dbTransTests.cc @@ -353,9 +353,9 @@ TEST(11) EXPECT_EQ (x.try_read (tt2), true); EXPECT_EQ (x.test ("a"), true); EXPECT_EQ (tt2.to_string (), t2.to_string ()); - x = tl::Extractor ("m22.5 *0.55 12.4,-17 ++"); + x = tl::Extractor ("m22.5 *0.55 12.4,-17 ##"); EXPECT_EQ (x.try_read (tt2), true); - EXPECT_EQ (x.test ("++"), true); + EXPECT_EQ (x.test ("##"), true); EXPECT_EQ (tt2.to_string (), "m22.5 *0.55 12.4,-17"); EXPECT_EQ (tt2.to_string (), t3.to_string ()); } diff --git a/src/tl/tl/tlString.cc b/src/tl/tl/tlString.cc index ab327c00f..8a0379e6e 100644 --- a/src/tl/tl/tlString.cc +++ b/src/tl/tl/tlString.cc @@ -322,10 +322,8 @@ static double local_strtod (const char *cp, const char *&cp_new) if (*cp == '-') { s = -1.0; ++cp; - /* } else if (*cp == '+') { ++cp; - */ } // Extract upper digits diff --git a/src/tl/unit_tests/tlStringTests.cc b/src/tl/unit_tests/tlStringTests.cc index e6078ec3a..aafab46e6 100644 --- a/src/tl/unit_tests/tlStringTests.cc +++ b/src/tl/unit_tests/tlStringTests.cc @@ -305,6 +305,25 @@ TEST(6) EXPECT_EQ (x3.test (":"), true); } +TEST(6_double) +{ + Extractor x (" 5.5 -2.5 \n+0.125 (no number)"); + + EXPECT_EQ (x.at_end (), false); + + double d = 0.0; + + EXPECT_EQ (x.try_read (d), true); + EXPECT_EQ (d, 5.5); + + x.read (d); + EXPECT_EQ (d, -2.5); + x.read (d); + EXPECT_EQ (d, 0.125); + + x.expect ("("); +} + TEST(7) { EXPECT_EQ (tl::to_quoted_string ("a_word!"), "'a_word!'"); From 38a3b8305e0478235c9ab71a39821b151a0eb363 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 15:24:18 +0100 Subject: [PATCH 47/79] Fixing issue #1651 (errors when adding polygons with 4 points) - needs some testing --- src/pya/pya/pyaCallables.cc | 9 +++++---- src/pya/pya/pyaMarshal.cc | 26 +++++++++++++------------- src/pya/pya/pyaMarshal.h | 2 +- src/rba/rba/rba.cc | 4 ++-- src/rba/rba/rbaMarshal.cc | 20 ++++++++++---------- src/rba/rba/rbaMarshal.h | 2 +- testdata/python/dbPolygonTest.py | 10 ++++++++++ testdata/ruby/dbPolygonTest.rb | 12 ++++++++++++ 8 files changed, 54 insertions(+), 31 deletions(-) diff --git a/src/pya/pya/pyaCallables.cc b/src/pya/pya/pyaCallables.cc index 72e4eb7d2..77f3c1728 100644 --- a/src/pya/pya/pyaCallables.cc +++ b/src/pya/pya/pyaCallables.cc @@ -350,9 +350,9 @@ match_method (int mid, PyObject *self, PyObject *args, PyObject *kwargs, bool st PythonPtr arg (i >= argc ? get_kwarg (*a, kwargs) : (is_tuple ? PyTuple_GetItem (args, i) : PyList_GetItem (args, i))); if (! arg) { is_valid = a->spec ()->has_default (); - } else if (test_arg (*a, arg.get (), false /*strict*/)) { + } else if (test_arg (*a, arg.get (), false /*strict*/, false /*object substitution*/)) { ++sc; - } else if (test_arg (*a, arg.get (), true /*loose*/)) { + } else if (test_arg (*a, arg.get (), true /*loose*/, true /*object substitution*/)) { // non-scoring match } else { is_valid = false; @@ -405,7 +405,7 @@ match_method (int mid, PyObject *self, PyObject *args, PyObject *kwargs, bool st int i = 0; for (gsi::MethodBase::argument_iterator a = meth->begin_arguments (); a != meth->end_arguments (); ++a, ++i) { PythonPtr arg (i >= argc ? get_kwarg (*a, kwargs) : (is_tuple ? PyTuple_GetItem (args, i) : PyList_GetItem (args, i))); - if (arg && ! test_arg (*a, arg.get (), true /*loose*/)) { + if (arg && ! test_arg (*a, arg.get (), true /*loose*/, true /*object substitution*/)) { return 0; } } @@ -1116,7 +1116,8 @@ property_setter_impl (int mid, PyObject *self, PyObject *value) // check arguments (count and type) bool is_valid = (*m)->compatible_with_num_args (1); - if (is_valid && ! test_arg (*(*m)->begin_arguments (), value, pass != 0 /*loose in the second pass*/)) { + bool loose = (pass != 0); // loose in the second pass + if (is_valid && ! test_arg (*(*m)->begin_arguments (), value, loose, loose)) { is_valid = false; } diff --git a/src/pya/pya/pyaMarshal.cc b/src/pya/pya/pyaMarshal.cc index 41cc134c0..e6ebed0ed 100644 --- a/src/pya/pya/pyaMarshal.cc +++ b/src/pya/pya/pyaMarshal.cc @@ -1046,7 +1046,7 @@ size_t PythonBasedMapAdaptor::serial_size () const template struct test_arg_func { - void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose) + void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Py_None) { @@ -1083,7 +1083,7 @@ struct test_arg_func template <> struct test_arg_func { - void operator() (bool *ret, PyObject *, const gsi::ArgType &, bool) + void operator() (bool *ret, PyObject *, const gsi::ArgType &, bool, bool) { // we assume we can convert everything into a variant *ret = true; @@ -1093,7 +1093,7 @@ struct test_arg_func template <> struct test_arg_func { - void operator() (bool *ret, PyObject *arg, const gsi::ArgType &, bool) + void operator() (bool *ret, PyObject *arg, const gsi::ArgType &, bool, bool) { #if PY_MAJOR_VERSION < 3 if (PyString_Check (arg)) { @@ -1117,7 +1117,7 @@ struct test_arg_func template <> struct test_arg_func { - void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose) + void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Py_None) { // for ptr or cptr, null is an allowed value @@ -1138,7 +1138,7 @@ struct test_arg_func size_t n = PyTuple_Size (arg); for (size_t i = 0; i < n && *ret; ++i) { - if (! test_arg (ainner, PyTuple_GetItem (arg, i), loose)) { + if (! test_arg (ainner, PyTuple_GetItem (arg, i), loose, true /*issue-1651*/)) { *ret = false; } } @@ -1147,7 +1147,7 @@ struct test_arg_func size_t n = PyList_Size (arg); for (size_t i = 0; i < n && *ret; ++i) { - if (! test_arg (ainner, PyList_GetItem (arg, i), loose)) { + if (! test_arg (ainner, PyList_GetItem (arg, i), loose, true /*issue-1651*/)) { *ret = false; } } @@ -1159,7 +1159,7 @@ struct test_arg_func template <> struct test_arg_func { - void operator () (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose) + void operator () (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Py_None) { // for ptr or cptr, null is an allowed value @@ -1184,11 +1184,11 @@ struct test_arg_func PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(arg, &pos, &key, &value)) { - if (! test_arg (ainner_k, key, loose)) { + if (! test_arg (ainner_k, key, loose, true /*issue-1651*/)) { *ret = false; break; } - if (! test_arg (ainner, value, loose)) { + if (! test_arg (ainner, value, loose, true /*issue-1651*/)) { *ret = false; break; } @@ -1199,7 +1199,7 @@ struct test_arg_func template <> struct test_arg_func { - void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose) + void operator() (bool *ret, PyObject *arg, const gsi::ArgType &atype, bool loose, bool object_substitution) { const gsi::ClassBase *acls = atype.cls (); @@ -1209,7 +1209,7 @@ struct test_arg_func return; } - if (loose && (PyTuple_Check (arg) || PyList_Check (arg))) { + if (object_substitution && (PyTuple_Check (arg) || PyList_Check (arg))) { // we may implicitly convert a tuple into a constructor call of a target object - // for now we only check whether the number of arguments is compatible with the list given. @@ -1247,10 +1247,10 @@ struct test_arg_func }; bool -test_arg (const gsi::ArgType &atype, PyObject *arg, bool loose) +test_arg (const gsi::ArgType &atype, PyObject *arg, bool loose, bool object_substitution) { bool ret = false; - gsi::do_on_type () (atype.type (), &ret, arg, atype, loose); + gsi::do_on_type () (atype.type (), &ret, arg, atype, loose, object_substitution); return ret; } diff --git a/src/pya/pya/pyaMarshal.h b/src/pya/pya/pyaMarshal.h index ea61acaef..e0e529382 100644 --- a/src/pya/pya/pyaMarshal.h +++ b/src/pya/pya/pyaMarshal.h @@ -69,7 +69,7 @@ PythonRef pull_arg (const gsi::ArgType &atype, gsi::SerialArgs &aserial, PYAObje * @return True, if the type match */ bool -test_arg (const gsi::ArgType &atype, PyObject *arg, bool loose); +test_arg (const gsi::ArgType &atype, PyObject *arg, bool loose, bool object_substitution); /** * @brief Correct constness if a reference is const and a non-const reference is required diff --git a/src/rba/rba/rba.cc b/src/rba/rba/rba.cc index 8bd642f04..0cef54c62 100644 --- a/src/rba/rba/rba.cc +++ b/src/rba/rba/rba.cc @@ -479,9 +479,9 @@ private: VALUE arg = i >= argc ? get_kwarg (*a, kwargs) : argv[i]; if (arg == Qundef) { is_valid = a->spec ()->has_default (); - } else if (test_arg (*a, arg, false /*strict*/)) { + } else if (test_arg (*a, arg, false /*strict*/, false /*with object substitution*/)) { ++sc; - } else if (test_arg (*a, arg, true /*loose*/)) { + } else if (test_arg (*a, arg, true /*loose*/, true /*with object substitution*/)) { // non-scoring match } else { is_valid = false; diff --git a/src/rba/rba/rbaMarshal.cc b/src/rba/rba/rbaMarshal.cc index 5cacd22e1..7083fd1c7 100644 --- a/src/rba/rba/rbaMarshal.cc +++ b/src/rba/rba/rbaMarshal.cc @@ -1053,7 +1053,7 @@ pull_arg (const gsi::ArgType &atype, Proxy *self, gsi::SerialArgs &aserial, tl:: template struct test_arg_func { - void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose) + void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Qnil) { @@ -1101,7 +1101,7 @@ struct test_vector unsigned int len = RARRAY_LEN(arr); VALUE *el = RARRAY_PTR(arr); while (len-- > 0) { - if (! test_arg (ainner, *el++, loose)) { + if (! test_arg (ainner, *el++, loose, true /*issue-1651*/)) { *ret = false; break; } @@ -1112,7 +1112,7 @@ struct test_vector template <> struct test_arg_func { - void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose) + void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Qnil) { // for pointers to vectors, nil is a valid value @@ -1141,11 +1141,11 @@ struct HashTestKeyValueData static int hash_test_value_key (VALUE key, VALUE value, VALUE a) { HashTestKeyValueData *args = (HashTestKeyValueData *)a; - if (! test_arg (*args->ainner_k, key, args->loose)) { + if (! test_arg (*args->ainner_k, key, args->loose, true /*issue-1651*/)) { *(args->ret) = false; return ST_STOP; } - if (! test_arg (*args->ainner, value, args->loose)) { + if (! test_arg (*args->ainner, value, args->loose, true /*issue-1651*/)) { *(args->ret) = false; return ST_STOP; } @@ -1155,7 +1155,7 @@ static int hash_test_value_key (VALUE key, VALUE value, VALUE a) template <> struct test_arg_func { - void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose) + void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose, bool /*object_substitution*/) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Qnil) { // for pointers to maps, nil is a valid value @@ -1183,14 +1183,14 @@ struct test_arg_func template <> struct test_arg_func { - void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose) + void operator () (bool *ret, VALUE arg, const gsi::ArgType &atype, bool loose, bool object_substitution) { if ((atype.is_cptr () || atype.is_ptr ()) && arg == Qnil) { // for const X * or X *, nil is an allowed value *ret = true; - } else if (loose && TYPE (arg) == T_ARRAY) { + } else if (object_substitution && TYPE (arg) == T_ARRAY) { // we may implicitly convert an array into a constructor call of a target object - // for now we only check whether the number of arguments is compatible with the array given. @@ -1234,10 +1234,10 @@ struct test_arg_func }; bool -test_arg (const gsi::ArgType &atype, VALUE arg, bool loose) +test_arg (const gsi::ArgType &atype, VALUE arg, bool loose, bool object_substitution) { bool ret = false; - gsi::do_on_type () (atype.type (), &ret, arg, atype, loose); + gsi::do_on_type () (atype.type (), &ret, arg, atype, loose, object_substitution); return ret; } diff --git a/src/rba/rba/rbaMarshal.h b/src/rba/rba/rbaMarshal.h index 9e8ea4e07..436ef01cd 100644 --- a/src/rba/rba/rbaMarshal.h +++ b/src/rba/rba/rbaMarshal.h @@ -62,7 +62,7 @@ void push_arg (const gsi::ArgType &atype, gsi::SerialArgs &aserial, VALUE arg, t * otherwise: * argument must be of the requested type */ -bool test_arg (const gsi::ArgType &atype, VALUE arg, bool loose); +bool test_arg (const gsi::ArgType &atype, VALUE arg, bool loose, bool object_substitution); } diff --git a/testdata/python/dbPolygonTest.py b/testdata/python/dbPolygonTest.py index ec1c4a3b6..fb5349d45 100644 --- a/testdata/python/dbPolygonTest.py +++ b/testdata/python/dbPolygonTest.py @@ -746,6 +746,16 @@ class DBPolygonTests(unittest.TestCase): poly = pya.Polygon(hull).insert_hole(hole1).insert_hole(hole2) self.assertEqual(str(poly), "(0,0;0,3000;6000,3000;6000,0/1000,1000;2000,1000;2000,2000;1000,2000/3000,1000;4000,1000;4000,2000;3000,2000)") + def test_argumentShortcuts(self): + + # implicit conversion to a Point array: + poly = pya.Polygon([ (0,0), (0,1000), (1000,1000) ]) + self.assertEqual(str(poly), "(0,0;0,1000;1000,1000)") + + # issue 1651 - no binding to Box constructor + poly = pya.Polygon([ (0,0), (0,1000), (1000,1000), (1000,0) ]) + self.assertEqual(str(poly), "(0,0;0,1000;1000,1000;1000,0)") + # run unit tests if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromTestCase(DBPolygonTests) diff --git a/testdata/ruby/dbPolygonTest.rb b/testdata/ruby/dbPolygonTest.rb index bdd290f01..6643c3aef 100644 --- a/testdata/ruby/dbPolygonTest.rb +++ b/testdata/ruby/dbPolygonTest.rb @@ -834,6 +834,18 @@ class DBPolygon_TestClass < TestBase end + def test_argumentShortcuts + + # implicit conversion to a Point array: + poly = RBA::Polygon.new([ [0,0], [0,1000], [1000,1000] ]) + assert_equal(poly.to_s, "(0,0;0,1000;1000,1000)") + + # issue 1651 - no binding to Box constructor + poly = RBA::Polygon.new([ [0,0], [0,1000], [1000,1000], [1000,0] ]) + assert_equal(poly.to_s, "(0,0;0,1000;1000,1000;1000,0)") + + end + end load("test_epilogue.rb") From 9e81a2f2aff63b52ca02015af44137dd848e712a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 15:41:07 +0100 Subject: [PATCH 48/79] Added a dummy Changelog to make Debian builds pass --- Changelog.Debian | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.Debian b/Changelog.Debian index 8a6a53a23..735a1aaae 100644 --- a/Changelog.Debian +++ b/Changelog.Debian @@ -1,3 +1,10 @@ +klayout (0.29.0-1) unstable; urgency=low + + * New features and bugfixes + - See changelog + + -- Matthias Köfferlein Fri, 01 Apr 2024 12:00:00 +0100 + klayout (0.28.17-1) unstable; urgency=low * New features and bugfixes From b962514767602c0e173eea83a68b6778e02f8cc4 Mon Sep 17 00:00:00 2001 From: Will Shanks Date: Sat, 23 Mar 2024 10:44:04 -0400 Subject: [PATCH 49/79] Add include needed for git_error_set_str for libgit2>=1.8 (#1658) `git_error_set_str` was moved into the `sys` subdirectory in libgit2 1.8.0. See [this pull request](https://github.com/libgit2/libgit2/pull/6625) for details and [this issue](https://github.com/libgit2/libgit2/issues/6776) for more context. --- src/tl/tl/tlGit.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tl/tl/tlGit.cc b/src/tl/tl/tlGit.cc index 3e749e633..6278bccfe 100644 --- a/src/tl/tl/tlGit.cc +++ b/src/tl/tl/tlGit.cc @@ -30,6 +30,9 @@ #include "tlEnv.h" #include +#if LIBGIT2_VER_MAJOR > 1 || (LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8) + #include +#endif #include namespace tl From 0ef35b300aec715c16fb5ff0fd68aaafa687845a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 15:41:07 +0100 Subject: [PATCH 50/79] Added a dummy Changelog to make Debian builds pass --- Changelog.Debian | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.Debian b/Changelog.Debian index 8a6a53a23..735a1aaae 100644 --- a/Changelog.Debian +++ b/Changelog.Debian @@ -1,3 +1,10 @@ +klayout (0.29.0-1) unstable; urgency=low + + * New features and bugfixes + - See changelog + + -- Matthias Köfferlein Fri, 01 Apr 2024 12:00:00 +0100 + klayout (0.28.17-1) unstable; urgency=low * New features and bugfixes From b24d27cf732d19fd82a0f0181afe8e7378d8feb5 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 15:41:07 +0100 Subject: [PATCH 51/79] Added a dummy Changelog to make Debian builds pass --- Changelog.Debian | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.Debian b/Changelog.Debian index 8a6a53a23..735a1aaae 100644 --- a/Changelog.Debian +++ b/Changelog.Debian @@ -1,3 +1,10 @@ +klayout (0.29.0-1) unstable; urgency=low + + * New features and bugfixes + - See changelog + + -- Matthias Köfferlein Fri, 01 Apr 2024 12:00:00 +0100 + klayout (0.28.17-1) unstable; urgency=low * New features and bugfixes From 4163e3a52ce212e52f7cfac86f0b9192fab98b17 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 16:59:24 +0100 Subject: [PATCH 52/79] Dummy Changelog --- Changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog b/Changelog index 5a9b54af4..2ac7bcff6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +0.29.0 (2024-04-01): +* TODO + 0.28.17 (2024-02-16): * Enhancement: %GITHUB%/issues/1626 Technology specific grids From 20fd5a54a7160bc8ff474ca60dcd481767c728fd Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 16:57:44 +0100 Subject: [PATCH 53/79] Tests --- Changelog | 3 +++ src/db/unit_tests/dbDeepRegionTests.cc | 29 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Changelog b/Changelog index 5a9b54af4..2ac7bcff6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +0.29.0 (2024-04-01): +* TODO + 0.28.17 (2024-02-16): * Enhancement: %GITHUB%/issues/1626 Technology specific grids diff --git a/src/db/unit_tests/dbDeepRegionTests.cc b/src/db/unit_tests/dbDeepRegionTests.cc index 1037dc1c7..68c787fb8 100644 --- a/src/db/unit_tests/dbDeepRegionTests.cc +++ b/src/db/unit_tests/dbDeepRegionTests.cc @@ -2649,6 +2649,35 @@ TEST(101_DeepFlatCollaboration) db::compare_layouts (_this, target, tl::testdata () + "/algo/deep_region_au101.gds"); } +TEST(102_SameInputs) +{ + db::Layout ly; + { + std::string fn (tl::testdata ()); + fn += "/algo/deep_region_l1.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + db::cell_index_type top_cell_index = *ly.begin_top_down (); + db::Cell &top_cell = ly.cell (top_cell_index); + + db::DeepShapeStore dss; + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + unsigned int l3 = ly.get_layer (db::LayerProperties (3, 0)); + + db::Region r2 (db::RecursiveShapeIterator (ly, top_cell, l2), dss); + db::Region r3 (db::RecursiveShapeIterator (ly, top_cell, l3), dss); + + EXPECT_EQ ((r2 & r2).to_string (), "..."); + EXPECT_EQ ((r2 - r2).to_string (), "..."); + EXPECT_EQ ((r2 | r2).to_string (), "..."); + EXPECT_EQ ((r2 ^ r2).to_string (), "..."); + EXPECT_EQ ((r2 + r2).to_string (), "..."); +} + TEST(issue_277) { db::Layout ly; From a17b27453a08b8840ba50dff55edb7e86997593c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 16:59:24 +0100 Subject: [PATCH 54/79] Dummy Changelog --- Changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog b/Changelog index 5a9b54af4..2ac7bcff6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +0.29.0 (2024-04-01): +* TODO + 0.28.17 (2024-02-16): * Enhancement: %GITHUB%/issues/1626 Technology specific grids From 76345e207a0a52bf5208c39cee10163c33da195c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 16:59:24 +0100 Subject: [PATCH 55/79] Dummy Changelog --- Changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog b/Changelog index 5a9b54af4..2ac7bcff6 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +0.29.0 (2024-04-01): +* TODO + 0.28.17 (2024-02-16): * Enhancement: %GITHUB%/issues/1626 Technology specific grids From e1b041113aa8d9d6d62cf7153e19b34ee12ccda2 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 19:23:21 +0100 Subject: [PATCH 56/79] [consider merging] fixed a linker problem for debug builds --- src/tl/tl/tlOptional.cc | 2 +- src/tl/tl/tlOptional.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tl/tl/tlOptional.cc b/src/tl/tl/tlOptional.cc index ba2774439..d7ee370b2 100644 --- a/src/tl/tl/tlOptional.cc +++ b/src/tl/tl/tlOptional.cc @@ -25,6 +25,6 @@ namespace tl { -extern const nullopt_t nullopt = nullopt_t (); +const nullopt_t nullopt = nullopt_t (); } // namespace tl diff --git a/src/tl/tl/tlOptional.h b/src/tl/tl/tlOptional.h index c30fa6679..3893d6ac0 100644 --- a/src/tl/tl/tlOptional.h +++ b/src/tl/tl/tlOptional.h @@ -34,7 +34,7 @@ namespace tl struct nullopt_t {}; -extern const nullopt_t nullopt; +extern TL_PUBLIC const nullopt_t nullopt; /** * @brief Poor man's partial implementation of C++17's std::optional From a6d2930f805bea5fe3df997af43e27fad688f503 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 19:37:27 +0100 Subject: [PATCH 57/79] Fixed issue #1643 (Feeding the same layer to two-layer operations in deep mode does not render the desired result) by implementating the identical layer case as an exception for booleans and interactions --- src/db/db/dbDeepEdges.cc | 72 ++++++++++++++++++++++++-- src/db/db/dbDeepRegion.cc | 63 +++++++++++++++++++++- src/db/unit_tests/dbDeepEdgesTests.cc | 49 ++++++++++++++++++ src/db/unit_tests/dbDeepRegionTests.cc | 47 ++++++++++++++--- 4 files changed, 219 insertions(+), 12 deletions(-) diff --git a/src/db/db/dbDeepEdges.cc b/src/db/db/dbDeepEdges.cc index c94839621..21591eeda 100644 --- a/src/db/db/dbDeepEdges.cc +++ b/src/db/db/dbDeepEdges.cc @@ -1052,6 +1052,10 @@ EdgesDelegate *DeepEdges::and_with (const Edges &other) const return AsIfFlatEdges::and_with (other); + } else if (deep_layer () == other_deep->deep_layer ()) { + + return clone (); + } else { return new DeepEdges (and_or_not_with (other_deep, EdgeAnd).first); @@ -1071,6 +1075,10 @@ EdgesDelegate *DeepEdges::not_with (const Edges &other) const return AsIfFlatEdges::not_with (other); + } else if (deep_layer () == other_deep->deep_layer ()) { + + return new DeepEdges (deep_layer ().derived ()); + } else { return new DeepEdges (and_or_not_with (other_deep, EdgeNot).first); @@ -1164,6 +1172,10 @@ DeepEdges::andnot_with (const Edges &other) const return AsIfFlatEdges::andnot_with (other); + } else if (deep_layer () == other_deep->deep_layer ()) { + + return std::make_pair (clone (), new DeepEdges (deep_layer ().derived ())); + } else { auto res = and_or_not_with (other_deep, EdgeAndNot); @@ -1188,6 +1200,10 @@ EdgesDelegate *DeepEdges::xor_with (const Edges &other) const return AsIfFlatEdges::xor_with (other); + } else if (deep_layer () == other_deep->deep_layer ()) { + + return new DeepEdges (deep_layer ().derived ()); + } else { // Implement XOR as (A-B)+(B-A) - only this implementation @@ -1203,6 +1219,11 @@ EdgesDelegate *DeepEdges::xor_with (const Edges &other) const EdgesDelegate *DeepEdges::or_with (const Edges &other) const { + const DeepEdges *other_deep = dynamic_cast (other.delegate ()); + if (other_deep && other_deep->deep_layer () == deep_layer ()) { + return clone (); + } + // NOTE: in the hierarchical case we don't do a merge on "or": just map to add return add (other); } @@ -1503,8 +1524,19 @@ DeepEdges::selected_interacting_generic (const Edges &other, EdgeInteractionMode other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer () && !counting) { + if ((mode == EdgesOutside) == inverse) { + return clone (); + } else { + return new DeepEdges (deep_layer ().derived ()); + } + } + const db::DeepLayer &edges = merged_deep_layer (); + // NOTE: with counting the other region needs to be merged + const db::DeepLayer &other_edges = (counting || mode != EdgesInteract ? other_deep->merged_deep_layer () : other_deep->deep_layer ()); + DeepLayer dl_out (edges.derived ()); db::Edge2EdgeInteractingLocalOperation op (mode, inverse ? db::Edge2EdgeInteractingLocalOperation::Inverse : db::Edge2EdgeInteractingLocalOperation::Normal, min_count, max_count); @@ -1513,8 +1545,13 @@ DeepEdges::selected_interacting_generic (const Edges &other, EdgeInteractionMode proc.set_base_verbosity (base_verbosity ()); proc.set_threads (edges.store ()->threads ()); - // NOTE: with counting the other region needs to be merged - proc.run (&op, edges.layer (), (counting || mode != EdgesInteract ? other_deep->merged_deep_layer () : other_deep->deep_layer ()).layer (), dl_out.layer ()); + if (edges == other_edges) { + // with counting and two identical inputs, a copy needs to be made + db::DeepLayer copy (other_edges.copy ()); + proc.run (&op, edges.layer (), copy.layer (), dl_out.layer ()); + } else { + proc.run (&op, edges.layer (), other_edges.layer (), dl_out.layer ()); + } return new db::DeepEdges (dl_out); } @@ -1533,8 +1570,19 @@ DeepEdges::selected_interacting_pair_generic (const Edges &other, EdgeInteractio other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer () && !counting) { + if (mode != EdgesOutside) { + return std::make_pair (clone (), new DeepEdges (deep_layer ().derived ())); + } else { + return std::make_pair (new DeepEdges (deep_layer ().derived ()), clone ()); + } + } + const db::DeepLayer &edges = merged_deep_layer (); + // NOTE: with counting the other region needs to be merged + const db::DeepLayer &other_edges = (counting || mode != EdgesInteract ? other_deep->merged_deep_layer () : other_deep->deep_layer ()); + DeepLayer dl_out (edges.derived ()); DeepLayer dl_out2 (edges.derived ()); @@ -1550,7 +1598,13 @@ DeepEdges::selected_interacting_pair_generic (const Edges &other, EdgeInteractio proc.set_threads (edges.store ()->threads ()); // NOTE: with counting the other region needs to be merged - proc.run (&op, edges.layer (), (counting || mode != EdgesInteract ? other_deep->merged_deep_layer () : other_deep->deep_layer ()).layer (), output_layers); + if (edges == other_edges) { + // with counting and two identical inputs, a copy needs to be made + db::DeepLayer copy (other_edges.copy ()); + proc.run (&op, edges.layer (), copy.layer (), output_layers); + } else { + proc.run (&op, edges.layer (), other_edges.layer (), output_layers); + } return std::make_pair (new db::DeepEdges (dl_out), new db::DeepEdges (dl_out2)); } @@ -1591,6 +1645,10 @@ EdgesDelegate *DeepEdges::pull_generic (const Edges &other) const other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer ()) { + return clone (); + } + const db::DeepLayer &edges = deep_layer (); const db::DeepLayer &other_edges = other_deep->merged_deep_layer (); @@ -1617,6 +1675,10 @@ EdgesDelegate *DeepEdges::in (const Edges &other, bool invert) const other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer ()) { + return invert ? new db::DeepEdges (deep_layer ().derived ()) : clone (); + } + const db::DeepLayer &edges = merged_deep_layer (); DeepLayer dl_out (edges.derived ()); @@ -1646,6 +1708,10 @@ std::pair DeepEdges::in_and_out (const Edges & other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer ()) { + return std::make_pair (clone (), new db::DeepEdges (deep_layer ().derived ())); + } + const db::DeepLayer &edges = merged_deep_layer (); DeepLayer dl_out (edges.derived ()); diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 50173c49e..68146b114 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -797,6 +797,10 @@ DeepRegion::and_with (const Region &other, PropertyConstraint property_constrain return AsIfFlatRegion::and_with (other, property_constraint); + } else if (other_deep->deep_layer () == deep_layer ()) { + + return clone ()->remove_properties (pc_remove (property_constraint)); + } else { return new DeepRegion (and_or_not_with (other_deep, true, property_constraint)); @@ -817,6 +821,10 @@ DeepRegion::not_with (const Region &other, PropertyConstraint property_constrain return AsIfFlatRegion::not_with (other, property_constraint); + } else if (other_deep->deep_layer () == deep_layer ()) { + + return new DeepRegion (deep_layer ().derived ()); + } else { return new DeepRegion (and_or_not_with (other_deep, false, property_constraint)); @@ -827,6 +835,11 @@ DeepRegion::not_with (const Region &other, PropertyConstraint property_constrain RegionDelegate * DeepRegion::or_with (const Region &other, db::PropertyConstraint /*property_constraint*/) const { + const DeepRegion *other_deep = dynamic_cast (other.delegate ()); + if (other_deep && other_deep->deep_layer () == deep_layer ()) { + return clone (); + } + // TODO: implement property_constraint RegionDelegate *res = add (other); return res->merged_in_place (); @@ -849,6 +862,10 @@ DeepRegion::andnot_with (const Region &other, PropertyConstraint property_constr return AsIfFlatRegion::andnot_with (other, property_constraint); + } else if (other_deep->deep_layer () == deep_layer ()) { + + return std::make_pair (clone ()->remove_properties (pc_remove (property_constraint)), new DeepRegion (deep_layer ().derived ())); + } else { std::pair res = and_and_not_with (other_deep, property_constraint); @@ -962,6 +979,10 @@ DeepRegion::xor_with (const Region &other, db::PropertyConstraint property_const return AsIfFlatRegion::xor_with (other, property_constraint); + } else if (other_deep->deep_layer () == deep_layer ()) { + + return new DeepRegion (deep_layer ().derived ()); + } else { // Implement XOR as (A-B)+(B-A) - only this implementation @@ -2127,6 +2148,16 @@ DeepRegion::in_and_out_generic (const Region &other, InteractingOutputMode outpu other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer ()) { + if (output_mode == PositiveAndNegative) { + return std::make_pair (clone (), new DeepRegion (deep_layer ().derived ())); + } else if (output_mode == Negative) { + return std::make_pair (new DeepRegion (deep_layer ().derived ()), (RegionDelegate *) 0); + } else { + return std::make_pair (clone (), (RegionDelegate *) 0); + } + } + const db::DeepLayer &polygons = merged_deep_layer (); const db::DeepLayer &other_polygons = other_deep->merged_deep_layer (); @@ -2188,6 +2219,26 @@ DeepRegion::selected_interacting_generic (const Region &other, int mode, bool to other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer () && !counting) { + if (mode <= 0 /*inside or interacting*/) { + if (output_mode == PositiveAndNegative) { + return std::make_pair (clone (), new DeepRegion (deep_layer ().derived ())); + } else if (output_mode == Negative) { + return std::make_pair (new DeepRegion (deep_layer ().derived ()), (RegionDelegate *) 0); + } else { + return std::make_pair (clone (), (RegionDelegate *) 0); + } + } else { + if (output_mode == PositiveAndNegative) { + return std::make_pair (new DeepRegion (deep_layer ().derived ()), clone ()); + } else if (output_mode == Negative) { + return std::make_pair (clone (), (RegionDelegate *) 0); + } else { + return std::make_pair (new DeepRegion (deep_layer ().derived ()), (RegionDelegate *) 0); + } + } + } + const db::DeepLayer &polygons = merged_deep_layer (); // NOTE: with counting, the other polygons must be merged const db::DeepLayer &other_polygons = counting ? other_deep->merged_deep_layer () : other_deep->deep_layer (); @@ -2205,7 +2256,13 @@ DeepRegion::selected_interacting_generic (const Region &other, int mode, bool to bool result_is_merged = (! split_after && (merged_semantics () || is_merged ())); InteractingResultHolder orh (output_mode, result_is_merged, polygons); - proc.run (&op, polygons.layer (), other_polygons.layer (), orh.layers ()); + if (polygons == other_polygons) { + // with counting and two identical inputs we need to create a layer copy + db::DeepLayer other_copy (other_polygons.copy ()); + proc.run (&op, polygons.layer (), other_copy.layer (), orh.layers ()); + } else { + proc.run (&op, polygons.layer (), other_polygons.layer (), orh.layers ()); + } return orh.result_pair (); } @@ -2285,6 +2342,10 @@ DeepRegion::pull_generic (const Region &other, int mode, bool touching) const other_deep = dr_holder.get (); } + if (deep_layer () == other_deep->deep_layer ()) { + return clone (); + } + // in "inside" mode, the first argument needs to be merged too const db::DeepLayer &polygons = mode < 0 ? merged_deep_layer () : deep_layer (); const db::DeepLayer &other_polygons = other_deep->merged_deep_layer (); diff --git a/src/db/unit_tests/dbDeepEdgesTests.cc b/src/db/unit_tests/dbDeepEdgesTests.cc index 7d992997e..381ae4fc7 100644 --- a/src/db/unit_tests/dbDeepEdgesTests.cc +++ b/src/db/unit_tests/dbDeepEdgesTests.cc @@ -1505,6 +1505,55 @@ TEST(22_InteractingWithCount) EXPECT_EQ (db::compare (e.selected_interacting_differential (r2, size_t (2), size_t(3)).second, "(0,0;200,0)"), true); } +TEST(23_SameInputs) +{ + db::Layout ly; + { + std::string fn (tl::testdata ()); + fn += "/algo/deep_region_l1.gds"; + tl::InputStream stream (fn); + db::Reader reader (stream); + reader.read (ly); + } + + db::cell_index_type top_cell_index = *ly.begin_top_down (); + db::Cell &top_cell = ly.cell (top_cell_index); + + db::DeepShapeStore dss; + + unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); + db::Edges e2 = db::Edges ((db::Region (db::RecursiveShapeIterator (ly, top_cell, l2), dss)).edges ()); + + EXPECT_EQ ((e2 & e2).to_string (), e2.to_string ()); + EXPECT_EQ ((e2 - e2).to_string (), ""); + EXPECT_EQ (e2.andnot (e2).first.to_string (), e2.to_string ()); + EXPECT_EQ (e2.andnot (e2).second.to_string (), ""); + EXPECT_EQ ((e2 | e2).to_string (), e2.to_string ()); + EXPECT_EQ ((e2 ^ e2).to_string (), ""); + EXPECT_EQ (e2.in (e2).to_string (), e2.to_string ()); + EXPECT_EQ (e2.in (e2, true).to_string (), ""); + EXPECT_EQ (e2.in_and_out (e2).first.to_string (), e2.to_string ()); + EXPECT_EQ (e2.in_and_out (e2).second.to_string (), ""); + EXPECT_EQ (e2.selected_interacting (e2).to_string (), e2.to_string ()); + EXPECT_EQ (e2.selected_not_interacting (e2).to_string (), ""); + EXPECT_EQ (e2.selected_interacting_differential (e2).first.to_string (), e2.to_string ()); + EXPECT_EQ (e2.selected_interacting_differential (e2).second.to_string (), ""); + EXPECT_EQ ((e2.selected_interacting (e2, (size_t) 1, (size_t) 3) ^ e2).to_string (), ""); + EXPECT_EQ ((e2.selected_interacting_differential (e2, (size_t) 1, (size_t) 3).first ^ e2).to_string (), ""); + EXPECT_EQ (e2.selected_interacting_differential (e2, (size_t) 1, (size_t) 3).second.to_string (), ""); + EXPECT_EQ (e2.selected_interacting (e2, (size_t) 4).to_string (), ""); + EXPECT_EQ (e2.selected_interacting_differential (e2, (size_t) 4).first.to_string (), ""); + EXPECT_EQ ((e2.selected_interacting_differential (e2, (size_t) 4).second ^ e2).to_string (), ""); + EXPECT_EQ (e2.selected_inside (e2).to_string (), e2.to_string ()); + EXPECT_EQ (e2.selected_not_inside (e2).to_string (), ""); + EXPECT_EQ (e2.selected_inside_differential (e2).first.to_string (), e2.to_string ()); + EXPECT_EQ (e2.selected_inside_differential (e2).second.to_string (), ""); + EXPECT_EQ (e2.selected_outside (e2).to_string (), ""); + EXPECT_EQ (e2.selected_not_outside (e2).to_string (), e2.to_string ()); + EXPECT_EQ (e2.selected_outside_differential (e2).first.to_string (), ""); + EXPECT_EQ (e2.selected_outside_differential (e2).second.to_string (), e2.to_string ()); + EXPECT_EQ (e2.pull_interacting (e2).to_string (), e2.to_string ()); +} TEST(deep_edges_and_cheats) { diff --git a/src/db/unit_tests/dbDeepRegionTests.cc b/src/db/unit_tests/dbDeepRegionTests.cc index 68c787fb8..9212846a5 100644 --- a/src/db/unit_tests/dbDeepRegionTests.cc +++ b/src/db/unit_tests/dbDeepRegionTests.cc @@ -2666,16 +2666,47 @@ TEST(102_SameInputs) db::DeepShapeStore dss; unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0)); - unsigned int l3 = ly.get_layer (db::LayerProperties (3, 0)); - db::Region r2 (db::RecursiveShapeIterator (ly, top_cell, l2), dss); - db::Region r3 (db::RecursiveShapeIterator (ly, top_cell, l3), dss); - EXPECT_EQ ((r2 & r2).to_string (), "..."); - EXPECT_EQ ((r2 - r2).to_string (), "..."); - EXPECT_EQ ((r2 | r2).to_string (), "..."); - EXPECT_EQ ((r2 ^ r2).to_string (), "..."); - EXPECT_EQ ((r2 + r2).to_string (), "..."); + EXPECT_EQ ((r2 & r2).to_string (), r2.to_string ()); + EXPECT_EQ ((r2 - r2).to_string (), ""); + EXPECT_EQ (r2.andnot (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.andnot (r2).second.to_string (), ""); + EXPECT_EQ ((r2 | r2).to_string (), r2.to_string ()); + EXPECT_EQ ((r2 ^ r2).to_string (), ""); + EXPECT_EQ (r2.in (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.in (r2, true).to_string (), ""); + EXPECT_EQ (r2.in_and_out (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.in_and_out (r2).second.to_string (), ""); + EXPECT_EQ (r2.selected_enclosing (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_not_enclosing (r2).to_string (), ""); + EXPECT_EQ (r2.selected_enclosing_differential (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_enclosing_differential (r2).second.to_string (), ""); + EXPECT_EQ (r2.selected_interacting (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_not_interacting (r2).to_string (), ""); + EXPECT_EQ (r2.selected_interacting_differential (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_interacting_differential (r2).second.to_string (), ""); + EXPECT_EQ (r2.selected_interacting (r2, (size_t) 1, (size_t) 2).to_string (), r2.merged ().to_string ()); + EXPECT_EQ (r2.selected_interacting_differential (r2, (size_t) 1, (size_t) 2).first.to_string (), r2.merged ().to_string ()); + EXPECT_EQ (r2.selected_interacting_differential (r2, (size_t) 1, (size_t) 2).second.to_string (), ""); + EXPECT_EQ (r2.selected_interacting (r2, (size_t) 2).to_string (), ""); + EXPECT_EQ (r2.selected_interacting_differential (r2, (size_t) 2).first.to_string (), ""); + EXPECT_EQ (r2.selected_interacting_differential (r2, (size_t) 2).second.to_string (), r2.merged ().to_string ()); + EXPECT_EQ (r2.selected_inside (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_not_inside (r2).to_string (), ""); + EXPECT_EQ (r2.selected_inside_differential (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_inside_differential (r2).second.to_string (), ""); + EXPECT_EQ (r2.selected_outside (r2).to_string (), ""); + EXPECT_EQ (r2.selected_not_outside (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_outside_differential (r2).first.to_string (), ""); + EXPECT_EQ (r2.selected_outside_differential (r2).second.to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_overlapping (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_not_overlapping (r2).to_string (), ""); + EXPECT_EQ (r2.selected_overlapping_differential (r2).first.to_string (), r2.to_string ()); + EXPECT_EQ (r2.selected_overlapping_differential (r2).second.to_string (), ""); + EXPECT_EQ (r2.pull_inside (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.pull_overlapping (r2).to_string (), r2.to_string ()); + EXPECT_EQ (r2.pull_interacting (r2).to_string (), r2.to_string ()); } TEST(issue_277) From 4cacb60f26beb7656d2b9eb02381426a27d23c3a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 19:55:16 +0100 Subject: [PATCH 58/79] Fixed an issue with property constraints --- src/db/db/dbDeepRegion.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 68146b114..d52df7f9c 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -797,9 +797,9 @@ DeepRegion::and_with (const Region &other, PropertyConstraint property_constrain return AsIfFlatRegion::and_with (other, property_constraint); - } else if (other_deep->deep_layer () == deep_layer ()) { + } else if (other_deep->deep_layer () == deep_layer () && pc_skip (property_constraint)) { - return clone ()->remove_properties (pc_remove (property_constraint)); + return clone (); } else { @@ -821,7 +821,7 @@ DeepRegion::not_with (const Region &other, PropertyConstraint property_constrain return AsIfFlatRegion::not_with (other, property_constraint); - } else if (other_deep->deep_layer () == deep_layer ()) { + } else if (other_deep->deep_layer () == deep_layer () && pc_skip (property_constraint)) { return new DeepRegion (deep_layer ().derived ()); @@ -833,10 +833,10 @@ DeepRegion::not_with (const Region &other, PropertyConstraint property_constrain } RegionDelegate * -DeepRegion::or_with (const Region &other, db::PropertyConstraint /*property_constraint*/) const +DeepRegion::or_with (const Region &other, db::PropertyConstraint property_constraint) const { const DeepRegion *other_deep = dynamic_cast (other.delegate ()); - if (other_deep && other_deep->deep_layer () == deep_layer ()) { + if (other_deep && other_deep->deep_layer () == deep_layer () && pc_skip (property_constraint)) { return clone (); } @@ -862,9 +862,9 @@ DeepRegion::andnot_with (const Region &other, PropertyConstraint property_constr return AsIfFlatRegion::andnot_with (other, property_constraint); - } else if (other_deep->deep_layer () == deep_layer ()) { + } else if (other_deep->deep_layer () == deep_layer () && pc_skip (property_constraint)) { - return std::make_pair (clone ()->remove_properties (pc_remove (property_constraint)), new DeepRegion (deep_layer ().derived ())); + return std::make_pair (clone (), new DeepRegion (deep_layer ().derived ())); } else { @@ -979,7 +979,7 @@ DeepRegion::xor_with (const Region &other, db::PropertyConstraint property_const return AsIfFlatRegion::xor_with (other, property_constraint); - } else if (other_deep->deep_layer () == deep_layer ()) { + } else if (other_deep->deep_layer () == deep_layer () && pc_skip (property_constraint)) { return new DeepRegion (deep_layer ().derived ()); From 54273206a750404c0f61bf4f6c721b27a9b0eb63 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 20:18:38 +0100 Subject: [PATCH 59/79] More robust tests --- src/db/unit_tests/dbEdgesTests.cc | 64 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/db/unit_tests/dbEdgesTests.cc b/src/db/unit_tests/dbEdgesTests.cc index 97f0d890c..d9cb66589 100644 --- a/src/db/unit_tests/dbEdgesTests.cc +++ b/src/db/unit_tests/dbEdgesTests.cc @@ -1199,30 +1199,30 @@ TEST(30) db::Edges edup; - EXPECT_EQ (e.selected_interacting (e2).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2), size_t(2)).to_string (), "(0,10;200,10)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (2), size_t(3)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (3)).to_string (), "(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (e2, size_t (4)).to_string (), ""); + EXPECT_EQ (db::compare (e.selected_interacting (e2), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2), size_t(2)), "(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (2), size_t(3)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (3)), "(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (e2, size_t (4)), ""), true); edup = e; edup.select_interacting (e2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (edup, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); - EXPECT_EQ (e.selected_not_interacting (e2).to_string (), ""); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2), size_t(2)).to_string (), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (2), size_t(3)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (3)).to_string (), "(0,0;200,0);(0,10;200,10)"); - EXPECT_EQ (e.selected_not_interacting (e2, size_t (4)).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2), ""), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2), size_t(2)), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (2), size_t(3)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (3)), "(0,0;200,0);(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (e2, size_t (4)), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); edup = e; edup.select_not_interacting (e2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (edup, "(0,0;200,0)"), true); - EXPECT_EQ (e.selected_interacting_differential (e2, size_t (2), size_t(3)).first.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting_differential (e2, size_t (2), size_t(3)).second.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (e.selected_interacting_differential (e2, size_t (2), size_t(3)).first, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting_differential (e2, size_t (2), size_t(3)).second, "(0,0;200,0)"), true); db::Region r2; r2.insert (db::Box (db::Point (99, 0), db::Point (101, 10))); @@ -1231,30 +1231,30 @@ TEST(30) r2.insert (db::Box (db::Point (119, 19), db::Point (121, 21))); r2.insert (db::Box (db::Point (129, 29), db::Point (131, 31))); - EXPECT_EQ (e.selected_interacting (r2).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2), size_t(2)).to_string (), "(0,10;200,10)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (2), size_t(3)).to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (3)).to_string (), "(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting (r2, size_t (4)).to_string (), ""); + EXPECT_EQ (db::compare (e.selected_interacting (r2), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2), size_t(2)), "(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (2), size_t(3)), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (3)), "(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting (r2, size_t (4)), ""), true); edup = e; edup.select_interacting (r2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (edup, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); - EXPECT_EQ (e.selected_not_interacting (r2).to_string (), ""); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2), size_t(2)).to_string (), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (2), size_t(3)).to_string (), "(0,0;200,0)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (3)).to_string (), "(0,0;200,0);(0,10;200,10)"); - EXPECT_EQ (e.selected_not_interacting (r2, size_t (4)).to_string (), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2), ""), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2), size_t(2)), "(0,0;200,0);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (2), size_t(3)), "(0,0;200,0)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (3)), "(0,0;200,0);(0,10;200,10)"), true); + EXPECT_EQ (db::compare (e.selected_not_interacting (r2, size_t (4)), "(0,0;200,0);(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); edup = e; edup.select_not_interacting (r2, size_t (2), size_t(3)); - EXPECT_EQ (edup.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (edup, "(0,0;200,0)"), true); - EXPECT_EQ (e.selected_interacting_differential (r2, size_t (2), size_t(3)).first.to_string (), "(0,10;200,10);(0,20;200,20);(0,30;200,30)"); - EXPECT_EQ (e.selected_interacting_differential (r2, size_t (2), size_t(3)).second.to_string (), "(0,0;200,0)"); + EXPECT_EQ (db::compare (e.selected_interacting_differential (r2, size_t (2), size_t(3)).first, "(0,10;200,10);(0,20;200,20);(0,30;200,30)"), true); + EXPECT_EQ (db::compare (e.selected_interacting_differential (r2, size_t (2), size_t(3)).second, "(0,0;200,0)"), true); } // borrowed from deep edges tests From 97a33f8d66ad2af464de2e9f3823438b79415289 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 20:28:41 +0100 Subject: [PATCH 60/79] Trying to fix a linker issue on MSYS --- src/tl/tl/tlStream.cc | 5 +++++ src/tl/tl/tlStream.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tl/tl/tlStream.cc b/src/tl/tl/tlStream.cc index 4ffc2d43e..751c4841d 100644 --- a/src/tl/tl/tlStream.cc +++ b/src/tl/tl/tlStream.cc @@ -47,6 +47,7 @@ #include "tlException.h" #include "tlString.h" #include "tlUri.h" +#include "tlHttpStream.h" #if defined(HAVE_QT) # include @@ -259,6 +260,10 @@ inflating_input_stream::auto_detect_gz () return true; } +// explicit instantiations +template class inflating_input_stream; +template class inflating_input_stream; + // --------------------------------------------------------------- // InputStream implementation diff --git a/src/tl/tl/tlStream.h b/src/tl/tl/tlStream.h index 4e7cfdcf6..c738c84ff 100644 --- a/src/tl/tl/tlStream.h +++ b/src/tl/tl/tlStream.h @@ -590,7 +590,7 @@ private: * @brief A wrapper that adds generic .gz support */ template -class TL_PUBLIC_TEMPLATE inflating_input_stream +class TL_PUBLIC inflating_input_stream : public InputStreamBase { public: From e2df385f2dc893895cbd2cc4face057ce6236f0f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 11:05:48 +0100 Subject: [PATCH 61/79] First version of fix for issue-1638 (let klayout marker browser read strmxor .. xor.gds.gz, xor.oas result files) --- src/db/db/dbStream.cc | 36 +++ src/db/db/dbStream.h | 5 + src/lay/lay/layMainWindow.cc | 31 +-- src/layui/layui/rdbMarkerBrowserDialog.cc | 285 ++++++++++++---------- src/layui/layui/rdbMarkerBrowserDialog.h | 10 + 5 files changed, 214 insertions(+), 153 deletions(-) diff --git a/src/db/db/dbStream.cc b/src/db/db/dbStream.cc index 3d7cf935d..878198943 100644 --- a/src/db/db/dbStream.cc +++ b/src/db/db/dbStream.cc @@ -30,6 +30,42 @@ namespace db { +// ------------------------------------------------------------------ +// Implementation of StreamFormatDeclaration + +std::string StreamFormatDeclaration::all_formats_string () +{ + std::string fmts = tl::to_string (tr ("All layout files (")); + + for (tl::Registrar::iterator rdr = tl::Registrar::begin (); rdr != tl::Registrar::end (); ++rdr) { + if (rdr != tl::Registrar::begin ()) { + fmts += " "; + } + std::string f = rdr->file_format (); + if (!f.empty ()) { + const char *fp = f.c_str (); + while (*fp && *fp != '(') { + ++fp; + } + if (*fp) { + ++fp; + } + while (*fp && *fp != ')') { + fmts += *fp++; + } + } + } + fmts += ")"; + for (tl::Registrar::iterator rdr = tl::Registrar::begin (); rdr != tl::Registrar::end (); ++rdr) { + if (!rdr->file_format ().empty ()) { + fmts += ";;"; + fmts += rdr->file_format (); + } + } + + return fmts; +} + // ------------------------------------------------------------------ // Implementation of load_options_xml_element_list diff --git a/src/db/db/dbStream.h b/src/db/db/dbStream.h index 06ce1755d..97dfee6ef 100644 --- a/src/db/db/dbStream.h +++ b/src/db/db/dbStream.h @@ -136,6 +136,11 @@ public: { return 0; } + + /** + * @brief Returns a string for the file dialogs that describes all formats + */ + static std::string all_formats_string (); }; /** diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 0eb2eb397..bda513a58 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -498,34 +498,9 @@ MainWindow::~MainWindow () std::string MainWindow::all_layout_file_formats () const { - std::string fmts = tl::to_string (QObject::tr ("All layout files (")); - for (tl::Registrar::iterator rdr = tl::Registrar::begin (); rdr != tl::Registrar::end (); ++rdr) { - if (rdr != tl::Registrar::begin ()) { - fmts += " "; - } - std::string f = rdr->file_format (); - if (!f.empty ()) { - const char *fp = f.c_str (); - while (*fp && *fp != '(') { - ++fp; - } - if (*fp) { - ++fp; - } - while (*fp && *fp != ')') { - fmts += *fp++; - } - } - } - fmts += ");;"; - for (tl::Registrar::iterator rdr = tl::Registrar::begin (); rdr != tl::Registrar::end (); ++rdr) { - if (!rdr->file_format ().empty ()) { - fmts += rdr->file_format (); - fmts += ";;"; - } - } - fmts += tl::to_string (QObject::tr ("All files (*)")); - + std::string fmts = db::StreamFormatDeclaration::all_formats_string (); + fmts += ";;"; + fmts += tl::to_string (tr ("All files (*)")); return fmts; } diff --git a/src/layui/layui/rdbMarkerBrowserDialog.cc b/src/layui/layui/rdbMarkerBrowserDialog.cc index 459803767..7502734ad 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.cc +++ b/src/layui/layui/rdbMarkerBrowserDialog.cc @@ -35,6 +35,7 @@ #include "layConfigurationDialog.h" #include "dbLayoutUtils.h" #include "dbRecursiveShapeIterator.h" +#include "dbStream.h" #include "ui_MarkerBrowserDialog.h" @@ -412,6 +413,26 @@ BEGIN_PROTECTED END_PROTECTED } +void +MarkerBrowserDialog::read_db_from_layout (rdb::Database *db, const std::string &filename) +{ + // try reading a layout file + db::Layout layout; + tl::InputStream is (m_open_filename); + db::Reader reader (is); + + reader.read (layout); + + std::vector > layers; + for (auto l = layout.begin_layers (); l != layout.end_layers (); ++l) { + layers.push_back (std::make_pair ((*l).first, std::string ())); + } + + if (layout.begin_top_down () != layout.end_top_down ()) { + scan_layout (db, layout, *layout.begin_top_down (), layers, false /*hierarchical*/); + } +} + void MarkerBrowserDialog::open_clicked () { @@ -420,15 +441,34 @@ BEGIN_PROTECTED // collect the formats available ... std::string fmts = tl::to_string (QObject::tr ("All files (*)")); for (tl::Registrar::iterator rdr = tl::Registrar::begin (); rdr != tl::Registrar::end (); ++rdr) { - fmts += ";;" + rdr->file_format (); + fmts += ";;"; + fmts += rdr->file_format (); } + // also provide the stream formats + fmts += ";;"; + fmts += db::StreamFormatDeclaration::all_formats_string (); + // prepare and open the file dialog lay::FileDialog open_dialog (this, tl::to_string (QObject::tr ("Load Marker Database File")), fmts); + if (open_dialog.get_open (m_open_filename)) { std::unique_ptr db (new rdb::Database ()); - db->load (m_open_filename); + + bool ok = false; + try { + // try reading a stream file + read_db_from_layout (db.get (), m_open_filename); + ok = true; + } catch (tl::Exception &ex) { + // continue + } + + if (! ok) { + // try reading database directly. + db->load (m_open_filename); + } int rdb_index = view ()->add_rdb (db.release ()); mp_ui->rdb_cb->setCurrentIndex (rdb_index); @@ -731,111 +771,17 @@ MarkerBrowserDialog::deactivated () void MarkerBrowserDialog::scan_layer () { - std::vector layers = view ()->selected_layers (); - if (layers.empty ()) { - throw tl::Exception (tl::to_string (QObject::tr ("No layer selected to get shapes from"))); - } - - int cv_index = -1; - for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { - if (!(*l)->has_children ()) { - if (cv_index < 0) { - cv_index = (*l)->cellview_index (); - } else if ((*l)->cellview_index () >= 0) { - if (cv_index != (*l)->cellview_index ()) { - throw tl::Exception (tl::to_string (QObject::tr ("All layers must originate from the same layout"))); - } - } - } - } - - if (cv_index < 0) { - throw tl::Exception (tl::to_string (QObject::tr ("No valid layer selected"))); - } - - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Shapes To Markers")), 10000); - progress.set_format (tl::to_string (QObject::tr ("%.0f0000 markers"))); - progress.set_unit (10000); - - const lay::CellView &cv = view ()->cellview (cv_index); - const db::Layout &layout = cv->layout (); - - std::unique_ptr rdb (new rdb::Database ()); - rdb->set_name ("Shapes"); - rdb->set_top_cell_name (layout.cell_name (cv.cell_index ())); - rdb::Cell *rdb_top_cell = rdb->create_cell (rdb->top_cell_name ()); - - std::string desc; - for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { - if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) { - if (! desc.empty ()) { - desc += ", "; - } - desc += layout.get_properties ((*l)->layer_index ()).to_string (); - } - } - desc = tl::to_string (tr ("Hierarchical shapes of layer(s) ")) + desc; - desc += " "; - desc += tl::to_string (tr ("from cell ")); - desc += cv->layout ().cell_name (cv.cell_index ()); - rdb->set_description (desc); - - std::set called_cells; - called_cells.insert (cv.cell_index ()); - cv->layout ().cell (cv.cell_index ()).collect_called_cells (called_cells); - - for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { - - if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) { - - rdb::Category *cat = rdb->create_category (layout.get_properties ((*l)->layer_index ()).to_string ()); - - for (db::Layout::const_iterator cid = layout.begin (); cid != layout.end (); ++cid) { - - if (called_cells.find (cid->cell_index ()) == called_cells.end ()) { - continue; - } - - const db::Cell &cell = *cid; - if (cell.shapes ((*l)->layer_index ()).size () > 0) { - - std::string cn = layout.cell_name (cell.cell_index ()); - const rdb::Cell *rdb_cell = rdb->cell_by_qname (cn); - if (! rdb_cell) { - - rdb::Cell *rdb_cell_nc = rdb->create_cell (cn); - rdb_cell = rdb_cell_nc; - - std::pair ctx = db::find_layout_context (layout, cell.cell_index (), cv.cell_index ()); - if (ctx.first) { - db::DCplxTrans t = db::DCplxTrans (layout.dbu ()) * db::DCplxTrans (ctx.second) * db::DCplxTrans (1.0 / layout.dbu ()); - rdb_cell_nc->references ().insert (Reference (t, rdb_top_cell->id ())); - } - - } - - for (db::ShapeIterator shape = cell.shapes ((*l)->layer_index ()).begin (db::ShapeIterator::All); ! shape.at_end (); ++shape) { - - rdb::create_item_from_shape (rdb.get (), rdb_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()), *shape); - - ++progress; - - } - - } - - } - - } - - } - - unsigned int rdb_index = view ()->add_rdb (rdb.release ()); - view ()->open_rdb_browser (rdb_index, cv_index); + scan_layer_flat_or_hierarchical (false); } -void +void MarkerBrowserDialog::scan_layer_flat () +{ + scan_layer_flat_or_hierarchical (true); +} + +void +MarkerBrowserDialog::scan_layer_flat_or_hierarchical (bool flat) { std::vector layers = view ()->selected_layers (); if (layers.empty ()) { @@ -859,43 +805,87 @@ MarkerBrowserDialog::scan_layer_flat () throw tl::Exception (tl::to_string (QObject::tr ("No valid layer selected"))); } + const lay::CellView &cv = view ()->cellview (cv_index); + const db::Layout &layout = cv->layout (); + + std::vector > layer_indexes; + for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { + if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) { + layer_indexes.push_back (std::make_pair ((*l)->layer_index (), (*l)->name ())); + } + } + + std::unique_ptr rdb (new rdb::Database ()); + + scan_layout (rdb.get (), layout, cv.cell_index (), layer_indexes, flat); + + unsigned int rdb_index = view ()->add_rdb (rdb.release ()); + view ()->open_rdb_browser (rdb_index, cv_index); +} + +void +MarkerBrowserDialog::scan_layout (rdb::Database *rdb, const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat) +{ tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Shapes To Markers")), 10000); progress.set_format (tl::to_string (QObject::tr ("%.0f0000 markers"))); progress.set_unit (10000); - const lay::CellView &cv = view ()->cellview (cv_index); - const db::Layout &layout = cv->layout (); - - std::unique_ptr rdb (new rdb::Database ()); rdb->set_name ("Shapes"); - rdb->set_top_cell_name (layout.cell_name (cv.cell_index ())); + rdb->set_top_cell_name (layout.cell_name (cell_index)); rdb::Cell *rdb_top_cell = rdb->create_cell (rdb->top_cell_name ()); std::string desc; - for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { - if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) { - if (! desc.empty ()) { - desc += ", "; - } - desc += layout.get_properties ((*l)->layer_index ()).to_string (); + + if (layers_and_descriptions.size () == 1) { + + if (flat) { + desc = tl::to_string (tr ("Flat shapes of layer ")); + } else { + desc = tl::to_string (tr ("Hierarchical shapes of layer ")); } + + desc += layout.get_properties (layers_and_descriptions.front ().first).to_string (); + + } else if (layers_and_descriptions.size () < 4 && layers_and_descriptions.size () > 0) { + + if (flat) { + desc = tl::to_string (tr ("Flat shapes of layers ")); + } else { + desc = tl::to_string (tr ("Hierarchical shapes of layers ")); + } + + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { + if (l != layers_and_descriptions.begin ()) { + desc += ","; + } + desc += layout.get_properties (l->first).to_string (); + } + + } else { + + if (flat) { + desc = tl::sprintf (tl::to_string (tr ("Flat shapes of %d layers")), int (layers_and_descriptions.size ())); + } else { + desc = tl::sprintf (tl::to_string (tr ("Hierarchical shapes of %d layers")), int (layers_and_descriptions.size ())); + } + } - desc = tl::to_string (tr ("Flat shapes of layer(s) ")) + desc; + desc += " "; desc += tl::to_string (tr ("from cell ")); - desc += cv->layout ().cell_name (cv.cell_index ()); + desc += layout.cell_name (cell_index); rdb->set_description (desc); - for (std::vector::const_iterator l = layers.begin (); l != layers.end (); ++l) { + if (flat) { - if (!(*l)->has_children () && (*l)->cellview_index () == cv_index && layout.is_valid_layer ((*l)->layer_index ())) { + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { - rdb::Category *cat = rdb->create_category (layout.get_properties ((*l)->layer_index ()).to_string ()); + rdb::Category *cat = rdb->create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); - db::RecursiveShapeIterator shape (layout, *cv.cell (), (*l)->layer_index ()); + db::RecursiveShapeIterator shape (layout, layout.cell (cell_index), l->first); while (! shape.at_end ()) { - rdb::create_item_from_shape (rdb.get (), rdb_top_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()) * shape.trans (), *shape); + rdb::create_item_from_shape (rdb, rdb_top_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()) * shape.trans (), *shape); ++progress; ++shape; @@ -904,10 +894,55 @@ MarkerBrowserDialog::scan_layer_flat () } - } + } else { - unsigned int rdb_index = view ()->add_rdb (rdb.release ()); - view ()->open_rdb_browser (rdb_index, cv_index); + std::set called_cells; + called_cells.insert (cell_index); + layout.cell (cell_index).collect_called_cells (called_cells); + + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { + + rdb::Category *cat = rdb->create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); + + for (db::Layout::const_iterator cid = layout.begin (); cid != layout.end (); ++cid) { + + if (called_cells.find (cid->cell_index ()) == called_cells.end ()) { + continue; + } + + const db::Cell &cell = *cid; + if (! cell.shapes (l->first).empty ()) { + + std::string cn = layout.cell_name (cell.cell_index ()); + const rdb::Cell *rdb_cell = rdb->cell_by_qname (cn); + if (! rdb_cell) { + + rdb::Cell *rdb_cell_nc = rdb->create_cell (cn); + rdb_cell = rdb_cell_nc; + + std::pair ctx = db::find_layout_context (layout, cell.cell_index (), cell_index); + if (ctx.first) { + db::DCplxTrans t = db::DCplxTrans (layout.dbu ()) * db::DCplxTrans (ctx.second) * db::DCplxTrans (1.0 / layout.dbu ()); + rdb_cell_nc->references ().insert (Reference (t, rdb_top_cell->id ())); + } + + } + + for (db::ShapeIterator shape = cell.shapes (l->first).begin (db::ShapeIterator::All); ! shape.at_end (); ++shape) { + + rdb::create_item_from_shape (rdb, rdb_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()), *shape); + + ++progress; + + } + + } + + } + + } + + } } void diff --git a/src/layui/layui/rdbMarkerBrowserDialog.h b/src/layui/layui/rdbMarkerBrowserDialog.h index 7988d6070..3b50f1fa7 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.h +++ b/src/layui/layui/rdbMarkerBrowserDialog.h @@ -36,9 +36,16 @@ namespace Ui class MarkerBrowserDialog; } +namespace db +{ + class Layout; +} + namespace rdb { +class Database; + class LAYUI_PUBLIC MarkerBrowserDialog : public lay::Browser { @@ -101,6 +108,9 @@ private: void update_content (); void scan_layer (); void scan_layer_flat (); + void scan_layer_flat_or_hierarchical (bool flat); + void scan_layout (rdb::Database *db, const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat); + void read_db_from_layout (rdb::Database *db, const std::string &filename); }; } From 8a0a6cad04ea80e77f0504c5cc672283051f217d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 11:29:18 +0100 Subject: [PATCH 62/79] Refactoring solution such that loading a layout file into a marker database also works from command line (-m) and scripts --- src/layui/layui/rdbMarkerBrowserDialog.cc | 159 +------------------- src/layui/layui/rdbMarkerBrowserDialog.h | 2 - src/rdb/rdb/rdb.cc | 170 +++++++++++++++++++++- src/rdb/rdb/rdb.h | 11 ++ 4 files changed, 179 insertions(+), 163 deletions(-) diff --git a/src/layui/layui/rdbMarkerBrowserDialog.cc b/src/layui/layui/rdbMarkerBrowserDialog.cc index 7502734ad..800025a13 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.cc +++ b/src/layui/layui/rdbMarkerBrowserDialog.cc @@ -413,26 +413,6 @@ BEGIN_PROTECTED END_PROTECTED } -void -MarkerBrowserDialog::read_db_from_layout (rdb::Database *db, const std::string &filename) -{ - // try reading a layout file - db::Layout layout; - tl::InputStream is (m_open_filename); - db::Reader reader (is); - - reader.read (layout); - - std::vector > layers; - for (auto l = layout.begin_layers (); l != layout.end_layers (); ++l) { - layers.push_back (std::make_pair ((*l).first, std::string ())); - } - - if (layout.begin_top_down () != layout.end_top_down ()) { - scan_layout (db, layout, *layout.begin_top_down (), layers, false /*hierarchical*/); - } -} - void MarkerBrowserDialog::open_clicked () { @@ -455,20 +435,7 @@ BEGIN_PROTECTED if (open_dialog.get_open (m_open_filename)) { std::unique_ptr db (new rdb::Database ()); - - bool ok = false; - try { - // try reading a stream file - read_db_from_layout (db.get (), m_open_filename); - ok = true; - } catch (tl::Exception &ex) { - // continue - } - - if (! ok) { - // try reading database directly. - db->load (m_open_filename); - } + db->load (m_open_filename); int rdb_index = view ()->add_rdb (db.release ()); mp_ui->rdb_cb->setCurrentIndex (rdb_index); @@ -817,134 +784,12 @@ MarkerBrowserDialog::scan_layer_flat_or_hierarchical (bool flat) std::unique_ptr rdb (new rdb::Database ()); - scan_layout (rdb.get (), layout, cv.cell_index (), layer_indexes, flat); + rdb->scan_layout (layout, cv.cell_index (), layer_indexes, flat); unsigned int rdb_index = view ()->add_rdb (rdb.release ()); view ()->open_rdb_browser (rdb_index, cv_index); } -void -MarkerBrowserDialog::scan_layout (rdb::Database *rdb, const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat) -{ - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Shapes To Markers")), 10000); - progress.set_format (tl::to_string (QObject::tr ("%.0f0000 markers"))); - progress.set_unit (10000); - - rdb->set_name ("Shapes"); - rdb->set_top_cell_name (layout.cell_name (cell_index)); - rdb::Cell *rdb_top_cell = rdb->create_cell (rdb->top_cell_name ()); - - std::string desc; - - if (layers_and_descriptions.size () == 1) { - - if (flat) { - desc = tl::to_string (tr ("Flat shapes of layer ")); - } else { - desc = tl::to_string (tr ("Hierarchical shapes of layer ")); - } - - desc += layout.get_properties (layers_and_descriptions.front ().first).to_string (); - - } else if (layers_and_descriptions.size () < 4 && layers_and_descriptions.size () > 0) { - - if (flat) { - desc = tl::to_string (tr ("Flat shapes of layers ")); - } else { - desc = tl::to_string (tr ("Hierarchical shapes of layers ")); - } - - for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { - if (l != layers_and_descriptions.begin ()) { - desc += ","; - } - desc += layout.get_properties (l->first).to_string (); - } - - } else { - - if (flat) { - desc = tl::sprintf (tl::to_string (tr ("Flat shapes of %d layers")), int (layers_and_descriptions.size ())); - } else { - desc = tl::sprintf (tl::to_string (tr ("Hierarchical shapes of %d layers")), int (layers_and_descriptions.size ())); - } - - } - - desc += " "; - desc += tl::to_string (tr ("from cell ")); - desc += layout.cell_name (cell_index); - rdb->set_description (desc); - - if (flat) { - - for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { - - rdb::Category *cat = rdb->create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); - - db::RecursiveShapeIterator shape (layout, layout.cell (cell_index), l->first); - while (! shape.at_end ()) { - - rdb::create_item_from_shape (rdb, rdb_top_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()) * shape.trans (), *shape); - - ++progress; - ++shape; - - } - - } - - } else { - - std::set called_cells; - called_cells.insert (cell_index); - layout.cell (cell_index).collect_called_cells (called_cells); - - for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { - - rdb::Category *cat = rdb->create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); - - for (db::Layout::const_iterator cid = layout.begin (); cid != layout.end (); ++cid) { - - if (called_cells.find (cid->cell_index ()) == called_cells.end ()) { - continue; - } - - const db::Cell &cell = *cid; - if (! cell.shapes (l->first).empty ()) { - - std::string cn = layout.cell_name (cell.cell_index ()); - const rdb::Cell *rdb_cell = rdb->cell_by_qname (cn); - if (! rdb_cell) { - - rdb::Cell *rdb_cell_nc = rdb->create_cell (cn); - rdb_cell = rdb_cell_nc; - - std::pair ctx = db::find_layout_context (layout, cell.cell_index (), cell_index); - if (ctx.first) { - db::DCplxTrans t = db::DCplxTrans (layout.dbu ()) * db::DCplxTrans (ctx.second) * db::DCplxTrans (1.0 / layout.dbu ()); - rdb_cell_nc->references ().insert (Reference (t, rdb_top_cell->id ())); - } - - } - - for (db::ShapeIterator shape = cell.shapes (l->first).begin (db::ShapeIterator::All); ! shape.at_end (); ++shape) { - - rdb::create_item_from_shape (rdb, rdb_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()), *shape); - - ++progress; - - } - - } - - } - - } - - } -} - void MarkerBrowserDialog::menu_activated (const std::string &symbol) { diff --git a/src/layui/layui/rdbMarkerBrowserDialog.h b/src/layui/layui/rdbMarkerBrowserDialog.h index 3b50f1fa7..482913f6a 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.h +++ b/src/layui/layui/rdbMarkerBrowserDialog.h @@ -109,8 +109,6 @@ private: void scan_layer (); void scan_layer_flat (); void scan_layer_flat_or_hierarchical (bool flat); - void scan_layout (rdb::Database *db, const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat); - void read_db_from_layout (rdb::Database *db, const std::string &filename); }; } diff --git a/src/rdb/rdb/rdb.cc b/src/rdb/rdb/rdb.cc index 887383198..e219dfc52 100644 --- a/src/rdb/rdb/rdb.cc +++ b/src/rdb/rdb/rdb.cc @@ -23,11 +23,13 @@ #include "rdb.h" #include "rdbReader.h" +#include "rdbUtils.h" #include "tlString.h" #include "tlAssert.h" #include "tlStream.h" #include "tlLog.h" #include "tlBase64.h" +#include "tlProgress.h" #include "dbPolygon.h" #include "dbBox.h" #include "dbEdge.h" @@ -35,6 +37,10 @@ #include "dbPath.h" #include "dbText.h" #include "dbShape.h" +#include "dbLayout.h" +#include "dbLayoutUtils.h" +#include "dbReader.h" +#include "dbRecursiveShapeIterator.h" #if defined(HAVE_QT) # include @@ -1566,16 +1572,49 @@ Database::clear () mp_categories->set_database (this); } +static void +read_db_from_layout (rdb::Database *db, tl::InputStream &is) +{ + // try reading a layout file + db::Layout layout; + db::Reader reader (is); + + reader.read (layout); + + std::vector > layers; + for (auto l = layout.begin_layers (); l != layout.end_layers (); ++l) { + layers.push_back (std::make_pair ((*l).first, std::string ())); + } + + if (layout.begin_top_down () != layout.end_top_down ()) { + db->scan_layout (layout, *layout.begin_top_down (), layers, false /*hierarchical*/); + } +} + void Database::load (const std::string &fn) { tl::log << "Loading RDB from " << fn; - tl::InputStream stream (fn); - rdb::Reader reader (stream); - clear (); - reader.read (*this); + + tl::InputStream stream (fn); + + bool ok = false; + try { + // try reading a stream file + read_db_from_layout (this, stream); + ok = true; + } catch (tl::Exception &) { + stream.reset (); + } + + if (! ok) { + // try reading a DB file + clear (); + rdb::Reader reader (stream); + reader.read (*this); + } set_filename (stream.absolute_path ()); set_name (stream.filename ()); @@ -1587,5 +1626,128 @@ Database::load (const std::string &fn) } } +void +Database::scan_layout (const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat) +{ + tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Shapes To Markers")), 10000); + progress.set_format (tl::to_string (QObject::tr ("%.0f0000 markers"))); + progress.set_unit (10000); + + set_name ("Shapes"); + set_top_cell_name (layout.cell_name (cell_index)); + rdb::Cell *rdb_top_cell = create_cell (top_cell_name ()); + + std::string desc; + + if (layers_and_descriptions.size () == 1) { + + if (flat) { + desc = tl::to_string (tr ("Flat shapes of layer ")); + } else { + desc = tl::to_string (tr ("Hierarchical shapes of layer ")); + } + + desc += layout.get_properties (layers_and_descriptions.front ().first).to_string (); + + } else if (layers_and_descriptions.size () < 4 && layers_and_descriptions.size () > 0) { + + if (flat) { + desc = tl::to_string (tr ("Flat shapes of layers ")); + } else { + desc = tl::to_string (tr ("Hierarchical shapes of layers ")); + } + + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { + if (l != layers_and_descriptions.begin ()) { + desc += ","; + } + desc += layout.get_properties (l->first).to_string (); + } + + } else { + + if (flat) { + desc = tl::sprintf (tl::to_string (tr ("Flat shapes of %d layers")), int (layers_and_descriptions.size ())); + } else { + desc = tl::sprintf (tl::to_string (tr ("Hierarchical shapes of %d layers")), int (layers_and_descriptions.size ())); + } + + } + + desc += " "; + desc += tl::to_string (tr ("from cell ")); + desc += layout.cell_name (cell_index); + set_description (desc); + + if (flat) { + + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { + + rdb::Category *cat = create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); + + db::RecursiveShapeIterator shape (layout, layout.cell (cell_index), l->first); + while (! shape.at_end ()) { + + rdb::create_item_from_shape (this, rdb_top_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()) * shape.trans (), *shape); + + ++progress; + ++shape; + + } + + } + + } else { + + std::set called_cells; + called_cells.insert (cell_index); + layout.cell (cell_index).collect_called_cells (called_cells); + + for (auto l = layers_and_descriptions.begin (); l != layers_and_descriptions.end (); ++l) { + + rdb::Category *cat = create_category (l->second.empty () ? layout.get_properties (l->first).to_string () : l->second); + + for (db::Layout::const_iterator cid = layout.begin (); cid != layout.end (); ++cid) { + + if (called_cells.find (cid->cell_index ()) == called_cells.end ()) { + continue; + } + + const db::Cell &cell = *cid; + if (! cell.shapes (l->first).empty ()) { + + std::string cn = layout.cell_name (cell.cell_index ()); + const rdb::Cell *rdb_cell = cell_by_qname (cn); + if (! rdb_cell) { + + rdb::Cell *rdb_cell_nc = create_cell (cn); + rdb_cell = rdb_cell_nc; + + std::pair ctx = db::find_layout_context (layout, cell.cell_index (), cell_index); + if (ctx.first) { + db::DCplxTrans t = db::DCplxTrans (layout.dbu ()) * db::DCplxTrans (ctx.second) * db::DCplxTrans (1.0 / layout.dbu ()); + rdb_cell_nc->references ().insert (Reference (t, rdb_top_cell->id ())); + } + + } + + for (db::ShapeIterator shape = cell.shapes (l->first).begin (db::ShapeIterator::All); ! shape.at_end (); ++shape) { + + rdb::create_item_from_shape (this, rdb_cell->id (), cat->id (), db::CplxTrans (layout.dbu ()), *shape); + + ++progress; + + } + + } + + } + + } + + } +} + + } // namespace rdb diff --git a/src/rdb/rdb/rdb.h b/src/rdb/rdb/rdb.h index a7859f60e..22970cd3c 100644 --- a/src/rdb/rdb/rdb.h +++ b/src/rdb/rdb/rdb.h @@ -50,6 +50,7 @@ namespace tl namespace db { class Shape; + class Layout; } namespace rdb @@ -2317,6 +2318,16 @@ public: */ void load (const std::string &filename); + /** + * @brief Scans a layout into this RDB + * + * @param layout The layout to scan + * @param cell_index The top cell to scan + * @param layers_and_descriptions The layers and (optional) descriptions/names of the layer to scan + * @param flat True, to perform a flat scan + */ + void scan_layout (const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat); + private: std::string m_generator; std::string m_filename; From 9125ed703533204fbd70170a3236a818184e320e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 19:23:21 +0100 Subject: [PATCH 63/79] [consider merging] fixed a linker problem for debug builds --- src/tl/tl/tlOptional.cc | 2 +- src/tl/tl/tlOptional.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tl/tl/tlOptional.cc b/src/tl/tl/tlOptional.cc index ba2774439..d7ee370b2 100644 --- a/src/tl/tl/tlOptional.cc +++ b/src/tl/tl/tlOptional.cc @@ -25,6 +25,6 @@ namespace tl { -extern const nullopt_t nullopt = nullopt_t (); +const nullopt_t nullopt = nullopt_t (); } // namespace tl diff --git a/src/tl/tl/tlOptional.h b/src/tl/tl/tlOptional.h index c30fa6679..3893d6ac0 100644 --- a/src/tl/tl/tlOptional.h +++ b/src/tl/tl/tlOptional.h @@ -34,7 +34,7 @@ namespace tl struct nullopt_t {}; -extern const nullopt_t nullopt; +extern TL_PUBLIC const nullopt_t nullopt; /** * @brief Poor man's partial implementation of C++17's std::optional From 3b0a34b9559e7eea4042543df90fda3d1b9130dd Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 12:31:44 +0100 Subject: [PATCH 64/79] [consider merging] Avoid a segfault when changing the default grids. --- src/lay/lay/layMainConfigPages.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lay/lay/layMainConfigPages.cc b/src/lay/lay/layMainConfigPages.cc index a7634e4e5..95e724196 100644 --- a/src/lay/lay/layMainConfigPages.cc +++ b/src/lay/lay/layMainConfigPages.cc @@ -525,7 +525,7 @@ CustomizeMenuConfigPage::commit (lay::Dispatcher *dispatcher) std::map::iterator cb = m_current_bindings.find (kb->first); if (cb != m_current_bindings.end ()) { lay::Action *a = dispatcher->menu ()->action (kb->first); - if (cb->second != a->get_default_shortcut ()) { + if (a && cb->second != a->get_default_shortcut ()) { if (cb->second.empty ()) { kb->second = lay::Action::no_shortcut (); } else { From 376058f34bb0852d0aea6f259116d8bb083734ec Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 12:48:53 +0100 Subject: [PATCH 65/79] Implemented fix for issue-1662 (Strong default grids) --- src/db/db/dbTechnology.cc | 28 ++++++++-- src/db/db/dbTechnology.h | 9 ++++ src/db/db/gsiDeclDbTechnologies.cc | 31 ++++++++++- src/lay/lay/MainConfigPage3.ui | 82 ++++++++++++++++-------------- src/lay/lay/TechBaseEditorPage.ui | 10 +++- src/lay/lay/layMainWindow.cc | 44 ++++++++++++++-- src/lay/lay/layMainWindow.h | 3 ++ testdata/ruby/dbTechnologies.rb | 19 +++++++ 8 files changed, 178 insertions(+), 48 deletions(-) diff --git a/src/db/db/dbTechnology.cc b/src/db/db/dbTechnology.cc index 2910fbbab..84bd4118e 100644 --- a/src/db/db/dbTechnology.cc +++ b/src/db/db/dbTechnology.cc @@ -347,12 +347,10 @@ Technology::get_display_string () const return d; } -std::vector -Technology::default_grid_list () const +static void +parse_default_grids (const std::string &s, std::vector &grids, double &default_grid) { - tl::Extractor ex (m_default_grids.c_str ()); - - std::vector grids; + tl::Extractor ex (s.c_str ()); // convert the list of grids to a list of doubles while (! ex.at_end ()) { @@ -361,12 +359,32 @@ Technology::default_grid_list () const break; } grids.push_back (g); + if (ex.test ("!")) { + default_grid = g; + } ex.test (","); } +} +std::vector +Technology::default_grid_list () const +{ + std::vector grids; + double default_grid = 0.0; + parse_default_grids (m_default_grids, grids, default_grid); return grids; } +double +Technology::default_grid () const +{ + std::vector grids; + double default_grid = 0.0; + parse_default_grids (m_default_grids, grids, default_grid); + return default_grid; +} + + tl::XMLElementList Technology::xml_elements () { diff --git a/src/db/db/dbTechnology.h b/src/db/db/dbTechnology.h index e06ddca14..2fa1c6f5e 100644 --- a/src/db/db/dbTechnology.h +++ b/src/db/db/dbTechnology.h @@ -480,6 +480,15 @@ public: */ std::vector default_grid_list () const; + /** + * @brief Gets the default grid (strong grid), parsed from the list + * + * The default grid is the one marked with an exclamation mark in the + * grid list (e.g. "0.01!,0.02,0.05"). If there is not such default + * grid, this method returns zero. + */ + double default_grid () const; + /** * @brief Sets the default default grids */ diff --git a/src/db/db/gsiDeclDbTechnologies.cc b/src/db/db/gsiDeclDbTechnologies.cc index de670fa4f..bc3d6f9d0 100644 --- a/src/db/db/gsiDeclDbTechnologies.cc +++ b/src/db/db/gsiDeclDbTechnologies.cc @@ -136,7 +136,7 @@ gsi::Class technology_component_decl ("db", "Technology DB_PUBLIC gsi::Class &decl_dbTechnologyComponent () { return technology_component_decl; } static void -set_default_grid_list (db::Technology *tech, const std::vector &grids) +set_default_grid_list2 (db::Technology *tech, const std::vector &grids, double default_grid) { std::string r; for (auto g = grids.begin (); g != grids.end (); ++g) { @@ -144,10 +144,19 @@ set_default_grid_list (db::Technology *tech, const std::vector &grids) r += ","; } r += tl::micron_to_string (*g); + if (db::coord_traits::equals (*g, default_grid)) { + r += "!"; + } } tech->set_default_grids (r); } +static void +set_default_grid_list (db::Technology *tech, const std::vector &grids) +{ + set_default_grid_list2 (tech, grids, 0.0); +} + gsi::Class technology_decl ("db", "Technology", gsi::method ("name", &db::Technology::name, "@brief Gets the name of the technology" @@ -238,12 +247,32 @@ gsi::Class technology_decl ("db", "Technology", "\n" "This property has been introduced in version 0.28.17." ) + + gsi::method ("default_grid", &db::Technology::default_grid, + "@brief Gets the default grid\n" + "\n" + "The default grid is a specific one from the default grid list.\n" + "It indicates the one that is taken if the current grid is not matching one of " + "the default grids.\n" + "\n" + "To set the default grid, use \\set_default_grids.\n" + "\n" + "This property has been introduced in version 0.29." + ) + gsi::method_ext ("default_grids=", &set_default_grid_list, gsi::arg ("grids"), "@brief Sets the default grids\n" "If not empty, this list replaces the global grid list for this technology.\n" + "Note that this method will reset the default grid (see \\default_grid). Use " + "\\set_default_grids to set the default grids and the strong default one.\n" "\n" "This property has been introduced in version 0.28.17." ) + + gsi::method_ext ("set_default_grids", &set_default_grid_list2, gsi::arg ("grids"), gsi::arg ("default_grid", 0.0), + "@brief Sets the default grids and the strong default one\n" + "See \\default_grids and \\default_grid for a description of this property.\n" + "Note that the default grid has to be a member of the 'grids' array to become active.\n" + "\n" + "This method has been introduced in version 0.29." + ) + gsi::method ("layer_properties_file", &db::Technology::layer_properties_file, "@brief Gets the path of the layer properties file\n" "\n" diff --git a/src/lay/lay/MainConfigPage3.ui b/src/lay/lay/MainConfigPage3.ui index 54420b273..614606a58 100644 --- a/src/lay/lay/MainConfigPage3.ui +++ b/src/lay/lay/MainConfigPage3.ui @@ -1,67 +1,75 @@ - + + MainConfigPage3 - - + + 0 0 - 475 - 81 + 504 + 180 - + Settings - - - 9 - - + + 6 + + 9 + - - + + Default Grids - - + + 9 - + 6 - - - + + + + + 0 + 0 + + + + Grids for "View" menu + + + + + + µm (g1,g2,...) - - - - - 7 - 0 + + + + 0 0 - - - - - 5 - 5 - 0 - 0 - + + + + <html>You can declare one grid a strong default to enforce an editing grid from this list. To do so, add an exclamation mark - e.g. "0.01!,0.02,0.05". +<br/><b>Note</b>: the general default grids can be overridden by technology specific default grids.</html> - - Grids for "View" menu + + true @@ -70,7 +78,7 @@ - + diff --git a/src/lay/lay/TechBaseEditorPage.ui b/src/lay/lay/TechBaseEditorPage.ui index 668e04ffe..17d89749d 100644 --- a/src/lay/lay/TechBaseEditorPage.ui +++ b/src/lay/lay/TechBaseEditorPage.ui @@ -7,7 +7,7 @@ 0 0 625 - 587 + 616 @@ -331,6 +331,9 @@ properties The default database unit is used as database unit for freshly created layouts + + true + @@ -352,7 +355,10 @@ properties - These grids are available for selection from the "View" menu + These grids are available for selection from the "View" menu and will override the general ones. You can declare one grid as a strong default to enforce an editing grid from this list. To do so, add an exclamation mark to the grid - e.g. "0.01!,0.02,0.05". + + + true diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 0eb2eb397..b5083ae8b 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -175,9 +175,11 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled) m_disable_tab_selected (false), m_exited (false), dm_do_update_menu (this, &MainWindow::do_update_menu), + dm_do_update_grids (this, &MainWindow::do_update_grids), dm_do_update_mru_menus (this, &MainWindow::do_update_mru_menus), dm_exit (this, &MainWindow::exit), m_grid_micron (0.001), + m_default_grid (0.0), m_default_grids_updated (true), m_new_layout_current_panel (false), m_synchronized_views (false), @@ -583,7 +585,7 @@ MainWindow::technology_changed () } m_default_grids_updated = true; // potentially ... - dm_do_update_menu (); + dm_do_update_grids (); } void @@ -939,7 +941,7 @@ MainWindow::config_finalize () // Update the default grids menu if necessary if (m_default_grids_updated) { - dm_do_update_menu (); + dm_do_update_grids (); } // make the changes visible in the setup form if the form is visible @@ -972,6 +974,7 @@ MainWindow::configure (const std::string &name, const std::string &value) tl::Extractor ex (value.c_str ()); m_default_grids.clear (); + m_default_grid = 0.0; m_default_grids_updated = true; // convert the list of grids to a list of doubles @@ -980,6 +983,9 @@ MainWindow::configure (const std::string &name, const std::string &value) if (! ex.try_read (g)) { break; } + if (ex.test ("!")) { + m_default_grid = g; + } m_default_grids.push_back (g); ex.test (","); } @@ -4041,6 +4047,38 @@ MainWindow::menu_changed () dm_do_update_menu (); } +void +MainWindow::do_update_grids () +{ + const std::vector *grids = &m_default_grids; + double default_grid = m_default_grid; + + std::vector tech_grids; + lay::TechnologyController *tc = lay::TechnologyController::instance (); + if (tc && tc->active_technology ()) { + tech_grids = tc->active_technology ()->default_grid_list (); + if (! tech_grids.empty ()) { + grids = &tech_grids; + default_grid = tc->active_technology ()->default_grid (); + } + } + + if (default_grid > db::epsilon) { + for (auto g = grids->begin (); g != grids->end (); ++g) { + if (db::coord_traits::equals (*g, m_grid_micron)) { + default_grid = 0.0; + break; + } + } + } + + if (default_grid > db::epsilon) { + dispatcher ()->config_set (cfg_grid, default_grid); + } + + do_update_menu (); +} + void MainWindow::do_update_menu () { @@ -4082,7 +4120,7 @@ MainWindow::do_update_menu () lay::Action *ga = new lay::ConfigureAction (gs, cfg_grid, tl::to_string (*g)); ga->set_checkable (true); - ga->set_checked (fabs (*g - m_grid_micron) < 1e-10); + ga->set_checked (db::coord_traits::equals (*g, m_grid_micron)); for (std::vector::const_iterator t = group.begin (); t != group.end (); ++t) { menu ()->insert_item (*t + ".end", name, ga); diff --git a/src/lay/lay/layMainWindow.h b/src/lay/lay/layMainWindow.h index 326bc3c07..64e457c89 100644 --- a/src/lay/lay/layMainWindow.h +++ b/src/lay/lay/layMainWindow.h @@ -706,6 +706,7 @@ protected slots: protected: void update_content (); void do_update_menu (); + void do_update_grids (); void do_update_mru_menus (); bool eventFilter (QObject *watched, QEvent *event); @@ -753,6 +754,7 @@ private: bool m_disable_tab_selected; bool m_exited; tl::DeferredMethod dm_do_update_menu; + tl::DeferredMethod dm_do_update_grids; tl::DeferredMethod dm_do_update_mru_menus; tl::DeferredMethod dm_exit; QTimer m_message_timer; @@ -765,6 +767,7 @@ private: std::string m_initial_technology; double m_grid_micron; std::vector m_default_grids; + double m_default_grid; bool m_default_grids_updated; std::vector > m_key_bindings; bool m_new_layout_current_panel; diff --git a/testdata/ruby/dbTechnologies.rb b/testdata/ruby/dbTechnologies.rb index d1dc9cf93..3305eae6a 100644 --- a/testdata/ruby/dbTechnologies.rb +++ b/testdata/ruby/dbTechnologies.rb @@ -105,10 +105,29 @@ END tech.default_grids = [] assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "") + assert_equal("%.12g" % tech.default_grid, "0") tech.default_grids = [0.001, 0.01, 0.2] assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.001,0.01,0.2") tech.default_grids = [1] assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "1") + assert_equal("%.12g" % tech.default_grid, "0") + + # setting the default grid + tech.set_default_grids([0.01,0.02,0.05], 0.02) + assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.01,0.02,0.05") + assert_equal("%.12g" % tech.default_grid, "0.02") + + # default grid must be a member of the default grid list + tech.set_default_grids([0.01,0.02,0.05], 0.2) + assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "0.01,0.02,0.05") + assert_equal("%.12g" % tech.default_grid, "0") + + # "default_grids=" resets the default grid + tech.set_default_grids([0.01,0.02,0.05], 0.02) + assert_equal("%.12g" % tech.default_grid, "0.02") + tech.default_grids = [1] + assert_equal(tech.default_grids.collect { |g| "%.12g" % g }.join(","), "1") + assert_equal("%.12g" % tech.default_grid, "0") tech.default_base_path = "/default/path" assert_equal(tech.default_base_path, "/default/path") From 735d2101fd1e31e0ee4d8647390b83ee475b4172 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 12:53:18 +0100 Subject: [PATCH 66/79] Fixed Qt-less builds --- src/rdb/rdb/rdb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rdb/rdb/rdb.cc b/src/rdb/rdb/rdb.cc index e219dfc52..390e6f88a 100644 --- a/src/rdb/rdb/rdb.cc +++ b/src/rdb/rdb/rdb.cc @@ -1629,8 +1629,8 @@ Database::load (const std::string &fn) void Database::scan_layout (const db::Layout &layout, db::cell_index_type cell_index, const std::vector > &layers_and_descriptions, bool flat) { - tl::AbsoluteProgress progress (tl::to_string (QObject::tr ("Shapes To Markers")), 10000); - progress.set_format (tl::to_string (QObject::tr ("%.0f0000 markers"))); + tl::AbsoluteProgress progress (tl::to_string (tr ("Shapes To Markers")), 10000); + progress.set_format (tl::to_string (tr ("%.0f0000 markers"))); progress.set_unit (10000); set_name ("Shapes"); From 1673c472f2a7d9eb51142c10f3f41ce2a3705f8e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Mar 2024 19:23:21 +0100 Subject: [PATCH 67/79] [consider merging] fixed a linker problem for debug builds --- src/tl/tl/tlOptional.cc | 2 +- src/tl/tl/tlOptional.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tl/tl/tlOptional.cc b/src/tl/tl/tlOptional.cc index ba2774439..d7ee370b2 100644 --- a/src/tl/tl/tlOptional.cc +++ b/src/tl/tl/tlOptional.cc @@ -25,6 +25,6 @@ namespace tl { -extern const nullopt_t nullopt = nullopt_t (); +const nullopt_t nullopt = nullopt_t (); } // namespace tl diff --git a/src/tl/tl/tlOptional.h b/src/tl/tl/tlOptional.h index c30fa6679..3893d6ac0 100644 --- a/src/tl/tl/tlOptional.h +++ b/src/tl/tl/tlOptional.h @@ -34,7 +34,7 @@ namespace tl struct nullopt_t {}; -extern const nullopt_t nullopt; +extern TL_PUBLIC const nullopt_t nullopt; /** * @brief Poor man's partial implementation of C++17's std::optional From b9bdcf6facb65c87b76ebf1dd1cc17c4ccfa58e6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 19:01:36 +0100 Subject: [PATCH 68/79] Preparations: recursive shape iterator shortcuts if hierarchy traversal, needs testing. --- src/db/db/dbAsIfFlatRegion.cc | 2 + src/db/db/dbFlatRegion.cc | 12 ++- src/db/db/dbFlatRegion.h | 3 +- src/db/db/dbRecursiveShapeIterator.cc | 103 +++++++++++++++---- src/db/db/dbRecursiveShapeIterator.h | 51 +++++++-- src/db/db/dbRegion.cc | 36 ++++++- src/db/db/dbRegion.h | 20 +++- src/db/db/gsiDeclDbRecursiveShapeIterator.cc | 18 +++- src/db/db/gsiDeclDbRegion.cc | 54 ++++++---- src/db/unit_tests/dbRegionTests.cc | 29 ++++++ testdata/ruby/dbRegionTest.rb | 41 ++++++++ 11 files changed, 307 insertions(+), 62 deletions(-) diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index 9ee803c2a..2171c4f37 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -219,6 +219,8 @@ AsIfFlatRegion::area (const db::Box &box) const for (RegionIterator p (begin_merged ()); ! p.at_end (); ++p) { if (box.empty () || p->box ().inside (box)) { a += p->area (); + } else if (p->is_box ()) { + a += (p->box () & box).area (); } else { std::vector clipped; clip_poly (*p, box, clipped); diff --git a/src/db/db/dbFlatRegion.cc b/src/db/db/dbFlatRegion.cc index d96bb8a22..0d79dbe3e 100644 --- a/src/db/db/dbFlatRegion.cc +++ b/src/db/db/dbFlatRegion.cc @@ -43,7 +43,6 @@ FlatRegion::FlatRegion (const FlatRegion &other) : MutableRegion (other), mp_polygons (other.mp_polygons), mp_merged_polygons (other.mp_merged_polygons), mp_properties_repository (other.mp_properties_repository) { init (); - m_is_merged = other.m_is_merged; m_merged_polygons_valid = other.m_merged_polygons_valid; } @@ -52,15 +51,22 @@ FlatRegion::FlatRegion (const db::Shapes &polygons, bool is_merged) : MutableRegion (), mp_polygons (new db::Shapes (polygons)), mp_merged_polygons (new db::Shapes (false)), mp_properties_repository (new db::PropertiesRepository ()) { init (); - m_is_merged = is_merged; } +FlatRegion::FlatRegion (const db::Shapes &polygons, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged) + : MutableRegion (), mp_polygons (new db::Shapes (polygons)), mp_merged_polygons (new db::Shapes (false)), mp_properties_repository (new db::PropertiesRepository ()) +{ + init (); + m_is_merged = is_merged; + transform_generic (trans); + set_merged_semantics (merged_semantics); +} + FlatRegion::FlatRegion (bool is_merged) : MutableRegion (), mp_polygons (new db::Shapes (false)), mp_merged_polygons (new db::Shapes (false)), mp_properties_repository (new db::PropertiesRepository ()) { init (); - m_is_merged = is_merged; } diff --git a/src/db/db/dbFlatRegion.h b/src/db/db/dbFlatRegion.h index d89e53173..55805a8a5 100644 --- a/src/db/db/dbFlatRegion.h +++ b/src/db/db/dbFlatRegion.h @@ -52,7 +52,8 @@ public: typedef polygon_layer_wp_type::iterator polygon_iterator_wp_type; FlatRegion (); - FlatRegion (const db::Shapes &polygons, bool is_merged); + FlatRegion (const db::Shapes &polygons, bool is_merged = false); + FlatRegion (const db::Shapes &polygons, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged = false); FlatRegion (bool is_merged); FlatRegion (const FlatRegion &other); diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index 9a8f6052f..0534ebd3f 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -48,6 +48,8 @@ RecursiveShapeIterator &RecursiveShapeIterator::operator= (const RecursiveShapeI mp_shape_prop_sel = d.mp_shape_prop_sel; m_shape_inv_prop_sel = d.m_shape_inv_prop_sel; m_overlapping = d.m_overlapping; + m_for_merged_input = d.m_for_merged_input; + m_start = d.m_start; m_stop = d.m_stop; @@ -99,6 +101,7 @@ RecursiveShapeIterator::RecursiveShapeIterator () mp_cell = 0; m_current_layer = 0; m_overlapping = false; + m_for_merged_input = false; m_max_depth = std::numeric_limits::max (); // all m_min_depth = 0; m_shape_flags = shape_iterator::All; @@ -116,6 +119,7 @@ RecursiveShapeIterator::RecursiveShapeIterator (const shapes_type &shapes) mp_shapes = &shapes; mp_top_cell = 0; m_overlapping = false; + m_for_merged_input = false; init (); init_region (box_type::world ()); } @@ -127,6 +131,7 @@ RecursiveShapeIterator::RecursiveShapeIterator (const shapes_type &shapes, const mp_shapes = &shapes; mp_top_cell = 0; m_overlapping = overlapping; + m_for_merged_input = false; init (); init_region (region); } @@ -138,11 +143,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const shapes_type &shapes, const mp_shapes = &shapes; mp_top_cell = 0; m_overlapping = overlapping; + m_for_merged_input = false; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const box_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const box_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout, layer) { m_layer = layer; @@ -151,11 +157,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const region_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const region_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout, layer) { m_layer = layer; @@ -164,11 +171,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, bool for_merged_input) : m_box_convert (layout, layer) { m_layer = layer; @@ -177,11 +185,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = false; + m_for_merged_input = for_merged_input; init (); init_region (box_type::world ()); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const box_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const box_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -191,11 +200,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const region_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const region_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -205,11 +215,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -219,11 +230,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = false; + m_for_merged_input = for_merged_input; init (); init_region (box_type::world ()); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const box_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const box_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -233,11 +245,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const region_type ®ion, bool overlapping) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const region_type ®ion, bool overlapping, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -247,11 +260,12 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = overlapping; + m_for_merged_input = for_merged_input; init (); init_region (region); } -RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers) +RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, bool for_merged_input) : m_box_convert (layout) { m_layer = 0; @@ -261,6 +275,7 @@ RecursiveShapeIterator::RecursiveShapeIterator (const layout_type &layout, const mp_shapes = 0; mp_top_cell = &cell; m_overlapping = false; + m_for_merged_input = for_merged_input; init (); init_region (box_type::world ()); } @@ -721,13 +736,9 @@ RecursiveShapeIterator::next_shape (RecursiveShapeReceiver *receiver) const } - if (is_empty) { - + if (is_empty || !down (receiver)) { ++m_inst; new_inst (receiver); - - } else { - down (receiver); } } else { @@ -755,7 +766,7 @@ RecursiveShapeIterator::next_shape (RecursiveShapeReceiver *receiver) const } } -void +bool RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const { tl_assert (mp_layout); @@ -783,6 +794,40 @@ RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const new_region = m_trans.inverted () * m_region; new_region &= cell_bbox (cell_index ()); } + + // try some optimization - only consider optimizing by dropping the shape-covered area under certain circumstances: + // - single layer + // - less than 32 shapes to consider + // - total shape bbox in current region covers at least a third of it + // - total area of shapes in current region is at least a third of it + // TODO: the current implementation does not touch the complex search region + + if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! new_region.empty ()) { + + unsigned int l = m_has_layers ? m_layers.front () : m_layer; + const shapes_type &shapes = m_cells.back ()->shapes (l); + box_type region_in_parent = m_inst->complex_trans (*m_inst_array) * new_region; + + // NOTE: new_region is already in the coordinate system of the child cell + + if (shapes.size () < 32 && + 3 * (shapes.bbox () & region_in_parent).area () > region_in_parent.area ()) { + + region_type shapes_region (shapes); + if (3 * shapes_region.area (region_in_parent) > region_in_parent.area ()) { + + shapes_region.transform (m_inst->complex_trans (*m_inst_array).inverted ()); + + // reduce the search region for less instances to look up + region_type new_complex_region = region_type (new_region) - shapes_region; + new_region = new_complex_region.bbox (); + + } + + } + + } + m_local_region_stack.push_back (new_region); if (! m_local_complex_region_stack.empty ()) { @@ -817,11 +862,25 @@ RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const } - if (receiver) { - receiver->enter_cell (this, cell (), m_local_region_stack.back (), m_local_complex_region_stack.empty () ? 0 : &m_local_complex_region_stack.back ()); - } + // do not descend if the box is empty - new_cell (receiver); + if (m_local_region_stack.back ().empty ()) { + + pop (); + + return false; + + } else { + + if (receiver) { + receiver->enter_cell (this, cell (), m_local_region_stack.back (), m_local_complex_region_stack.empty () ? 0 : &m_local_complex_region_stack.back ()); + } + + new_cell (receiver); + + return true; + + } } void @@ -831,6 +890,12 @@ RecursiveShapeIterator::up (RecursiveShapeReceiver *receiver) const receiver->leave_cell (this, cell ()); } + pop (); +} + +void +RecursiveShapeIterator::pop () const +{ m_shape = shape_iterator (); m_shape_quad_id = 0; diff --git a/src/db/db/dbRecursiveShapeIterator.h b/src/db/db/dbRecursiveShapeIterator.h index 43f913b1a..b8e6a640a 100644 --- a/src/db/db/dbRecursiveShapeIterator.h +++ b/src/db/db/dbRecursiveShapeIterator.h @@ -122,12 +122,13 @@ public: * @param layer The layer from which to deliver the shapes * @param region The region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const box_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const box_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor @@ -137,13 +138,14 @@ public: * @param layer The layer from which to deliver the shapes * @param region The complex region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. It allows specification of a complex * search region. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const region_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, const region_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor for "world" iteration @@ -153,8 +155,9 @@ public: * @param layout The layout from which to get the cell hierarchy * @param cell The starting cell * @param layer The layer from which to deliver the shapes + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, unsigned int layer, bool for_merged_input = false); /** * @brief Standard constructor with a layer selection @@ -164,12 +167,13 @@ public: * @param layers The layers from which to deliver the shapes * @param region The region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const box_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const box_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor with a layer selection @@ -179,13 +183,14 @@ public: * @param layers The layers from which to deliver the shapes * @param region The complex region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. It allows specification of a complex * search region. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const region_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, const region_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor with a layer selection @@ -195,12 +200,13 @@ public: * @param layers The layers from which to deliver the shapes * @param region The region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const box_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const box_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor with a layer selection @@ -210,13 +216,14 @@ public: * @param layers The layers from which to deliver the shapes * @param region The complex region from which to select the shapes * @param overlapping Specify overlapping mode + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others * * By default the iterator operates in touching mode - i.e. shapes that touch the given region * are returned. By specifying the "overlapping" flag with a true value, the iterator delivers shapes that * overlap the given region by at least one database unit. It allows specification of a complex * search region. */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const region_type ®ion, bool overlapping = false); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, const region_type ®ion, bool overlapping = false, bool for_merged_input = false); /** * @brief Standard constructor for "world" iteration with a layer set @@ -226,8 +233,9 @@ public: * @param layout The layout from which to get the cell hierarchy * @param cell The starting cell * @param layers The layers from which to deliver the shapes + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::vector &layers, bool for_merged_input = false); /** * @brief Standard constructor for "world" iteration with a layer set @@ -237,8 +245,9 @@ public: * @param layout The layout from which to get the cell hierarchy * @param cell The starting cell * @param layers The layers from which to deliver the shapes + * @param for_merged_input Optimize for merged input - drop shapes that are completely covered by others */ - RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers); + RecursiveShapeIterator (const layout_type &layout, const cell_type &cell, const std::set &layers, bool for_merged_input = false); /** * @brief Destructor @@ -427,6 +436,25 @@ public: } } + /** + * @brief Gets a flag indicating whether optimizing for merged input + */ + bool for_merged_input () const + { + return m_for_merged_input; + } + + /** + * @brief Sets a flag indicating whether optimizing for merged input + */ + void set_for_merged_input (bool f) + { + if (m_for_merged_input != f) { + m_for_merged_input = f; + m_needs_reinit = true; + } + } + /** * @brief Sets a global transformation * @@ -812,7 +840,7 @@ private: unsigned int m_shape_flags; const shape_iterator::property_selector *mp_shape_prop_sel; bool m_shape_inv_prop_sel; - bool m_overlapping; + bool m_overlapping, m_for_merged_input; std::set m_start, m_stop; cplx_trans_type m_global_trans; db::PropertiesTranslator m_property_translator; @@ -858,7 +886,8 @@ private: void new_cell (RecursiveShapeReceiver *receiver) const; void new_layer () const; void up (RecursiveShapeReceiver *receiver) const; - void down (RecursiveShapeReceiver *receiver) const; + bool down (RecursiveShapeReceiver *receiver) const; + void pop () const; bool is_outside_complex_region (const db::Box &box) const; diff --git a/src/db/db/dbRegion.cc b/src/db/db/dbRegion.cc index 488fbc460..c05f9d338 100644 --- a/src/db/db/dbRegion.cc +++ b/src/db/db/dbRegion.cc @@ -74,14 +74,42 @@ Region &Region::operator= (const Region &other) return *this; } -Region::Region (const RecursiveShapeIterator &si) +Region::Region (const RecursiveShapeIterator &si, bool merged_semantics, bool is_merged) { - mp_delegate = new OriginalLayerRegion (si); + mp_delegate = new OriginalLayerRegion (si, db::ICplxTrans (), merged_semantics, is_merged); } -Region::Region (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics) +Region::Region (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged) { - mp_delegate = new OriginalLayerRegion (si, trans, merged_semantics); + mp_delegate = new OriginalLayerRegion (si, trans, merged_semantics, is_merged); +} + +Region::Region (const Shapes &shapes, bool merged_semantics, bool is_merged) +{ + db::FlatRegion *flat_region = new FlatRegion (is_merged); + flat_region->reserve (shapes.size (db::ShapeIterator::Regions)); + + // NOTE: we need to normalize the shapes to polygons because this is what the flat region expects + for (auto s = shapes.begin (db::ShapeIterator::Regions); ! s.at_end (); ++s) { + flat_region->insert (*s); + } + + mp_delegate = flat_region; + mp_delegate->set_merged_semantics (merged_semantics); +} + +Region::Region (const Shapes &shapes, const db::ICplxTrans &trans, bool merged_semantics, bool is_merged) +{ + db::FlatRegion *flat_region = new FlatRegion (is_merged); + flat_region->reserve (shapes.size (db::ShapeIterator::Regions)); + + // NOTE: we need to normalize the shapes to polygons because this is what the flat region expects + for (auto s = shapes.begin (db::ShapeIterator::Regions); ! s.at_end (); ++s) { + flat_region->insert (*s, trans); + } + + mp_delegate = flat_region; + mp_delegate->set_merged_semantics (merged_semantics); } Region::Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, double area_ratio, size_t max_vertex_count) diff --git a/src/db/db/dbRegion.h b/src/db/db/dbRegion.h index 39880b2ca..1329adcc8 100644 --- a/src/db/db/dbRegion.h +++ b/src/db/db/dbRegion.h @@ -199,7 +199,7 @@ public: * Creates a region from a recursive shape iterator. This allows feeding a region * from a hierarchy of cells. */ - explicit Region (const RecursiveShapeIterator &si); + explicit Region (const RecursiveShapeIterator &si, bool merged_semantics = true, bool is_merged = false); /** * @brief Constructor from a RecursiveShapeIterator with a transformation @@ -208,7 +208,23 @@ public: * from a hierarchy of cells. The transformation is useful to scale to a specific * DBU for example. */ - explicit Region (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics = true); + explicit Region (const RecursiveShapeIterator &si, const db::ICplxTrans &trans, bool merged_semantics = true, bool is_merged = false); + + /** + * @brief Constructor from a Shapes container + * + * Creates a region from a shapes container. + */ + explicit Region (const Shapes &si, bool merged_semantics = true, bool is_merged = false); + + /** + * @brief Constructor from a Shapes container with a transformation + * + * Creates a region from a recursive shape iterator. This allows feeding a region + * from a hierarchy of cells. The transformation is useful to scale to a specific + * DBU for example. + */ + explicit Region (const Shapes &si, const db::ICplxTrans &trans, bool merged_semantics = true, bool is_merged = false); /** * @brief Constructor from a RecursiveShapeIterator providing a deep representation diff --git a/src/db/db/gsiDeclDbRecursiveShapeIterator.cc b/src/db/db/gsiDeclDbRecursiveShapeIterator.cc index bc702af0f..50f840eee 100644 --- a/src/db/db/gsiDeclDbRecursiveShapeIterator.cc +++ b/src/db/db/gsiDeclDbRecursiveShapeIterator.cc @@ -476,13 +476,29 @@ Class decl_RecursiveShapeIterator ("db", "RecursiveS "\n" "This method has been introduced in version 0.23.\n" ) + - gsi::method ("overlapping=", &db::RecursiveShapeIterator::set_overlapping, gsi::arg ("region"), + gsi::method ("overlapping=", &db::RecursiveShapeIterator::set_overlapping, gsi::arg ("flag"), "@brief Sets a flag indicating whether overlapping shapes are selected when a region is used\n" "\n" "If this flag is false, shapes touching the search region are returned.\n" "\n" "This method has been introduced in version 0.23.\n" ) + + gsi::method ("for_merged_input?", &db::RecursiveShapeIterator::for_merged_input, + "@brief Gets a flag indicating whether iterator optimizes for merged input\n" + "\n" + "see \\for_merged_input= for details of this attribute.\n" + "\n" + "This method has been introduced in version 0.29.\n" + ) + + gsi::method ("for_merged_input=", &db::RecursiveShapeIterator::set_for_merged_input, gsi::arg ("flag"), + "@brief Sets a flag indicating whether iterator optimizes for merged input\n" + "\n" + "If this flag is set to true, the iterator is allowed to skip shapes it deems irrelevant " + "because they are covered entirely by other shapes. This allows shortcutting hierarchy traversal in " + "some cases.\n" + "\n" + "This method has been introduced in version 0.29.\n" + ) + gsi::method ("unselect_all_cells", &db::RecursiveShapeIterator::unselect_all_cells, "@brief Unselects all cells.\n" "\n" diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index f978a7c4f..ad941cc27 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -270,15 +270,6 @@ static db::Region *new_path (const db::Path &o) return new db::Region (o); } -static db::Region *new_shapes (const db::Shapes &s) -{ - db::Region *r = new db::Region (); - for (db::Shapes::shape_iterator i = s.begin (db::ShapeIterator::All); !i.at_end (); ++i) { - r->insert (*i); - } - return r; -} - static db::Region *new_texts_as_boxes1 (const db::RecursiveShapeIterator &si, const std::string &pat, bool pattern, db::Coord enl) { return new db::Region (db::Region (si).texts_as_boxes (pat, pattern, enl)); @@ -329,16 +320,26 @@ static db::Region *new_si (const db::RecursiveShapeIterator &si) return new db::Region (si); } -static db::Region *new_sid (const db::RecursiveShapeIterator &si, db::DeepShapeStore &dss, double area_ratio, size_t max_vertex_count) -{ - return new db::Region (si, dss, area_ratio, max_vertex_count); -} - static db::Region *new_si2 (const db::RecursiveShapeIterator &si, const db::ICplxTrans &trans) { return new db::Region (si, trans); } +static db::Region *new_sis (const db::Shapes &si) +{ + return new db::Region (si); +} + +static db::Region *new_sis2 (const db::Shapes &si, const db::ICplxTrans &trans) +{ + return new db::Region (si, trans); +} + +static db::Region *new_sid (const db::RecursiveShapeIterator &si, db::DeepShapeStore &dss, double area_ratio, size_t max_vertex_count) +{ + return new db::Region (si, dss, area_ratio, max_vertex_count); +} + static db::Region *new_sid2 (const db::RecursiveShapeIterator &si, db::DeepShapeStore &dss, const db::ICplxTrans &trans, double area_ratio, size_t max_vertex_count) { return new db::Region (si, dss, trans, true, area_ratio, max_vertex_count); @@ -1088,13 +1089,6 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "This constructor creates a region from a path.\n" ) + - constructor ("new", &new_shapes, gsi::arg ("shapes"), - "@brief Shapes constructor\n" - "\n" - "This constructor creates a region from a \\Shapes collection.\n" - "\n" - "This constructor has been introduced in version 0.25." - ) + constructor ("new", &new_si, gsi::arg ("shape_iterator"), "@brief Constructor from a hierarchical shape set\n" "\n" @@ -1126,6 +1120,24 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "r = RBA::Region::new(layout.begin_shapes(cell, layer), RBA::ICplxTrans::new(layout.dbu / dbu))\n" "@/code\n" ) + + constructor ("new", &new_sis, gsi::arg ("shapes"), + "@brief Constructor from a shapes container\n" + "\n" + "This constructor creates a region from the shapes container.\n" + "Text objects and edges are not inserted, because they cannot be converted to polygons.\n" + "This method allows feeding the shapes from a hierarchy of cells into the region.\n" + "\n" + "This constructor has been introduced in version 0.25 and extended in version 0.29." + ) + + constructor ("new", &new_sis2, gsi::arg ("shapes"), gsi::arg ("trans"), + "@brief Constructor from a shapes container with a transformation\n" + "\n" + "This constructor creates a region from the shapes container after applying the transformation.\n" + "Text objects and edges are not inserted, because they cannot be converted to polygons.\n" + "This method allows feeding the shapes from a hierarchy of cells into the region.\n" + "\n" + "This constructor variant has been introduced in version 0.29." + ) + constructor ("new", &new_sid, gsi::arg ("shape_iterator"), gsi::arg ("deep_shape_store"), gsi::arg ("area_ratio", 0.0), gsi::arg ("max_vertex_count", size_t (0)), "@brief Constructor for a deep region from a hierarchical shape set\n" "\n" diff --git a/src/db/unit_tests/dbRegionTests.cc b/src/db/unit_tests/dbRegionTests.cc index 554f25956..70ac453b2 100644 --- a/src/db/unit_tests/dbRegionTests.cc +++ b/src/db/unit_tests/dbRegionTests.cc @@ -2537,6 +2537,35 @@ TEST(55_PropertiesFilterFlat) EXPECT_EQ (s->to_string (), "(1,2;1,202;101,202;101,2)"); } +TEST(56_RegionsFromShapes) +{ + db::Shapes shapes; + + shapes.insert (db::Box (0, 0, 100, 200)); + shapes.insert (db::Box (50, 50, 150, 250)); + + EXPECT_EQ (db::Region (shapes).area (), 32500); + EXPECT_EQ (db::Region (shapes, false).area (), 40000); + EXPECT_EQ (db::Region (shapes, db::ICplxTrans (0.5)).area (), 8125); + EXPECT_EQ (db::Region (shapes, db::ICplxTrans (0.5), false).area (), 10000); + + // for cross-checking: same for RecursiveShapeIterator + + db::Layout layout; + unsigned int l1 = layout.insert_layer (); + db::Cell &top = layout.cell (layout.add_cell ("TOP")); + + top.shapes (l1).insert (db::Box (0, 0, 100, 200)); + top.shapes (l1).insert (db::Box (50, 50, 150, 250)); + + db::RecursiveShapeIterator si (layout, top, l1); + + EXPECT_EQ (db::Region (si).area (), 32500); + EXPECT_EQ (db::Region (si, false).area (), 40000); + EXPECT_EQ (db::Region (si, db::ICplxTrans (0.5)).area (), 8125); + EXPECT_EQ (db::Region (si, db::ICplxTrans (0.5), false).area (), 10000); +} + TEST(100_Processors) { db::Region r; diff --git a/testdata/ruby/dbRegionTest.rb b/testdata/ruby/dbRegionTest.rb index 0d81b5efd..8c59d587c 100644 --- a/testdata/ruby/dbRegionTest.rb +++ b/testdata/ruby/dbRegionTest.rb @@ -1066,6 +1066,47 @@ class DBRegion_TestClass < TestBase end + # regions from Shapes + def test_regions_from_shapes + + shapes = RBA::Shapes::new; + + shapes.insert(RBA::Box::new(0, 0, 100, 200)) + shapes.insert(RBA::Box::new(50, 50, 150, 250)) + + assert_equal(RBA::Region::new(shapes).area, 32500) + region = RBA::Region::new(shapes) + region.merged_semantics = false + assert_equal(region.area, 40000) + + assert_equal(RBA::Region::new(shapes, RBA::ICplxTrans::new(0.5)).area, 8125) + region = RBA::Region::new(shapes, RBA::ICplxTrans::new(0.5)) + region.merged_semantics = false + assert_equal(region.area, 10000) + + # for cross-checking: same for RecursiveShapeIterator + + layout = RBA::Layout::new + l1 = layout.insert_layer(RBA::LayerInfo::new(1, 0)) + top = layout.create_cell("TOP") + + top.shapes(l1).insert (RBA::Box::new(0, 0, 100, 200)) + top.shapes(l1).insert (RBA::Box::new(50, 50, 150, 250)) + + si = RBA::RecursiveShapeIterator::new(layout, top, l1) + + assert_equal(RBA::Region::new(si).area, 32500) + region = RBA::Region::new(si) + region.merged_semantics = false + assert_equal(region.area, 40000) + + assert_equal(RBA::Region::new(si, RBA::ICplxTrans::new(0.5)).area, 8125) + region = RBA::Region::new(si, RBA::ICplxTrans::new(0.5)) + region.merged_semantics = false + assert_equal(region.area, 10000) + + end + # deep region tests def test_deep1 From 3cf8b29699a1e883fbec8ca102e3a635517e28fc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 21:57:39 +0100 Subject: [PATCH 69/79] RecursiveShapeIterator debugging --- src/db/db/dbRecursiveShapeIterator.cc | 97 ++++++++++++------- .../dbRecursiveShapeIteratorTests.cc | 72 ++++++++++++++ 2 files changed, 132 insertions(+), 37 deletions(-) diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index 0534ebd3f..33f6c0448 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -790,44 +790,11 @@ RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const box_type new_region = box_type::world (); // compute the region inside the new cell - if (new_region != m_region) { - new_region = m_trans.inverted () * m_region; + if (new_region != m_local_region_stack.back ()) { + new_region = m_inst->complex_trans (*m_inst_array).inverted () * m_local_region_stack.back (); new_region &= cell_bbox (cell_index ()); } - // try some optimization - only consider optimizing by dropping the shape-covered area under certain circumstances: - // - single layer - // - less than 32 shapes to consider - // - total shape bbox in current region covers at least a third of it - // - total area of shapes in current region is at least a third of it - // TODO: the current implementation does not touch the complex search region - - if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! new_region.empty ()) { - - unsigned int l = m_has_layers ? m_layers.front () : m_layer; - const shapes_type &shapes = m_cells.back ()->shapes (l); - box_type region_in_parent = m_inst->complex_trans (*m_inst_array) * new_region; - - // NOTE: new_region is already in the coordinate system of the child cell - - if (shapes.size () < 32 && - 3 * (shapes.bbox () & region_in_parent).area () > region_in_parent.area ()) { - - region_type shapes_region (shapes); - if (3 * shapes_region.area (region_in_parent) > region_in_parent.area ()) { - - shapes_region.transform (m_inst->complex_trans (*m_inst_array).inverted ()); - - // reduce the search region for less instances to look up - region_type new_complex_region = region_type (new_region) - shapes_region; - new_region = new_complex_region.bbox (); - - } - - } - - } - m_local_region_stack.push_back (new_region); if (! m_local_complex_region_stack.empty ()) { @@ -966,7 +933,59 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const new_layer (); - m_inst = cell ()->begin_touching (m_local_region_stack.back ()); + // try some optimization - only consider optimizing by dropping the shape-covered area under certain circumstances: + // - single layer + // - less than 32 shapes to consider + // - total shape bbox in current region covers at least a third of it + // - total area of shapes in current region is at least a third of it + // + // NOTE that this implementation can modify the search box on the box stack + // because we did "new_layer()" already and this function is not going to + // be called, because we do so only for single layers. + + const box_type ®ion = m_local_region_stack.back (); + + if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! region.empty ()) { + + unsigned int l = m_has_layers ? m_layers.front () : m_layer; + const shapes_type &shapes = cell ()->shapes (l); + + if (! shapes.empty () && shapes.size () < 32 && + 3 * (shapes.bbox () & region).area () > region.area ()) { + + region_type shapes_region (shapes); + if (3 * shapes_region.area (region) > region.area ()) { + + // Need to enlarge the empty area somewhat so we really exclude instances + // entirely enclosed by the shape - also the ones at the border. + box_type::vector_type bias; + if (! m_overlapping) { + bias = box_type::vector_type (1, 1); + } + + // reduce the search region for less instances to look up + // NOTE: because we use "touching" for the instances below, we + region_type new_complex_region; + if (region == box_type::world ()) { + new_complex_region = region_type (cell ()->bbox ()) - shapes_region; + } else { + new_complex_region = region_type (cell ()->bbox () & region.enlarged (bias)) - shapes_region; + } + + // TODO: the current implementation does not touch the complex search region + m_local_region_stack.back () = new_complex_region.bbox ().enlarged (-bias); + + } + + } + + } + + if (m_overlapping) { + m_inst = cell ()->begin_touching (m_local_region_stack.back ().enlarged (box_type::vector_type (-1, -1))); + } else { + m_inst = cell ()->begin_touching (m_local_region_stack.back ()); + } m_inst_quad_id = 0; @@ -1015,7 +1034,11 @@ RecursiveShapeIterator::new_inst (RecursiveShapeReceiver *receiver) const // a singular iterator m_inst_array = db::CellInstArray::iterator (m_inst->cell_inst ().front (), false); } else if (with_region) { - m_inst_array = m_inst->cell_inst ().begin_touching (m_local_region_stack.back (), m_box_convert); + if (m_overlapping) { + m_inst_array = m_inst->cell_inst ().begin_touching (m_local_region_stack.back ().enlarged (box_type::vector_type (-1, -1)), m_box_convert); + } else { + m_inst_array = m_inst->cell_inst ().begin_touching (m_local_region_stack.back (), m_box_convert); + } } else { m_inst_array = m_inst->cell_inst ().begin (); } diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index c89af7605..c4fec7476 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -1554,3 +1554,75 @@ TEST(11_LayoutIsWeakPointer) x = collect(i1, *g); EXPECT_EQ (x, ""); } + +TEST(12_ForMerged) +{ + std::unique_ptr g (new db::Layout ()); + g->insert_layer (0); + g->insert_layer (1); + db::Cell &c0 (g->cell (g->add_cell ())); + db::Cell &c1 (g->cell (g->add_cell ())); + db::Cell &c2 (g->cell (g->add_cell ())); + db::Cell &c3 (g->cell (g->add_cell ())); + + db::Box b (0, 100, 1000, 1200); + c0.shapes (0).insert (db::Box (0, 0, 3000, 2000)); + c1.shapes (0).insert (b); + c2.shapes (0).insert (b); + c3.shapes (0).insert (b); + + db::Trans tt; + c0.insert (db::CellInstArray (db::CellInst (c1.cell_index ()), tt)); + c0.insert (db::CellInstArray (db::CellInst (c2.cell_index ()), db::Trans (db::Vector (100, -100)))); + c0.insert (db::CellInstArray (db::CellInst (c3.cell_index ()), db::Trans (1))); + c2.insert (db::CellInstArray (db::CellInst (c3.cell_index ()), db::Trans (db::Vector (1100, 0)))); + + std::string x; + + db::RecursiveShapeIterator i1 (*g, c0, 0); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$2](0,100;1000,1200)/[$3](100,0;1100,1100)/[$4](1200,0;2200,1100)/[$4](-1200,0;-100,1000)"); + + i1.set_for_merged_input (true); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); + + std::vector lv; + lv.push_back (0); + i1 = db::RecursiveShapeIterator (*g, c0, lv); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$2](0,100;1000,1200)/[$3](100,0;1100,1100)/[$4](1200,0;2200,1100)/[$4](-1200,0;-100,1000)"); + + i1.set_for_merged_input (true); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); + + lv.push_back (1); // empty, but kills "for merged" optimization + i1 = db::RecursiveShapeIterator (*g, c0, lv); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$2](0,100;1000,1200)/[$3](100,0;1100,1100)/[$4](1200,0;2200,1100)/[$4](-1200,0;-100,1000)"); + + i1.set_for_merged_input (true); + x = collect(i1, *g); + // no longer optimized + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$2](0,100;1000,1200)/[$3](100,0;1100,1100)/[$4](1200,0;2200,1100)/[$4](-1200,0;-100,1000)"); + + i1 = db::RecursiveShapeIterator (*g, c0, 0, db::Box (-100, 0, 100, 50)); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$3](100,0;1100,1100)/[$4](-1200,0;-100,1000)"); + + i1.set_for_merged_input (true); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); + + i1 = db::RecursiveShapeIterator (*g, c0, 0, db::Box (-101, 0, 100, 50)); + i1.set_overlapping (true); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); + + i1.set_for_merged_input (true); + x = collect(i1, *g); + EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); + + // ... +} From ab93dde25c09b2f53500e1e9f28165183540430c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 22:11:07 +0100 Subject: [PATCH 70/79] Tests for GSI binding --- testdata/ruby/dbRecursiveShapeIterator.rb | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/testdata/ruby/dbRecursiveShapeIterator.rb b/testdata/ruby/dbRecursiveShapeIterator.rb index 29724541c..f4d2d9b9b 100644 --- a/testdata/ruby/dbRecursiveShapeIterator.rb +++ b/testdata/ruby/dbRecursiveShapeIterator.rb @@ -322,6 +322,38 @@ END end + def test_3 + + l = RBA::Layout.new + l.insert_layer_at(0, RBA::LayerInfo.new(1, 0)) + l.insert_layer_at(1, RBA::LayerInfo.new(2, 0)) + c0 = l.cell(l.add_cell("c0")) + c1 = l.cell(l.add_cell("c1")) + c2 = l.cell(l.add_cell("c2")) + c3 = l.cell(l.add_cell("c3")) + + b = RBA::Box.new(0, 100, 1000, 1200) + c0.shapes(0).insert(RBA::Box.new(0, 0, 3000, 2000)) + c1.shapes(0).insert(b) + c2.shapes(0).insert(b) + c3.shapes(0).insert(b) + + tt = RBA::Trans.new + c0.insert(RBA::CellInstArray.new(c1.cell_index, tt)) + c0.insert(RBA::CellInstArray.new(c2.cell_index, RBA::Trans.new(RBA::Vector.new(100, -100)))) + c0.insert(RBA::CellInstArray.new(c3.cell_index, RBA::Trans.new(1))) + c2.insert(RBA::CellInstArray.new(c3.cell_index, RBA::Trans.new(RBA::Vector.new(1100, 0)))) + + ii = RBA::RecursiveShapeIterator.new(l, c0, 0) + assert_equal(ii.for_merged_input, false) + assert_equal(collect(ii, l), "[c0](0,0;3000,2000)/[c1](0,100;1000,1200)/[c2](100,0;1100,1100)/[c3](1200,0;2200,1100)/[c3](-1200,0;-100,1000)") + + ii.for_merged_input = true + assert_equal(ii.for_merged_input, true) + assert_equal(collect(ii, l), "[c0](0,0;3000,2000)/[c3](-1200,0;-100,1000)") + + end + end load("test_epilogue.rb") From b4c7176c52117b04bac158048fc18bac7f525919 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 22:45:58 +0100 Subject: [PATCH 71/79] Bug fixing --- src/db/db/dbRecursiveShapeIterator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index 33f6c0448..7fe8b99ed 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -967,9 +967,9 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const // NOTE: because we use "touching" for the instances below, we region_type new_complex_region; if (region == box_type::world ()) { - new_complex_region = region_type (cell ()->bbox ()) - shapes_region; + new_complex_region = region_type (cell ()->bbox (l)) - shapes_region; } else { - new_complex_region = region_type (cell ()->bbox () & region.enlarged (bias)) - shapes_region; + new_complex_region = region_type (cell ()->bbox (l) & region.enlarged (bias)) - shapes_region; } // TODO: the current implementation does not touch the complex search region From 254f598a087fa5329bfd77c83a2d8ee2db36067d Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 24 Mar 2024 23:03:08 +0100 Subject: [PATCH 72/79] Deploying solution for XOR tool. Needs testing. --- .../tools/xor/lay_plugin/layXORToolDialog.cc | 184 +++++++++--------- 1 file changed, 91 insertions(+), 93 deletions(-) diff --git a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc index 08558adc4..83d2c66e1 100644 --- a/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc +++ b/src/plugins/tools/xor/lay_plugin/layXORToolDialog.cc @@ -772,6 +772,9 @@ XORWorker::do_perform_deep (const XORTask *xor_task) db::RecursiveShapeIterator s_a (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, xor_task->region_a ()); db::RecursiveShapeIterator s_b (mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, xor_task->region_b ()); + s_a.set_for_merged_input (true); + s_b.set_for_merged_input (true); + db::Region ra (s_a, dss, db::ICplxTrans (mp_job->cva ()->layout ().dbu () / mp_job->dbu ())); db::Region rb (s_b, dss, db::ICplxTrans (mp_job->cvb ()->layout ().dbu () / mp_job->dbu ())); @@ -800,6 +803,8 @@ XORWorker::do_perform_deep (const XORTask *xor_task) dbu_scale = db::ICplxTrans (mp_job->cvb ()->layout ().dbu () / mp_job->dbu ()); } + s.set_for_merged_input (true); + rr = db::Region (s, dss, dbu_scale); } @@ -867,119 +872,110 @@ XORWorker::do_perform_tiled (const XORTask *xor_task) if ((!la.empty () && !lb.empty ()) || mp_job->el_handling () == XORJob::EL_process) { - if (! mp_job->has_tiles ()) { + tl::SelfTimer timer (tl::verbosity () >= 31, "Boolean part"); + size_t n; - tl::SelfTimer timer (tl::verbosity () >= 21, "Boolean part"); + if (! merge_before_bool ()) { - if (! merge_before_bool ()) { -# - // Straightforward implementation - sp.boolean (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, - mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, - xor_results_cell.shapes (0), mp_job->op (), true, false, true); + // Straightforward implementation + sp.clear (); + db::CplxTrans dbu_scale_a (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); + db::CplxTrans dbu_scale_b (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); + + n = 0; + db::RecursiveShapeIterator s_a; + if (mp_job->has_tiles ()) { + s_a = db::RecursiveShapeIterator (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); } else { - - // This implementation is faster when a lot of overlapping shapes are involved - db::Layout merge_helper; - db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); - merge_helper.insert_layer (0); - merge_helper.insert_layer (1); - - if (!la.empty ()) { - sp.merge (mp_job->cva ()->layout (), mp_job->cva ()->layout ().cell (mp_job->cva ().cell_index ()), la, - merge_helper_cell.shapes (0), true, 0, false, true); - } - if (!lb.empty ()) { - sp.merge (mp_job->cvb ()->layout (), mp_job->cvb ()->layout ().cell (mp_job->cvb ().cell_index ()), lb, - merge_helper_cell.shapes (1), true, 0, false, true); - } - sp.boolean (merge_helper, merge_helper_cell, 0, - merge_helper, merge_helper_cell, 1, - xor_results_cell.shapes (0), mp_job->op (), true, false, true); - + s_a = db::RecursiveShapeIterator (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la); } + s_a.set_for_merged_input (true); + for ( ; ! s_a.at_end (); ++s_a, ++n) { + sp.insert (s_a.shape (), dbu_scale_a * s_a.trans (), n * 2); + } + + n = 0; + db::RecursiveShapeIterator s_b; + if (mp_job->has_tiles ()) { + s_b = db::RecursiveShapeIterator (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); + } else { + s_b = db::RecursiveShapeIterator (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb); + } + s_b.set_for_merged_input (true); + for (; ! s_b.at_end (); ++s_b, ++n) { + sp.insert (s_b.shape (), dbu_scale_b * s_b.trans (), n * 2 + 1); + } + + db::BooleanOp bool_op (mp_job->op ()); + db::ShapeGenerator sg (xor_results_cell.shapes (0), true /*clear shapes*/); + db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); + sp.process (out, bool_op); } else { - tl::SelfTimer timer (tl::verbosity () >= 31, "Boolean part"); - size_t n; + // This implementation is faster when a lot of overlapping shapes are involved + db::Layout merge_helper; + merge_helper.dbu (mp_job->dbu ()); + db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); + merge_helper.insert_layer (0); + merge_helper.insert_layer (1); - if (! merge_before_bool ()) { + // This implementation is faster when a lot of overlapping shapes are involved + if (!la.empty ()) { - // Straightforward implementation sp.clear (); - db::CplxTrans dbu_scale_a (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); - db::CplxTrans dbu_scale_b (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); + db::CplxTrans dbu_scale (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); n = 0; - for (db::RecursiveShapeIterator s (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale_a * s.trans (), n * 2); + db::RecursiveShapeIterator s; + if (mp_job->has_tiles ()) { + s = db::RecursiveShapeIterator (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); + } else { + s = db::RecursiveShapeIterator (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la); + } + s.set_for_merged_input (true); + for ( ; ! s.at_end (); ++s, ++n) { + sp.insert (s.shape (), dbu_scale * s.trans (), n); } - n = 0; - for (db::RecursiveShapeIterator s (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale_b * s.trans (), n * 2 + 1); - } - - db::BooleanOp bool_op (mp_job->op ()); - db::ShapeGenerator sg (xor_results_cell.shapes (0), true /*clear shapes*/); + db::MergeOp op (0); + db::ShapeGenerator sg (merge_helper_cell.shapes (0), true /*clear shapes*/); db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, bool_op); - - } else { - - // This implementation is faster when a lot of overlapping shapes are involved - db::Layout merge_helper; - merge_helper.dbu (mp_job->dbu ()); - db::Cell &merge_helper_cell = merge_helper.cell (merge_helper.add_cell ()); - merge_helper.insert_layer (0); - merge_helper.insert_layer (1); - - // This implementation is faster when a lot of overlapping shapes are involved - if (!la.empty ()) { - - sp.clear (); - - db::CplxTrans dbu_scale (mp_job->cva ()->layout ().dbu () / xor_results.dbu ()); - - n = 0; - for (db::RecursiveShapeIterator s (mp_job->cva ()->layout (), *mp_job->cva ().cell (), la, xor_task->region_a ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale * s.trans (), n); - } - - db::MergeOp op (0); - db::ShapeGenerator sg (merge_helper_cell.shapes (0), true /*clear shapes*/); - db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, op); - - } - - if (!lb.empty ()) { - - sp.clear (); - - db::CplxTrans dbu_scale (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); - - n = 0; - for (db::RecursiveShapeIterator s (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); ! s.at_end (); ++s, ++n) { - sp.insert (s.shape (), dbu_scale * s.trans (), n); - } - - db::MergeOp op (0); - db::ShapeGenerator sg (merge_helper_cell.shapes (1), true /*clear shapes*/); - db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); - sp.process (out, op); - - } - - sp.boolean (merge_helper, merge_helper_cell, 0, - merge_helper, merge_helper_cell, 1, - xor_results_cell.shapes (0), mp_job->op (), true, false, true); + sp.process (out, op); } + if (!lb.empty ()) { + + sp.clear (); + + db::CplxTrans dbu_scale (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); + + n = 0; + db::RecursiveShapeIterator s; + if (mp_job->has_tiles ()) { + s = db::RecursiveShapeIterator (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb, xor_task->region_b ()); + } else { + s = db::RecursiveShapeIterator (mp_job->cvb ()->layout (), *mp_job->cvb ().cell (), lb); + } + s.set_for_merged_input (true); + for ( ; ! s.at_end (); ++s, ++n) { + sp.insert (s.shape (), dbu_scale * s.trans (), n); + } + + db::MergeOp op (0); + db::ShapeGenerator sg (merge_helper_cell.shapes (1), true /*clear shapes*/); + db::PolygonGenerator out (sg, false /*don't resolve holes*/, false /*no min. coherence*/); + sp.process (out, op); + + } + + sp.boolean (merge_helper, merge_helper_cell, 0, + merge_helper, merge_helper_cell, 1, + xor_results_cell.shapes (0), mp_job->op (), true, false, true); + } } else if (mp_job->op () == db::BooleanOp::Xor || @@ -1005,6 +1001,8 @@ XORWorker::do_perform_tiled (const XORTask *xor_task) dbu_scale = db::CplxTrans (mp_job->cvb ()->layout ().dbu () / xor_results.dbu ()); } + s.set_for_merged_input (true); + for (; ! s.at_end (); ++s) { if (s->is_polygon () || s->is_box () || s->is_path ()) { db::Polygon p; From 40a8f21f9c3510b58d62a10c4f1e2388b4073a7b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 26 Mar 2024 01:05:35 +0100 Subject: [PATCH 73/79] Simplified optimization as performance was bad. --- src/db/db/dbRecursiveShapeIterator.cc | 105 ++++++++++++++++++-------- 1 file changed, 72 insertions(+), 33 deletions(-) diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index 7fe8b99ed..60c9601cc 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -918,6 +918,64 @@ RecursiveShapeIterator::new_layer () const } } +static +RecursiveShapeIterator::box_type +shape_box (const RecursiveShapeIterator::shape_type &shape) +{ + if (shape.is_box ()) { + return shape.box (); + } + + switch (shape.type ()) { + case db::Shape::Polygon: + return shape.polygon ().is_box () ? shape.polygon ().box () : RecursiveShapeIterator::box_type (); + case db::Shape::PolygonRef: + case db::Shape::PolygonPtrArrayMember: + return shape.polygon_ref ().is_box () ? shape.polygon_ref ().box () : RecursiveShapeIterator::box_type (); + case db::Shape::SimplePolygon: + return shape.simple_polygon ().is_box () ? shape.simple_polygon ().box () : RecursiveShapeIterator::box_type (); + case db::Shape::SimplePolygonRef: + case db::Shape::SimplePolygonPtrArrayMember: + return shape.simple_polygon_ref ().is_box () ? shape.simple_polygon_ref ().box () : RecursiveShapeIterator::box_type (); + default: + return RecursiveShapeIterator::box_type (); + } +} + +static +RecursiveShapeIterator::box_type +subtract_box (const RecursiveShapeIterator::box_type &from, const RecursiveShapeIterator::box_type &box) +{ + RecursiveShapeIterator::box_type res (from); + if (box.empty ()) { + return res; + } + + if (! res.empty ()) { + if (box.bottom () <= res.bottom () && box.top () >= res.top ()) { + if (box.left () <= res.left ()) { + res.set_left (std::max (box.right (), res.left ())); + } + if (box.right () >= res.right ()) { + res.set_right (std::min (box.left (), res.right ())); + } + } + } + + if (! res.empty ()) { + if (box.left () <= res.left () && box.right () >= res.right ()) { + if (box.bottom () <= res.bottom ()) { + res.set_bottom (std::max (box.top (), res.bottom ())); + } + if (box.top () >= res.top ()) { + res.set_top (std::min (box.bottom (), res.top ())); + } + } + } + + return res; +} + void RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const { @@ -935,48 +993,29 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const // try some optimization - only consider optimizing by dropping the shape-covered area under certain circumstances: // - single layer - // - less than 32 shapes to consider - // - total shape bbox in current region covers at least a third of it - // - total area of shapes in current region is at least a third of it + // - at least one shape to consider and it is a box + // - that box clips the region entirely on one side // // NOTE that this implementation can modify the search box on the box stack // because we did "new_layer()" already and this function is not going to // be called, because we do so only for single layers. - const box_type ®ion = m_local_region_stack.back (); + if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! m_shape.at_end ()) { - if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! region.empty ()) { - - unsigned int l = m_has_layers ? m_layers.front () : m_layer; - const shapes_type &shapes = cell ()->shapes (l); - - if (! shapes.empty () && shapes.size () < 32 && - 3 * (shapes.bbox () & region).area () > region.area ()) { - - region_type shapes_region (shapes); - if (3 * shapes_region.area (region) > region.area ()) { - - // Need to enlarge the empty area somewhat so we really exclude instances - // entirely enclosed by the shape - also the ones at the border. - box_type::vector_type bias; - if (! m_overlapping) { - bias = box_type::vector_type (1, 1); - } - - // reduce the search region for less instances to look up - // NOTE: because we use "touching" for the instances below, we - region_type new_complex_region; - if (region == box_type::world ()) { - new_complex_region = region_type (cell ()->bbox (l)) - shapes_region; - } else { - new_complex_region = region_type (cell ()->bbox (l) & region.enlarged (bias)) - shapes_region; - } - - // TODO: the current implementation does not touch the complex search region - m_local_region_stack.back () = new_complex_region.bbox ().enlarged (-bias); + box_type box = shape_box (*m_shape); + if (! box.empty ()) { + // Need to enlarge the empty area somewhat so we really exclude instances + // entirely enclosed by the shape - also the ones at the border. + if (! m_overlapping) { + box.enlarge (box_type::vector_type (1, 1)); } + const box_type ®ion = m_local_region_stack.back (); + unsigned int l = m_has_layers ? m_layers.front () : m_layer; + box = subtract_box (cell ()->bbox (l) & region, box); + m_local_region_stack.back () = box; + } } From 3fc32e77c3f9b64da6a863938459874fd9a252b6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 26 Mar 2024 19:15:50 +0100 Subject: [PATCH 74/79] Added full-circuit test for recursive shape iterator --- .../dbRecursiveShapeIteratorTests.cc | 166 +++++++++++++++++- 1 file changed, 164 insertions(+), 2 deletions(-) diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index c4fec7476..2719312bf 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -26,6 +26,10 @@ #include "dbLayoutDiff.h" #include "tlString.h" #include "tlUnitTest.h" +#include "tlFileUtils.h" +#include "tlStream.h" +#include "dbReader.h" +#include "dbWriter.h" #include @@ -1623,6 +1627,164 @@ TEST(12_ForMerged) i1.set_for_merged_input (true); x = collect(i1, *g); EXPECT_EQ (x, "[$1](0,0;3000,2000)/[$4](-1200,0;-100,1000)"); - - // ... } + + +static void write (const db::Region ®ion, const std::string &fn) +{ + db::Layout layout; + const db::Cell &top = layout.cell (layout.add_cell ("TOP")); + unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); + region.insert_into (&layout, top.cell_index (), li); + + tl::OutputStream os (fn); + db::SaveLayoutOptions opt; + opt.set_format_from_filename (fn); + db::Writer writer (opt); + writer.write (layout, os); +} + +TEST(13_ForMergedPerformance) +{ + test_is_long_runner (); + + std::string fn (tl::combine_path (tl::testdata_private (), "oasis/caravel.oas.gz")); + + db::Layout ly; + + { + tl::InputStream is (fn); + db::Reader reader (is); + reader.read (ly); + } + + unsigned l1 = ly.get_layer (db::LayerProperties (66, 20)); + unsigned l2 = ly.get_layer (db::LayerProperties (235, 4)); + + db::RecursiveShapeIterator si1 (ly, ly.cell (*ly.begin_top_down ()), l1); + db::RecursiveShapeIterator si2 (ly, ly.cell (*ly.begin_top_down ()), l2); + + { + tl::SelfTimer timer ("Standard loop on 66/20"); + size_t n = 0; + while (! si1.at_end ()) { + ++si1; + ++n; + } + tl::info << "Counted " << n << " shapes on 66/20"; + EXPECT_EQ (n, size_t (1218378)); + } + + { + tl::SelfTimer timer ("Standard loop on 235/4"); + size_t n = 0; + while (! si2.at_end ()) { + ++si2; + ++n; + } + tl::info << "Counted " << n << " shapes on 235/4"; + EXPECT_EQ (n, size_t (57462)); + } + + si1.set_for_merged_input (true); + si2.set_for_merged_input (true); + + { + tl::SelfTimer timer ("'for_merged' loop on 66/20"); + size_t n = 0; + while (! si1.at_end ()) { + ++si1; + ++n; + } + tl::info << "Counted " << n << " shapes on 66/20"; + EXPECT_EQ (n, size_t (1217072)); + } + + { + tl::SelfTimer timer ("'for_merged' loop on 235/4"); + size_t n = 0; + while (! si2.at_end ()) { + ++si2; + ++n; + } + tl::info << "Counted " << n << " shapes on 235/4"; + EXPECT_EQ (n, size_t (919)); + } + + si1.set_for_merged_input (false); + si1.set_region (db::Box (0, 0, 1000000, 1000000)); + si2.set_for_merged_input (false); + si2.set_region (db::Box (0, 0, 1000000, 1000000)); + + { + tl::SelfTimer timer ("Standard loop on 66/20"); + size_t n = 0; + while (! si1.at_end ()) { + ++si1; + ++n; + } + tl::info << "Counted " << n << " shapes on 66/20"; + EXPECT_EQ (n, size_t (218823)); + } + + { + tl::SelfTimer timer ("Standard loop on 235/4"); + size_t n = 0; + while (! si2.at_end ()) { + ++si2; + ++n; + } + tl::info << "Counted " << n << " shapes on 235/4"; + EXPECT_EQ (n, size_t (2578)); + } + + si1.set_for_merged_input (true); + si2.set_for_merged_input (true); + + { + tl::SelfTimer timer ("'for_merged' loop on 66/20"); + size_t n = 0; + while (! si1.at_end ()) { + ++si1; + ++n; + } + tl::info << "Counted " << n << " shapes on 66/20"; + EXPECT_EQ (n, size_t (218736)); + } + + { + tl::SelfTimer timer ("'for_merged' loop on 235/4"); + size_t n = 0; + while (! si2.at_end ()) { + ++si2; + ++n; + } + tl::info << "Counted " << n << " shapes on 235/4"; + EXPECT_EQ (n, size_t (1)); + } + + { + tl::SelfTimer timer ("XOR on tile of 66/20"); + si1.set_for_merged_input (false); + db::Region r1 (si1); + si1.set_for_merged_input (true); + db::Region r2 (si1); + + EXPECT_EQ (r1.count (), size_t (218823)); + EXPECT_EQ (r2.count (), size_t (218736)); + EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); + } + + { + tl::SelfTimer timer ("XOR on tile of 235/4"); + si2.set_for_merged_input (false); + db::Region r1 (si2); + si2.set_for_merged_input (true); + db::Region r2 (si2); + + EXPECT_EQ (r1.count (), size_t (2578)); + EXPECT_EQ (r2.count (), size_t (1)); + EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); + } +} + From 5699c91d3f1ad7244d374fc190320e51074ce1d0 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 26 Mar 2024 21:48:38 +0100 Subject: [PATCH 75/79] Some utility features derived from the latest code changes - Subtraction of boxes (pya/RBA: Box minus operator) - Shape#rectangle, Shape#drectangle - EdgePairs#write, Edges#write, Texts#write, Region#write for debugging --- src/db/db/dbBox.h | 82 ++++++++++++++++++ src/db/db/dbEdgePairs.cc | 20 +++++ src/db/db/dbEdgePairs.h | 8 ++ src/db/db/dbEdges.cc | 20 +++++ src/db/db/dbEdges.h | 8 ++ src/db/db/dbRecursiveShapeIterator.cc | 62 +------------ src/db/db/dbRegion.cc | 20 +++++ src/db/db/dbRegion.h | 8 ++ src/db/db/dbShape.cc | 55 ++++++++++++ src/db/db/dbShape.h | 10 +++ src/db/db/dbTexts.cc | 21 ++++- src/db/db/dbTexts.h | 8 ++ src/db/db/gsiDeclDbBox.cc | 15 ++++ src/db/db/gsiDeclDbEdgePairs.cc | 6 ++ src/db/db/gsiDeclDbEdges.cc | 6 ++ src/db/db/gsiDeclDbRegion.cc | 6 ++ src/db/db/gsiDeclDbShape.cc | 36 ++++++++ src/db/db/gsiDeclDbTexts.cc | 6 ++ src/db/unit_tests/dbBoxTests.cc | 11 +++ .../dbRecursiveShapeIteratorTests.cc | 14 --- src/db/unit_tests/dbShapeTests.cc | 86 +++++++++++++++++++ testdata/ruby/dbBoxTest.rb | 3 + testdata/ruby/dbShapesTest.rb | 4 + 23 files changed, 440 insertions(+), 75 deletions(-) diff --git a/src/db/db/dbBox.h b/src/db/db/dbBox.h index 94e2ac58c..cf7d4b233 100644 --- a/src/db/db/dbBox.h +++ b/src/db/db/dbBox.h @@ -254,6 +254,27 @@ struct DB_PUBLIC_TEMPLATE box */ box &operator+= (const point &p); + /** + * @brief Subtraction of boxes. + * + * The -= operator subtracts the argument box from *this. + * Subtraction leaves the bounding box of the region resulting + * from the geometrical NOT of *this and the argument box. + * Subtracting a box from itself gives an empty box. + * Subtracting a box that does not cover a full side of + * *this will not modify the box. + * + * @param b The box to subtract from *this. + * + * @return The result box. + */ + box &operator-= (const box &b); + + /** + * @brief A method version for operator- (mainly for automation purposes) + */ + box subtracted (const box &b) const; + /** * @brief Intersection of boxes. * @@ -784,6 +805,50 @@ box::operator+= (const point &p) return *this; } +template +inline box +box::subtracted (const box &b) const +{ + box r (*this); + r -= b; + return r; +} + +template +inline box & +box::operator-= (const box &bx) +{ + if (bx.empty () || empty ()) { + return *this; + } + + coord_type l = m_p1.x (), r = m_p2.x (); + coord_type b = m_p1.y (), t = m_p2.y (); + + if (bx.bottom () <= bottom () && bx.top () >= top ()) { + if (bx.left () <= left ()) { + l = std::max (bx.right (), left ()); + } + if (bx.right () >= right ()) { + r = std::min (bx.left (), right ()); + } + } + + if (bx.left () <= left () && bx.right () >= right ()) { + if (bx.bottom () <= bottom ()) { + b = std::max (bx.top (), bottom ()); + } + if (bx.top () >= top ()) { + t = std::min (bx.bottom (), top ()); + } + } + + m_p1 = point_type (l, b); + m_p2 = point_type (r, t); + + return *this; +} + template inline box & box::operator&= (const box &b) @@ -1363,6 +1428,23 @@ operator+ (const box &b1, const box &b2) return bb; } +/** + * @brief Box subtraction mapped on the - operator + * + * @param b1 The first box + * @param b2 The second box to subtract from the first + * + * @return The bounding box of the region formed but subtracting b2 from b1 + */ +template +inline box +operator- (const box &b1, const box &b2) +{ + box bb (b1); + bb -= b2; + return bb; +} + /** * @brief "Folding" of two boxes * diff --git a/src/db/db/dbEdgePairs.cc b/src/db/db/dbEdgePairs.cc index fcfd405f9..6e0d9059e 100644 --- a/src/db/db/dbEdgePairs.cc +++ b/src/db/db/dbEdgePairs.cc @@ -30,6 +30,9 @@ #include "dbOriginalLayerEdgePairs.h" #include "dbEdges.h" #include "dbRegion.h" +#include "dbLayout.h" +#include "dbWriter.h" +#include "tlStream.h" #include "tlVariant.h" @@ -93,6 +96,23 @@ EdgePairs::EdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, con mp_delegate = new DeepEdgePairs (si, dss, trans); } +void +EdgePairs::write (const std::string &fn) const +{ + // method provided for debugging purposes + + db::Layout layout; + const db::Cell &top = layout.cell (layout.add_cell ("EDGE_PAIRS")); + unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); + insert_into (&layout, top.cell_index (), li); + + tl::OutputStream os (fn); + db::SaveLayoutOptions opt; + opt.set_format_from_filename (fn); + db::Writer writer (opt); + writer.write (layout, os); +} + template void EdgePairs::insert (const Sh &shape) { diff --git a/src/db/db/dbEdgePairs.h b/src/db/db/dbEdgePairs.h index 9d1b1aee2..53a499689 100644 --- a/src/db/db/dbEdgePairs.h +++ b/src/db/db/dbEdgePairs.h @@ -185,6 +185,14 @@ public: */ explicit EdgePairs (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans); + /** + * @brief Writes the edge pair collection to a file + * + * This method is provided for debugging purposes. A flat image of the + * region is written to a layout file with a single top cell on layer 0/0. + */ + void write (const std::string &fn) const; + /** * @brief Implementation of the ShapeCollection interface */ diff --git a/src/db/db/dbEdges.cc b/src/db/db/dbEdges.cc index e5a6cf007..5cdefe414 100644 --- a/src/db/db/dbEdges.cc +++ b/src/db/db/dbEdges.cc @@ -28,6 +28,9 @@ #include "dbFlatEdges.h" #include "dbEdgesUtils.h" #include "dbRegion.h" +#include "dbLayout.h" +#include "dbWriter.h" +#include "tlStream.h" namespace db { @@ -141,6 +144,23 @@ Edges::set_delegate (EdgesDelegate *delegate, bool keep_attributes) } } +void +Edges::write (const std::string &fn) const +{ + // method provided for debugging purposes + + db::Layout layout; + const db::Cell &top = layout.cell (layout.add_cell ("EDGES")); + unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); + insert_into (&layout, top.cell_index (), li); + + tl::OutputStream os (fn); + db::SaveLayoutOptions opt; + opt.set_format_from_filename (fn); + db::Writer writer (opt); + writer.write (layout, os); +} + void Edges::clear () { diff --git a/src/db/db/dbEdges.h b/src/db/db/dbEdges.h index 28decbbb6..ffb8ab6ff 100644 --- a/src/db/db/dbEdges.h +++ b/src/db/db/dbEdges.h @@ -833,6 +833,14 @@ public: return *this; } + /** + * @brief Writes the edge collection to a file + * + * This method is provided for debugging purposes. A flat image of the + * region is written to a layout file with a single top cell on layer 0/0. + */ + void write (const std::string &fn) const; + /** * @brief Intersections with other edges * Intersections are similar to "AND", but will also report diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index 60c9601cc..c918068ff 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -918,64 +918,6 @@ RecursiveShapeIterator::new_layer () const } } -static -RecursiveShapeIterator::box_type -shape_box (const RecursiveShapeIterator::shape_type &shape) -{ - if (shape.is_box ()) { - return shape.box (); - } - - switch (shape.type ()) { - case db::Shape::Polygon: - return shape.polygon ().is_box () ? shape.polygon ().box () : RecursiveShapeIterator::box_type (); - case db::Shape::PolygonRef: - case db::Shape::PolygonPtrArrayMember: - return shape.polygon_ref ().is_box () ? shape.polygon_ref ().box () : RecursiveShapeIterator::box_type (); - case db::Shape::SimplePolygon: - return shape.simple_polygon ().is_box () ? shape.simple_polygon ().box () : RecursiveShapeIterator::box_type (); - case db::Shape::SimplePolygonRef: - case db::Shape::SimplePolygonPtrArrayMember: - return shape.simple_polygon_ref ().is_box () ? shape.simple_polygon_ref ().box () : RecursiveShapeIterator::box_type (); - default: - return RecursiveShapeIterator::box_type (); - } -} - -static -RecursiveShapeIterator::box_type -subtract_box (const RecursiveShapeIterator::box_type &from, const RecursiveShapeIterator::box_type &box) -{ - RecursiveShapeIterator::box_type res (from); - if (box.empty ()) { - return res; - } - - if (! res.empty ()) { - if (box.bottom () <= res.bottom () && box.top () >= res.top ()) { - if (box.left () <= res.left ()) { - res.set_left (std::max (box.right (), res.left ())); - } - if (box.right () >= res.right ()) { - res.set_right (std::min (box.left (), res.right ())); - } - } - } - - if (! res.empty ()) { - if (box.left () <= res.left () && box.right () >= res.right ()) { - if (box.bottom () <= res.bottom ()) { - res.set_bottom (std::max (box.top (), res.bottom ())); - } - if (box.top () >= res.top ()) { - res.set_top (std::min (box.bottom (), res.top ())); - } - } - } - - return res; -} - void RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const { @@ -1002,7 +944,7 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! m_shape.at_end ()) { - box_type box = shape_box (*m_shape); + box_type box = m_shape->rectangle (); if (! box.empty ()) { // Need to enlarge the empty area somewhat so we really exclude instances @@ -1013,7 +955,7 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const const box_type ®ion = m_local_region_stack.back (); unsigned int l = m_has_layers ? m_layers.front () : m_layer; - box = subtract_box (cell ()->bbox (l) & region, box); + box = (cell ()->bbox (l) & region) - box; m_local_region_stack.back () = box; } diff --git a/src/db/db/dbRegion.cc b/src/db/db/dbRegion.cc index c05f9d338..2d04a2758 100644 --- a/src/db/db/dbRegion.cc +++ b/src/db/db/dbRegion.cc @@ -31,6 +31,9 @@ #include "dbFlatEdges.h" #include "dbPolygonTools.h" #include "dbCompoundOperation.h" +#include "dbLayout.h" +#include "dbWriter.h" +#include "tlStream.h" #include "tlGlobPattern.h" // NOTE: include this to provide the symbols for "make_variant" @@ -129,6 +132,23 @@ Region::Region (DeepShapeStore &dss) mp_delegate = new db::DeepRegion (db::DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ())); } +void +Region::write (const std::string &fn) const +{ + // method provided for debugging purposes + + db::Layout layout; + const db::Cell &top = layout.cell (layout.add_cell ("REGION")); + unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); + insert_into (&layout, top.cell_index (), li); + + tl::OutputStream os (fn); + db::SaveLayoutOptions opt; + opt.set_format_from_filename (fn); + db::Writer writer (opt); + writer.write (layout, os); +} + const db::RecursiveShapeIterator & Region::iter () const { diff --git a/src/db/db/dbRegion.h b/src/db/db/dbRegion.h index 1329adcc8..145018ef0 100644 --- a/src/db/db/dbRegion.h +++ b/src/db/db/dbRegion.h @@ -248,6 +248,14 @@ public: */ explicit Region (DeepShapeStore &dss); + /** + * @brief Writes the region to a file + * + * This method is provided for debugging purposes. A flat image of the + * region is written to a layout file with a single top cell on layer 0/0. + */ + void write (const std::string &fn) const; + /** * @brief Implementation of the ShapeCollection interface */ diff --git a/src/db/db/dbShape.cc b/src/db/db/dbShape.cc index 47fc28776..e5c1d7820 100644 --- a/src/db/db/dbShape.cc +++ b/src/db/db/dbShape.cc @@ -807,6 +807,61 @@ Shape::box_type Shape::bbox () const } } +Shape::box_type Shape::rectangle () const +{ + if (is_box ()) { + return box (); + } + + switch (m_type) { + case db::Shape::Polygon: + return polygon ().is_box () ? polygon ().box () : box_type (); + case db::Shape::PolygonRef: + case db::Shape::PolygonPtrArrayMember: + return polygon_ref ().is_box () ? polygon_ref ().box () : box_type (); + case db::Shape::SimplePolygon: + return simple_polygon ().is_box () ? simple_polygon ().box () : box_type (); + case db::Shape::SimplePolygonRef: + case db::Shape::SimplePolygonPtrArrayMember: + return simple_polygon_ref ().is_box () ? simple_polygon_ref ().box () : box_type (); + case db::Shape::Path: + { + const path_type &p = path (); + if (! p.round () && p.points () <= 2 && p.points () > 0) { + point_type p1 = *p.begin (); + point_type p2 = p1; + if (p.points () == 2) { + p2 = *++p.begin (); + } + if (p1.x () == p2.x () || p1.y () == p2.y ()) { + return p.box (); + } + } + } + break; + case db::Shape::PathRef: + case db::Shape::PathPtrArrayMember: + { + const path_ref_type &p = path_ref (); + if (! p.ptr ()->round () && p.ptr ()->points () <= 2 && p.ptr ()->points () > 0) { + point_type p1 = *p.begin (); + point_type p2 = p1; + if (p.ptr ()->points () == 2) { + p2 = *++p.begin (); + } + if (p1.x () == p2.x () || p1.y () == p2.y ()) { + return p.box (); + } + } + } + break; + default: + break; + } + + return box_type (); +} + std::string Shape::to_string () const { diff --git a/src/db/db/dbShape.h b/src/db/db/dbShape.h index 5ab336667..dd003b47e 100644 --- a/src/db/db/dbShape.h +++ b/src/db/db/dbShape.h @@ -2651,6 +2651,16 @@ public: */ box_type bbox () const; + /** + * @brief Returns the box if the object represents a rectangle or an empty box if not + * + * This method returns the rectangle (aka box) the shape represents a polygon + * that is a rectangle, a path with two points and no rounded ends or an actual box. + * + * If not, an empty box is returned. + */ + box_type rectangle () const; + /** * @brief Compute the area of the shape */ diff --git a/src/db/db/dbTexts.cc b/src/db/db/dbTexts.cc index 0b90c8897..388c89696 100644 --- a/src/db/db/dbTexts.cc +++ b/src/db/db/dbTexts.cc @@ -30,7 +30,9 @@ #include "dbOriginalLayerTexts.h" #include "dbEdges.h" #include "dbRegion.h" - +#include "dbLayout.h" +#include "dbWriter.h" +#include "tlStream.h" #include "tlVariant.h" #include @@ -90,6 +92,23 @@ Texts::Texts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::I mp_delegate = new DeepTexts (si, dss, trans); } +void +Texts::write (const std::string &fn) const +{ + // method provided for debugging purposes + + db::Layout layout; + const db::Cell &top = layout.cell (layout.add_cell ("TEXTS")); + unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); + insert_into (&layout, top.cell_index (), li); + + tl::OutputStream os (fn); + db::SaveLayoutOptions opt; + opt.set_format_from_filename (fn); + db::Writer writer (opt); + writer.write (layout, os); +} + template void Texts::insert (const Sh &shape) { diff --git a/src/db/db/dbTexts.h b/src/db/db/dbTexts.h index 82d017187..cacda8589 100644 --- a/src/db/db/dbTexts.h +++ b/src/db/db/dbTexts.h @@ -181,6 +181,14 @@ public: */ explicit Texts (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans); + /** + * @brief Writes the text collection to a file + * + * This method is provided for debugging purposes. A flat image of the + * region is written to a layout file with a single top cell on layer 0/0. + */ + void write (const std::string &fn) const; + /** * @brief Implementation of the ShapeCollection interface */ diff --git a/src/db/db/gsiDeclDbBox.cc b/src/db/db/gsiDeclDbBox.cc index 50dc0d883..d2c5fcc8f 100644 --- a/src/db/db/gsiDeclDbBox.cc +++ b/src/db/db/gsiDeclDbBox.cc @@ -324,6 +324,21 @@ struct box_defs "\n" "@return The joined box\n" ) + + method ("-", &C::subtracted, gsi::arg ("box"), + "@brief Subtraction of boxes\n" + "\n" + "\n" + "The - operator subtracts the argument box from self.\n" + "This will return the bounding box of the are covered by self, but not by argument box. " + "Subtracting a box from itself will render an empty box. Subtracting another box from " + "self will modify the first box only if the argument box covers one side entirely.\n" + "\n" + "@param box The box to subtract from this box.\n" + "\n" + "@return The result box\n" + "\n" + "This feature has been introduced in version 0.29." + ) + method ("&", &C::intersection, gsi::arg ("box"), "@brief Returns the intersection of this box with another box\n" "\n" diff --git a/src/db/db/gsiDeclDbEdgePairs.cc b/src/db/db/gsiDeclDbEdgePairs.cc index 4a22f7045..b4f6b5447 100644 --- a/src/db/db/gsiDeclDbEdgePairs.cc +++ b/src/db/db/gsiDeclDbEdgePairs.cc @@ -602,6 +602,12 @@ Class decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs", "\n" "This constructor has been introduced in version 0.26." ) + + method ("write", &db::EdgePairs::write, gsi::arg ("filename"), + "@brief Writes the region to a file\n" + "This method is provided for debugging purposes. It writes the object to a flat layer 0/0 in a single top cell.\n" + "\n" + "This method has been introduced in version 0.29." + ) + method ("insert_into", &db::EdgePairs::insert_into, gsi::arg ("layout"), gsi::arg ("cell_index"), gsi::arg ("layer"), "@brief Inserts this edge pairs into the given layout, below the given cell and into the given layer.\n" "If the edge pair collection is a hierarchical one, a suitable hierarchy will be built below the top cell or " diff --git a/src/db/db/gsiDeclDbEdges.cc b/src/db/db/gsiDeclDbEdges.cc index d325dfa26..5fc83ec49 100644 --- a/src/db/db/gsiDeclDbEdges.cc +++ b/src/db/db/gsiDeclDbEdges.cc @@ -1567,6 +1567,12 @@ Class decl_Edges (decl_dbShapeCollection, "db", "Edges", "\n" "This method has been added in version 0.28.\n" ) + + method ("write", &db::Edges::write, gsi::arg ("filename"), + "@brief Writes the region to a file\n" + "This method is provided for debugging purposes. It writes the object to a flat layer 0/0 in a single top cell.\n" + "\n" + "This method has been introduced in version 0.29." + ) + method ("clear", &db::Edges::clear, "@brief Clears the edge collection\n" ) + diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index ad941cc27..c5d6c6570 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -1221,6 +1221,12 @@ Class decl_Region (decl_dbShapeCollection, "db", "Region", "\n" "This method has been introduced in version 0.26." ) + + method ("write", &db::Region::write, gsi::arg ("filename"), + "@brief Writes the region to a file\n" + "This method is provided for debugging purposes. It writes the object to a flat layer 0/0 in a single top cell.\n" + "\n" + "This method has been introduced in version 0.29." + ) + factory_ext ("texts", &texts_as_boxes1, gsi::arg ("expr", std::string ("*")), gsi::arg ("as_pattern", true), gsi::arg ("enl", 1), "@hide\n" "This method is provided for DRC implementation only." diff --git a/src/db/db/gsiDeclDbShape.cc b/src/db/db/gsiDeclDbShape.cc index c6671d9b7..68f6ff4fb 100644 --- a/src/db/db/gsiDeclDbShape.cc +++ b/src/db/db/gsiDeclDbShape.cc @@ -669,6 +669,26 @@ static tl::Variant get_dbox (const db::Shape *s) } } +static tl::Variant get_rectangle (const db::Shape *s) +{ + db::Shape::box_type b = s->rectangle (); + if (! b.empty ()) { + return tl::Variant (b); + } else { + return tl::Variant (); + } +} + +static tl::Variant get_drectangle (const db::Shape *s) +{ + db::Shape::box_type b = s->rectangle (); + if (! b.empty ()) { + return tl::Variant (db::CplxTrans (shape_dbu (s)) * b); + } else { + return tl::Variant (); + } +} + static tl::Variant get_edge (const db::Shape *s) { db::Shape::edge_type p; @@ -1982,6 +2002,22 @@ Class decl_Shape ("db", "Shape", "\n" "This method has been added in version 0.25.\n" ) + + gsi::method_ext ("rectangle", &get_rectangle, + "@brief Gets the rectangle if the object represents one or nil if not\n" + "\n" + "If the shape represents a rectangle - i.e. a box or box polygon, a path with two points and no round ends - " + "this method returns the box. If not, nil is returned.\n" + "\n" + "This method has been introduced in version 0.29." + ) + + gsi::method_ext ("drectangle", &get_drectangle, + "@brief Gets the rectangle in micron units if the object represents one or nil if not\n" + "\n" + "If the shape represents a rectangle - i.e. a box or box polygon, a path with two points and no round ends - " + "this method returns the box. If not, nil is returned.\n" + "\n" + "This method has been introduced in version 0.29." + ) + gsi::method ("is_user_object?", &db::Shape::is_user_object, "@brief Returns true if the shape is a user defined object\n" ) + diff --git a/src/db/db/gsiDeclDbTexts.cc b/src/db/db/gsiDeclDbTexts.cc index 8be9238b8..359249795 100644 --- a/src/db/db/gsiDeclDbTexts.cc +++ b/src/db/db/gsiDeclDbTexts.cc @@ -436,6 +436,12 @@ Class decl_Texts (decl_dbShapeCollection, "db", "Texts", "r = RBA::Texts::new(layout.begin_shapes(cell, layer), RBA::ICplxTrans::new(layout.dbu / dbu))\n" "@/code\n" ) + + method ("write", &db::Texts::write, gsi::arg ("filename"), + "@brief Writes the region to a file\n" + "This method is provided for debugging purposes. It writes the object to a flat layer 0/0 in a single top cell.\n" + "\n" + "This method has been introduced in version 0.29." + ) + method ("insert_into", &db::Texts::insert_into, gsi::arg ("layout"), gsi::arg ("cell_index"), gsi::arg ("layer"), "@brief Inserts this texts into the given layout, below the given cell and into the given layer.\n" "If the text collection is a hierarchical one, a suitable hierarchy will be built below the top cell or " diff --git a/src/db/unit_tests/dbBoxTests.cc b/src/db/unit_tests/dbBoxTests.cc index d70e942fc..1ac60f799 100644 --- a/src/db/unit_tests/dbBoxTests.cc +++ b/src/db/unit_tests/dbBoxTests.cc @@ -49,6 +49,17 @@ TEST(2) EXPECT_EQ (b & db::Box (110, 220, 120, 250), empty); EXPECT_EQ (b & db::Box (50, 100, 120, 250), db::Box (50, 100, 100, 200)); EXPECT_EQ (b & db::Box (50, 100, 60, 120), db::Box (50, 100, 60, 120)); + EXPECT_EQ (b - b, db::Box ()); + EXPECT_EQ (b - db::Box (), b); + EXPECT_EQ (db::Box () - b, db::Box ()); + EXPECT_EQ (db::Box () - db::Box (), db::Box ()); + EXPECT_EQ (b - db::Box (0, 0, 50, 50), b); + EXPECT_EQ (b - db::Box (0, 0, 50, 200), db::Box (50, 0, 100, 200)); + EXPECT_EQ (b - db::Box (50, 0, 100, 200), db::Box (0, 0, 50, 200)); + EXPECT_EQ (b - db::Box (0, 0, 100, 100), db::Box (0, 100, 100, 200)); + EXPECT_EQ (b - db::Box (0, 100, 100, 200), db::Box (0, 0, 100, 100)); + EXPECT_EQ (db::Box::world () - b, db::Box::world ()); + EXPECT_EQ (b - db::Box::world (), db::Box ()); empty.move (db::Vector (10, 20)); EXPECT_EQ (empty == db::Box (), true); diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index 2719312bf..4dda034db 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -1630,20 +1630,6 @@ TEST(12_ForMerged) } -static void write (const db::Region ®ion, const std::string &fn) -{ - db::Layout layout; - const db::Cell &top = layout.cell (layout.add_cell ("TOP")); - unsigned int li = layout.insert_layer (db::LayerProperties (0, 0)); - region.insert_into (&layout, top.cell_index (), li); - - tl::OutputStream os (fn); - db::SaveLayoutOptions opt; - opt.set_format_from_filename (fn); - db::Writer writer (opt); - writer.write (layout, os); -} - TEST(13_ForMergedPerformance) { test_is_long_runner (); diff --git a/src/db/unit_tests/dbShapeTests.cc b/src/db/unit_tests/dbShapeTests.cc index b6f8b514c..1d4a19003 100644 --- a/src/db/unit_tests/dbShapeTests.cc +++ b/src/db/unit_tests/dbShapeTests.cc @@ -948,3 +948,89 @@ TEST(9) EXPECT_EQ (si.at_end (), true); } +// Rectangle +TEST(10) +{ + db::Manager m (true); + db::Shapes s (&m, 0, db::default_editable_mode ()); + db::ShapeIterator si; + + s.insert (db::Point (100, 200)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::Edge (db::Point (100, 200), db::Point (200, 400))); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::EdgePair (db::Edge (db::Point (100, 200), db::Point (200, 400)), db::Edge (db::Point (0, 300), db::Point (100, 500)))); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::Box (0, 0, 1000, 2000)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (0, 0, 1000, 2000)); + + s.clear (); + s.insert (db::ShortBox (0, 0, 1000, 2000)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (0, 0, 1000, 2000)); + + s.clear (); + s.insert (db::Polygon (db::Box (0, 0, 1000, 2000))); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (0, 0, 1000, 2000)); + + s.clear (); + s.insert (db::Polygon ()); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::SimplePolygon (db::Box (0, 0, 1000, 2000))); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (0, 0, 1000, 2000)); + + s.clear (); + s.insert (db::SimplePolygon ()); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::Path ()); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + db::Point pts1 [1] = { db::Point (0, 0) }; + db::Point pts2 [2] = { db::Point (0, 0), db::Point (1000, 0) }; + db::Point pts2b [2] = { db::Point (0, 0), db::Point (1000, 1000) }; + db::Point pts3 [3] = { db::Point (0, 0), db::Point (1000, 0), db::Point (1000, 1000) }; + + s.clear (); + s.insert (db::Path (pts1 + 0, pts1 + 1, 1000, 500, 500)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (-500, -500, 500, 500)); + + s.clear (); + s.insert (db::Path (pts2 + 0, pts2 + 2, 1000, 500, 500)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle (), db::Box (-500, -500, 1500, 500)); + + s.clear (); + s.insert (db::Path (pts2 + 0, pts2 + 2, 1000, 500, 500, true)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::Path (pts2b + 0, pts2b + 2, 1000, 500, 500)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); + + s.clear (); + s.insert (db::Path (pts3 + 0, pts3 + 3, 1000, 500, 500)); + si = s.begin (db::ShapeIterator::All); + EXPECT_EQ (si->rectangle ().empty (), true); +} diff --git a/testdata/ruby/dbBoxTest.rb b/testdata/ruby/dbBoxTest.rb index 8e9a916e9..1a207ef81 100644 --- a/testdata/ruby/dbBoxTest.rb +++ b/testdata/ruby/dbBoxTest.rb @@ -146,6 +146,9 @@ class DBBox_TestClass < TestBase assert_equal( a + b, b ) assert_equal( (b + c).to_s, "(1,-10;22,22)" ) + assert_equal( b - a, b ) + assert_equal( (b - c).to_s, "(1,-1;17,22)" ) + assert_equal( a + RBA::DPoint::new( 1, -5 ), RBA::DBox::new( 1, -5, 1, -5 ) ) assert_equal( (b + RBA::DPoint::new( 1, -5 )).to_s, "(1,-5;17,22)" ) diff --git a/testdata/ruby/dbShapesTest.rb b/testdata/ruby/dbShapesTest.rb index 3417c8688..bca7672cf 100644 --- a/testdata/ruby/dbShapesTest.rb +++ b/testdata/ruby/dbShapesTest.rb @@ -178,6 +178,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_polygon?, false ) assert_equal( arr[0].is_box?, true ) assert_equal( arr[0].box.to_s, "(10,-10;50,40)" ) + assert_equal( arr[0].rectangle.to_s, "(10,-10;50,40)" ) assert_equal( arr[0].bbox.to_s, "(10,-10;50,40)" ) # edges @@ -198,6 +199,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].edge.to_s, "(-1,2;5,2)" ) assert_equal( arr[0].edge_pair.inspect, "nil" ) assert_equal( arr[0].box.inspect, "nil" ) + assert_equal( arr[0].rectangle.inspect, "nil" ) assert_equal( arr[0].path.inspect, "nil" ) assert_equal( arr[0].text.inspect, "nil" ) assert_equal( arr[0].edge == a, true ) @@ -533,6 +535,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].dedge.inspect, "nil" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) assert_equal( arr[0].dbox.to_s, "(0.01,-0.01;0.05,0.04)" ) + assert_equal( arr[0].drectangle.to_s, "(0.01,-0.01;0.05,0.04)" ) assert_equal( arr[0].dpath.inspect, "nil" ) assert_equal( arr[0].dtext.inspect, "nil" ) assert_equal( arr[0].is_polygon?, false ) @@ -557,6 +560,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].dedge.to_s, "(-0.001,0.002;0.005,0.002)" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) assert_equal( arr[0].dbox.inspect, "nil" ) + assert_equal( arr[0].drectangle.inspect, "nil" ) assert_equal( arr[0].dpath.inspect, "nil" ) assert_equal( arr[0].dtext.inspect, "nil" ) assert_equal( arr[0].dbbox.to_s, "(-0.001,0.002;0.005,0.002)" ) From cb5a1f7d3edbd413aeb3abc3858ad9fde264d95f Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 27 Mar 2024 23:46:33 +0100 Subject: [PATCH 76/79] Refining shape iterator optimization, so it checks instances for overlap with shapes rather the other way round. This suits better to real test cases. --- src/buddies/src/bd/strmxor.cc | 10 +++- src/db/db/dbRecursiveShapeIterator.cc | 56 +++++++++---------- .../dbRecursiveShapeIteratorTests.cc | 12 ++-- 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/src/buddies/src/bd/strmxor.cc b/src/buddies/src/bd/strmxor.cc index 9bd72e860..de1f265e4 100644 --- a/src/buddies/src/bd/strmxor.cc +++ b/src/buddies/src/bd/strmxor.cc @@ -680,13 +680,17 @@ bool run_tiled_xor (const XORData &xor_data) if (ll->second.first < 0) { proc.input (in_a, db::RecursiveShapeIterator ()); } else { - proc.input (in_a, db::RecursiveShapeIterator (*xor_data.layout_a, xor_data.layout_a->cell (xor_data.cell_a), ll->second.first)); + db::RecursiveShapeIterator si (*xor_data.layout_a, xor_data.layout_a->cell (xor_data.cell_a), ll->second.first); + si.set_for_merged_input (true); + proc.input (in_a, si); } if (ll->second.second < 0) { proc.input (in_b, db::RecursiveShapeIterator ()); } else { - proc.input (in_b, db::RecursiveShapeIterator (*xor_data.layout_b, xor_data.layout_b->cell (xor_data.cell_b), ll->second.second)); + db::RecursiveShapeIterator si (*xor_data.layout_b, xor_data.layout_b->cell (xor_data.cell_b), ll->second.second); + si.set_for_merged_input (true); + proc.input (in_b, si); } std::string expr = "var x=" + in_a + "^" + in_b + "; "; @@ -805,10 +809,12 @@ bool run_deep_xor (const XORData &xor_data) if (ll->second.first >= 0) { ri_a = db::RecursiveShapeIterator (*xor_data.layout_a, xor_data.layout_a->cell (xor_data.cell_a), ll->second.first); + ri_a.set_for_merged_input (true); } if (ll->second.second >= 0) { ri_b = db::RecursiveShapeIterator (*xor_data.layout_b, xor_data.layout_b->cell (xor_data.cell_b), ll->second.second); + ri_b.set_for_merged_input (true); } db::Region in_a (ri_a, dss, db::ICplxTrans (xor_data.layout_a->dbu () / dbu)); diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index c918068ff..b86f5d010 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -933,35 +933,6 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const new_layer (); - // try some optimization - only consider optimizing by dropping the shape-covered area under certain circumstances: - // - single layer - // - at least one shape to consider and it is a box - // - that box clips the region entirely on one side - // - // NOTE that this implementation can modify the search box on the box stack - // because we did "new_layer()" already and this function is not going to - // be called, because we do so only for single layers. - - if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1) && ! m_shape.at_end ()) { - - box_type box = m_shape->rectangle (); - if (! box.empty ()) { - - // Need to enlarge the empty area somewhat so we really exclude instances - // entirely enclosed by the shape - also the ones at the border. - if (! m_overlapping) { - box.enlarge (box_type::vector_type (1, 1)); - } - - const box_type ®ion = m_local_region_stack.back (); - unsigned int l = m_has_layers ? m_layers.front () : m_layer; - box = (cell ()->bbox (l) & region) - box; - m_local_region_stack.back () = box; - - } - - } - if (m_overlapping) { m_inst = cell ()->begin_touching (m_local_region_stack.back ().enlarged (box_type::vector_type (-1, -1))); } else { @@ -994,6 +965,33 @@ RecursiveShapeIterator::new_inst (RecursiveShapeReceiver *receiver) const } } + if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1)) { + + // Try some optimization: if the instance we're looking at is entirely covered + // by a rectangle (other objects are too expensive to check), then wil skip it + // + // We check 10 shapes max. + + unsigned int l = m_has_layers ? m_layers.front () : m_layer; + box_type inst_bx = m_inst->bbox (m_box_convert); + auto si = cell ()->shapes (l).begin_overlapping (inst_bx, m_shape_flags, mp_shape_prop_sel, m_shape_inv_prop_sel); + bool skip = false; + size_t nmax = 10; + while (! skip && ! si.at_end () && nmax-- > 0) { + if (inst_bx.inside (si->rectangle ())) { + skip = true; + break; + } + ++si; + } + + if (skip) { + ++m_inst; + continue; + } + + } + bool all_of_instance = false; bool with_region = false; diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index 4dda034db..0e4a7430a 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -1683,7 +1683,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (1217072)); + EXPECT_EQ (n, size_t (1212844)); } { @@ -1694,7 +1694,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 235/4"; - EXPECT_EQ (n, size_t (919)); + EXPECT_EQ (n, size_t (10)); } si1.set_for_merged_input (false); @@ -1735,7 +1735,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (218736)); + EXPECT_EQ (n, size_t (218552)); } { @@ -1746,7 +1746,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 235/4"; - EXPECT_EQ (n, size_t (1)); + EXPECT_EQ (n, size_t (2)); } { @@ -1757,7 +1757,7 @@ TEST(13_ForMergedPerformance) db::Region r2 (si1); EXPECT_EQ (r1.count (), size_t (218823)); - EXPECT_EQ (r2.count (), size_t (218736)); + EXPECT_EQ (r2.count (), size_t (218552)); EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); } @@ -1769,7 +1769,7 @@ TEST(13_ForMergedPerformance) db::Region r2 (si2); EXPECT_EQ (r1.count (), size_t (2578)); - EXPECT_EQ (r2.count (), size_t (1)); + EXPECT_EQ (r2.count (), size_t (2)); EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); } } From 7080ed9a0c4e5b20bed5adb3b1fd6925fe8d41d7 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 28 Mar 2024 20:57:10 +0100 Subject: [PATCH 77/79] Refined XOR optimization solution such that it is compatible with deep mode and 'wants_all_cells', added more tests --- src/db/db/dbRecursiveShapeIterator.cc | 87 +++++++++++------- src/db/db/dbRecursiveShapeIterator.h | 1 + src/db/unit_tests/dbHierProcessorTests.cc | 88 +++++++++++++++++++ .../dbRecursiveShapeIteratorTests.cc | 6 +- 4 files changed, 148 insertions(+), 34 deletions(-) diff --git a/src/db/db/dbRecursiveShapeIterator.cc b/src/db/db/dbRecursiveShapeIterator.cc index b86f5d010..cc02f75a9 100644 --- a/src/db/db/dbRecursiveShapeIterator.cc +++ b/src/db/db/dbRecursiveShapeIterator.cc @@ -82,6 +82,7 @@ RecursiveShapeIterator &RecursiveShapeIterator::operator= (const RecursiveShapeI m_cells = d.m_cells; m_local_complex_region_stack = d.m_local_complex_region_stack; m_local_region_stack = d.m_local_region_stack; + m_skip_shapes_stack = d.m_skip_shapes_stack; m_needs_reinit = d.m_needs_reinit; m_inst_quad_id = d.m_inst_quad_id; m_inst_quad_id_stack = d.m_inst_quad_id_stack; @@ -462,6 +463,8 @@ RecursiveShapeIterator::validate (RecursiveShapeReceiver *receiver) const m_local_region_stack.clear (); m_local_region_stack.push_back (m_global_trans.inverted () * m_region); + m_skip_shapes_stack.clear (); + m_skip_shapes_stack.push_back (false); m_local_complex_region_stack.clear (); if (mp_complex_region.get ()) { @@ -736,9 +739,23 @@ RecursiveShapeIterator::next_shape (RecursiveShapeReceiver *receiver) const } - if (is_empty || !down (receiver)) { + if (is_empty) { + + // skip entire cell ++m_inst; new_inst (receiver); + + } else if (!down (receiver)) { + + // skip this instance array member + ++m_inst_array; + new_inst_member (receiver); + + if (m_inst_array.at_end ()) { + ++m_inst; + new_inst (receiver); + } + } } else { @@ -769,6 +786,39 @@ RecursiveShapeIterator::next_shape (RecursiveShapeReceiver *receiver) const bool RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const { + bool skip_shapes = false; + + if (m_for_merged_input && ! m_skip_shapes_stack.back () && (! m_has_layers || m_layers.size () == 1)) { + + // Try some optimization: if the instance we're looking at is entirely covered + // by a rectangle (other objects are too expensive to check), then we skip it + // + // We check 10 shapes max. + + box_type inst_bx; + if (m_inst->size () == 1) { + inst_bx = m_inst->bbox (m_box_convert); + } else { + inst_bx = m_inst->complex_trans (*m_inst_array) * m_box_convert (m_inst->cell_inst ().object ()); + } + + unsigned int l = m_has_layers ? m_layers.front () : m_layer; + auto si = cell ()->shapes (l).begin_overlapping (inst_bx, m_shape_flags, mp_shape_prop_sel, m_shape_inv_prop_sel); + size_t nmax = 10; + while (! si.at_end () && nmax-- > 0) { + if (inst_bx.inside (si->rectangle ())) { + skip_shapes = true; + break; + } + ++si; + } + + } + + if (skip_shapes && (! receiver || ! receiver->wants_all_cells ())) { + return false; + } + tl_assert (mp_layout); m_trans_stack.push_back (m_trans); @@ -796,6 +846,7 @@ RecursiveShapeIterator::down (RecursiveShapeReceiver *receiver) const } m_local_region_stack.push_back (new_region); + m_skip_shapes_stack.push_back (m_skip_shapes_stack.back () || skip_shapes); if (! m_local_complex_region_stack.empty ()) { @@ -878,6 +929,7 @@ RecursiveShapeIterator::pop () const mp_cell = m_cells.back (); m_cells.pop_back (); m_local_region_stack.pop_back (); + m_skip_shapes_stack.pop_back (); if (! m_local_complex_region_stack.empty ()) { m_local_complex_region_stack.pop_back (); } @@ -902,7 +954,7 @@ RecursiveShapeIterator::start_shapes () const void RecursiveShapeIterator::new_layer () const { - if (int (m_trans_stack.size ()) < m_min_depth || int (m_trans_stack.size ()) > m_max_depth) { + if (m_skip_shapes_stack.back () || int (m_trans_stack.size ()) < m_min_depth || int (m_trans_stack.size ()) > m_max_depth) { m_shape = shape_iterator (); } else if (! m_overlapping) { m_shape = cell ()->shapes (m_layer).begin_touching (m_local_region_stack.back (), m_shape_flags, mp_shape_prop_sel, m_shape_inv_prop_sel); @@ -942,7 +994,7 @@ RecursiveShapeIterator::new_cell (RecursiveShapeReceiver *receiver) const m_inst_quad_id = 0; // skip instance quad if possible - if (! m_local_complex_region_stack.empty ()) { + if (! m_local_complex_region_stack.empty () && (! receiver || ! receiver->wants_all_cells ())) { skip_inst_iter_for_complex_region (); } @@ -958,40 +1010,13 @@ RecursiveShapeIterator::new_inst (RecursiveShapeReceiver *receiver) const while (! m_inst.at_end ()) { // skip instance quad if possible - if (! m_local_complex_region_stack.empty ()) { + if (! m_local_complex_region_stack.empty () && (! receiver || ! receiver->wants_all_cells ())) { skip_inst_iter_for_complex_region (); if (m_inst.at_end ()) { break; } } - if (m_for_merged_input && (! m_has_layers || m_layers.size () == 1)) { - - // Try some optimization: if the instance we're looking at is entirely covered - // by a rectangle (other objects are too expensive to check), then wil skip it - // - // We check 10 shapes max. - - unsigned int l = m_has_layers ? m_layers.front () : m_layer; - box_type inst_bx = m_inst->bbox (m_box_convert); - auto si = cell ()->shapes (l).begin_overlapping (inst_bx, m_shape_flags, mp_shape_prop_sel, m_shape_inv_prop_sel); - bool skip = false; - size_t nmax = 10; - while (! skip && ! si.at_end () && nmax-- > 0) { - if (inst_bx.inside (si->rectangle ())) { - skip = true; - break; - } - ++si; - } - - if (skip) { - ++m_inst; - continue; - } - - } - bool all_of_instance = false; bool with_region = false; diff --git a/src/db/db/dbRecursiveShapeIterator.h b/src/db/db/dbRecursiveShapeIterator.h index b8e6a640a..532fdd247 100644 --- a/src/db/db/dbRecursiveShapeIterator.h +++ b/src/db/db/dbRecursiveShapeIterator.h @@ -867,6 +867,7 @@ private: mutable std::vector m_cells; mutable std::vector m_local_complex_region_stack; mutable std::vector m_local_region_stack; + mutable std::vector m_skip_shapes_stack; mutable bool m_needs_reinit; mutable size_t m_inst_quad_id; mutable std::vector m_inst_quad_id_stack; diff --git a/src/db/unit_tests/dbHierProcessorTests.cc b/src/db/unit_tests/dbHierProcessorTests.cc index 23833d2ff..4679c5951 100644 --- a/src/db/unit_tests/dbHierProcessorTests.cc +++ b/src/db/unit_tests/dbHierProcessorTests.cc @@ -23,6 +23,7 @@ #include "tlUnitTest.h" #include "tlStream.h" +#include "tlFileUtils.h" #include "dbHierProcessor.h" #include "dbTestSupport.h" #include "dbReader.h" @@ -32,6 +33,9 @@ #include "dbLocalOperationUtils.h" #include "dbRegionLocalOperations.h" #include "dbPolygon.h" +#include "dbRecursiveInstanceIterator.h" +#include "dbDeepShapeStore.h" +#include "dbRegion.h" static std::string testdata (const std::string &fn) { @@ -1284,3 +1288,87 @@ TEST(Arrays) run_test_bool2 (_this, "hlp18.oas", TMNot, 100); } +TEST(XORTool) +{ + test_is_long_runner (); + + std::string fna (tl::combine_path (tl::testdata_private (), "xor/a.gds.gz")); + std::string fnb (tl::combine_path (tl::testdata_private (), "xor/b.gds.gz")); + std::string fn_au (tl::combine_path (tl::testdata_private (), "xor/xor_au.oas.gz")); + + db::Layout lya, lyb; + + unsigned int l1, l2; + + db::LayerMap lmap; + + lmap.map (db::LDPair (1, 0), l1 = lya.insert_layer ()); + lyb.insert_layer (); + + lmap.map (db::LDPair (2, 0), l2 = lya.insert_layer ()); + lyb.insert_layer (); + + { + tl::InputStream stream (fna); + db::Reader reader (stream); + db::LoadLayoutOptions options; + options.get_options ().layer_map = lmap; + options.get_options ().create_other_layers = false; + reader.read (lya, options); + } + + { + tl::InputStream stream (fnb); + db::Reader reader (stream); + db::LoadLayoutOptions options; + options.get_options ().layer_map = lmap; + options.get_options ().create_other_layers = false; + reader.read (lyb, options); + } + + db::Layout ly_out; + db::cell_index_type top_out = ly_out.add_cell ("TOP"); + unsigned int l1_out = ly_out.insert_layer (db::LayerProperties (1, 0)); + unsigned int l2_out = ly_out.insert_layer (db::LayerProperties (2, 0)); + + db::DeepShapeStore dss; + dss.set_wants_all_cells (true); // saves time for less cell mapping operations + + { + db::RecursiveShapeIterator ri_a, ri_b; + + ri_a = db::RecursiveShapeIterator (lya, lya.cell (*lya.begin_top_down ()), l1); + ri_a.set_for_merged_input (true); + + ri_b = db::RecursiveShapeIterator (lyb, lyb.cell (*lyb.begin_top_down ()), l1); + ri_b.set_for_merged_input (true); + + db::Region in_a (ri_a, dss, db::ICplxTrans (1.0)); + db::Region in_b (ri_b, dss, db::ICplxTrans (1.0)); + + db::Region xor_res = in_a ^ in_b; + EXPECT_EQ (xor_res.count (), size_t (12)); + + xor_res.insert_into (&ly_out, top_out, l1_out); + } + + { + db::RecursiveShapeIterator ri_a, ri_b; + + ri_a = db::RecursiveShapeIterator (lya, lya.cell (*lya.begin_top_down ()), l2); + ri_a.set_for_merged_input (true); + + ri_b = db::RecursiveShapeIterator (lyb, lyb.cell (*lyb.begin_top_down ()), l2); + ri_b.set_for_merged_input (true); + + db::Region in_a (ri_a, dss, db::ICplxTrans (1.0)); + db::Region in_b (ri_b, dss, db::ICplxTrans (1.0)); + + db::Region xor_res = in_a ^ in_b; + EXPECT_EQ (xor_res.count (), size_t (15984)); + + xor_res.insert_into (&ly_out, top_out, l2_out); + } + + db::compare_layouts (_this, ly_out, fn_au, db::WriteOAS); +} diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index 0e4a7430a..4c109fef0 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -1683,7 +1683,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (1212844)); + EXPECT_EQ (n, size_t (1203078)); } { @@ -1735,7 +1735,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (218552)); + EXPECT_EQ (n, size_t (218069)); } { @@ -1757,7 +1757,7 @@ TEST(13_ForMergedPerformance) db::Region r2 (si1); EXPECT_EQ (r1.count (), size_t (218823)); - EXPECT_EQ (r2.count (), size_t (218552)); + EXPECT_EQ (r2.count (), size_t (218069)); EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); } From e0e6017a80686bf478a7dfba1ef4829b136710dc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 28 Mar 2024 21:06:00 +0100 Subject: [PATCH 78/79] Need to differentiate test results between editable and non-editable mode --- .../dbRecursiveShapeIteratorTests.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc index 4c109fef0..6184176db 100644 --- a/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc +++ b/src/db/unit_tests/dbRecursiveShapeIteratorTests.cc @@ -1650,6 +1650,9 @@ TEST(13_ForMergedPerformance) db::RecursiveShapeIterator si1 (ly, ly.cell (*ly.begin_top_down ()), l1); db::RecursiveShapeIterator si2 (ly, ly.cell (*ly.begin_top_down ()), l2); + size_t n1_expected_full = db::default_editable_mode () ? 1203072 : 1203078; + size_t n2_expected_full = 10; + { tl::SelfTimer timer ("Standard loop on 66/20"); size_t n = 0; @@ -1683,7 +1686,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (1203078)); + EXPECT_EQ (n, size_t (n1_expected_full)); } { @@ -1694,7 +1697,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 235/4"; - EXPECT_EQ (n, size_t (10)); + EXPECT_EQ (n, size_t (n2_expected_full)); } si1.set_for_merged_input (false); @@ -1727,6 +1730,9 @@ TEST(13_ForMergedPerformance) si1.set_for_merged_input (true); si2.set_for_merged_input (true); + size_t n1_expected = db::default_editable_mode () ? 218068 : 218069; + size_t n2_expected = 2; + { tl::SelfTimer timer ("'for_merged' loop on 66/20"); size_t n = 0; @@ -1735,7 +1741,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 66/20"; - EXPECT_EQ (n, size_t (218069)); + EXPECT_EQ (n, size_t (n1_expected)); } { @@ -1746,7 +1752,7 @@ TEST(13_ForMergedPerformance) ++n; } tl::info << "Counted " << n << " shapes on 235/4"; - EXPECT_EQ (n, size_t (2)); + EXPECT_EQ (n, size_t (n2_expected)); } { @@ -1757,7 +1763,7 @@ TEST(13_ForMergedPerformance) db::Region r2 (si1); EXPECT_EQ (r1.count (), size_t (218823)); - EXPECT_EQ (r2.count (), size_t (218069)); + EXPECT_EQ (r2.count (), size_t (n1_expected)); EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); } @@ -1769,7 +1775,7 @@ TEST(13_ForMergedPerformance) db::Region r2 (si2); EXPECT_EQ (r1.count (), size_t (2578)); - EXPECT_EQ (r2.count (), size_t (2)); + EXPECT_EQ (r2.count (), size_t (n2_expected)); EXPECT_EQ ((r1 ^ r2).count (), size_t (0)); } } From b5ee7d3892b3f561df62ccb0239fd34d90725f14 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 28 Mar 2024 21:07:11 +0100 Subject: [PATCH 79/79] Fixed problem with image on Color Buttons in 'Auto' mode - pixel garbage --- src/layui/layui/layWidgets.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/layui/layui/layWidgets.cc b/src/layui/layui/layWidgets.cc index 792818c65..76c20d842 100644 --- a/src/layui/layui/layWidgets.cc +++ b/src/layui/layui/layWidgets.cc @@ -419,12 +419,6 @@ LineStyleSelectionButton::update_menu () unsigned int n = palette.style_by_index (i); if (int (n) < std::distance (patterns.begin (), patterns.end ())) { -#if QT_VERSION > 0x050000 - double dpr = devicePixelRatio (); -#else - double dpr = 1.0; -#endif - lay::LineStyleInfo info = patterns.begin () [n]; std::string name (info.name ()); @@ -1226,13 +1220,14 @@ ColorButton::set_color_internal (QColor c) double dpr = 1.0; #endif - QPixmap pixmap (rt.width () * dpr, rt.height () * dpr); + QImage image (rt.width () * dpr, rt.height () * dpr, QImage::Format_ARGB32); #if QT_VERSION >= 0x50000 - pixmap.setDevicePixelRatio (dpr); + image.setDevicePixelRatio (dpr); #endif + image.fill (Qt::transparent); QColor text_color = palette ().color (QPalette::Active, QPalette::Text); - QPainter pxpainter (&pixmap); + QPainter pxpainter (&image); QPen frame_pen (text_color); frame_pen.setWidthF (1.0); frame_pen.setJoinStyle (Qt::MiterJoin); @@ -1253,7 +1248,7 @@ ColorButton::set_color_internal (QColor c) } - QPushButton::setIcon (QIcon (pixmap)); + QPushButton::setIcon (QIcon (QPixmap::fromImage (image))); } QColor