From 29264013b0ff42e87a4c599dd8031265c133691c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 25 Jan 2019 22:28:25 +0100 Subject: [PATCH] WIP: more consistent handling of polygon splitting parameters. --- src/db/db/db.pro | 3 +- src/db/db/dbDeepRegion.cc | 2 +- src/db/db/dbDeepRegion.h | 4 +- src/db/db/gsiDeclDbDeepShapeStore.cc | 101 +++++++++++++++++++++ src/db/db/gsiDeclDbHierNetworkProcessor.cc | 2 +- src/db/db/gsiDeclDbRegion.cc | 30 +----- src/db/unit_tests/dbHierProcessorTests.cc | 4 + testdata/algo/hlp11.oas | Bin 823 -> 834 bytes testdata/algo/hlp12.oas | Bin 798 -> 868 bytes 9 files changed, 112 insertions(+), 34 deletions(-) create mode 100644 src/db/db/gsiDeclDbDeepShapeStore.cc diff --git a/src/db/db/db.pro b/src/db/db/db.pro index 3a99dcb25..0b2eaeaeb 100644 --- a/src/db/db/db.pro +++ b/src/db/db/db.pro @@ -163,7 +163,8 @@ SOURCES = \ dbLayoutToNetlistWriter.cc \ dbLayoutToNetlistFormatDefs.cc \ dbDeviceAbstract.cc \ - dbLocalOperationUtils.cc + dbLocalOperationUtils.cc \ + gsiDeclDbDeepShapeStore.cc HEADERS = \ dbArray.h \ diff --git a/src/db/db/dbDeepRegion.cc b/src/db/db/dbDeepRegion.cc index 3985efc92..f05396ff5 100644 --- a/src/db/db/dbDeepRegion.cc +++ b/src/db/db/dbDeepRegion.cc @@ -350,7 +350,7 @@ DeepRegion::and_or_not_with (const DeepRegion *other, bool and_op) const db::LocalProcessor proc (const_cast (&m_deep_layer.layout ()), const_cast (&m_deep_layer.initial_cell ()), &other->deep_layer ().layout (), &other->deep_layer ().initial_cell ()); proc.set_threads (m_deep_layer.store ()->threads ()); - proc.set_area_ratio(m_deep_layer.store ()->max_area_ratio ()); + proc.set_area_ratio (m_deep_layer.store ()->max_area_ratio ()); proc.set_max_vertex_count (m_deep_layer.store ()->max_vertex_count ()); proc.run (&op, m_deep_layer.layer (), other->deep_layer ().layer (), dl_out.layer ()); diff --git a/src/db/db/dbDeepRegion.h b/src/db/db/dbDeepRegion.h index 2d9a1e509..720782399 100644 --- a/src/db/db/dbDeepRegion.h +++ b/src/db/db/dbDeepRegion.h @@ -42,8 +42,8 @@ public: typedef polygon_layer_type::iterator polygon_iterator_type; DeepRegion (); - DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, double area_ratio = 3.0, size_t max_vertex_count = 16); - DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics = true, double area_ratio = 3.0, size_t max_vertex_count = 16); + DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, double area_ratio = 0.0, size_t max_vertex_count = 0); + DeepRegion (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics = true, double area_ratio = 0.0, size_t max_vertex_count = 0); DeepRegion (const DeepRegion &other); DeepRegion (const DeepLayer &dl); diff --git a/src/db/db/gsiDeclDbDeepShapeStore.cc b/src/db/db/gsiDeclDbDeepShapeStore.cc new file mode 100644 index 000000000..77ac2fc30 --- /dev/null +++ b/src/db/db/gsiDeclDbDeepShapeStore.cc @@ -0,0 +1,101 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2019 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 "gsiDecl.h" +#include "dbDeepShapeStore.h" + +namespace gsi +{ + +Class decl_dbDeepShapeStore ("db", "DeepShapeStore", + gsi::method ("instance_count", &db::DeepShapeStore::instance_count, + "@hide\n" + ) + + gsi::method ("threads=", &db::DeepShapeStore::set_threads, gsi::arg ("n"), + "@brief Sets the number of threads to allocate for the hierarchical processor\n" + ) + + gsi::method ("threads", &db::DeepShapeStore::threads, + "@brief Gets the number of threads.\n" + ) + + gsi::method ("max_vertex_count=", &db::DeepShapeStore::set_max_vertex_count, gsi::arg ("count"), + "@brief Sets the maximum vertex count default value\n" + "\n" + "This parameter is used to simplify complex polygons. It is used by\n" + "create_polygon_layer with the default parameters. It's also used by\n" + "boolean operations when they deliver their output.\n" + ) + + gsi::method ("max_vertex_count", &db::DeepShapeStore::max_vertex_count, + "@brief Gets the maximum vertex count.\n" + ) + + gsi::method ("max_area_ratio=", &db::DeepShapeStore::set_max_area_ratio, gsi::arg ("ratio"), + "@brief Sets the max. area ratio for bounding box vs. polygon area\n" + "\n" + "This parameter is used to simplify complex polygons. It is used by\n" + "create_polygon_layer with the default parameters. It's also used by\n" + "boolean operations when they deliver their output.\n" + ) + + gsi::method ("max_area_ratio", &db::DeepShapeStore::max_area_ratio, + "@brief Gets the max. area ratio.\n" + ) + + gsi::method ("text_property_name=", &db::DeepShapeStore::set_text_property_name, gsi::arg ("name"), + "@brief Sets the text property name.\n" + "\n" + "If set to a non-null variant, text strings are attached to the generated boxes\n" + "as properties with this particular name. This option has an effect only if the\n" + "text_enlargement property is not negative.\n" + "By default, the name is empty.\n" + ) + + gsi::method ("text_property_name", &db::DeepShapeStore::text_property_name, + "@brief Gets the text property name.\n" + ) + + gsi::method ("text_enlargement=", &db::DeepShapeStore::set_text_enlargement, gsi::arg ("value"), + "@brief Sets the text enlargement value\n" + "\n" + "If set to a non-negative value, text objects are converted to boxes with the\n" + "given enlargement (width = 2 * enlargement). The box centers are identical\n" + "to the original location of the text.\n" + "If this value is negative (the default), texts are ignored.\n" + ) + + gsi::method ("text_enlargement", &db::DeepShapeStore::text_enlargement, + "@brief Gets the text enlargement value.\n" + ), + "@brief An opaque layout heap for the deep region processor\n" + "\n" + "This class is used for keeping intermediate, hierarchical data for the " + "deep region processor. It is used in conjunction with the region " + "constructor to create a deep (hierarchical) region." + "\n" + "@code\n" + "layout = ... # a layout\n" + "layer = ... # a layer\n" + "cell = ... # a cell (initial cell for the deep region)\n" + "dss = RBA::DeepShapeStore::new\n" + "region = RBA::Region::new(cell.begin(layer), dss)\n" + "@/code\n" + "\n" + "The DeepShapeStore object also supplies some configuration options " + "for the operations acting on the deep regions. See for example \\threads=.\n" + "\n" + "This class has been introduced in version 0.26.\n" +); + +} diff --git a/src/db/db/gsiDeclDbHierNetworkProcessor.cc b/src/db/db/gsiDeclDbHierNetworkProcessor.cc index a72f15d9c..8aef6b9d0 100644 --- a/src/db/db/gsiDeclDbHierNetworkProcessor.cc +++ b/src/db/db/gsiDeclDbHierNetworkProcessor.cc @@ -43,7 +43,7 @@ Class decl_dbConnectivity ("db", "Connectivity", gsi::method ("global_net_id", &db::Connectivity::global_net_id, gsi::arg ("global_net_name"), "@brief Gets the ID for a given global net name.\n" ), - "@brief This class specifies connections between different layers." + "@brief This class specifies connections between different layers.\n" "Connections are build using \\connect. There are basically two flavours of connections: intra-layer and inter-layer.\n" "\n" "Intra-layer connections make nets begin propagated along different shapes on the same net. Without the " diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index 9d7d653d0..f5b1e6877 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -719,34 +719,6 @@ static Container *decompose_trapezoids (const db::Region *r, int mode) int td_simple (); int po_any (); -Class decl_DeepShapeStore ("db", "DeepShapeStore", - method ("threads=", &db::DeepShapeStore::set_threads, gsi::arg ("threads"), - "@brief Sets the number of threads for use for operations acting on this heap\n" - ) + - method ("threads", &db::DeepShapeStore::threads, - "@brief Gets the number of threads for use for operations acting on this heap\n" - ) + - method ("instance_count", db::DeepShapeStore::instance_count, "@hide"), - "@brief An opaque layout heap for the deep region processor\n" - "\n" - "This class is used for keeping intermediate, hierarchical data for the " - "deep region processor. It is used in conjunction with the region " - "constructor to create a deep (hierarchical) region." - "\n" - "@code\n" - "layout = ... # a layout\n" - "layer = ... # a layer\n" - "cell = ... # a cell (initial cell for the deep region)\n" - "dss = RBA::DeepShapeStore::new\n" - "region = RBA::Region::new(cell.begin(layer), dss)\n" - "@/code\n" - "\n" - "The DeepShapeStore object also supplies some configuration options " - "for the operations acting on the deep regions. See for example \\threads=.\n" - "\n" - "This class has been introduced in version 0.26.\n" -); - Class decl_Region ("db", "Region", constructor ("new", &new_v, "@brief Default constructor\n" @@ -824,7 +796,7 @@ Class decl_Region ("db", "Region", "r = RBA::Region::new(layout.begin_shapes(cell, layer), RBA::ICplxTrans::new(layout.dbu / dbu))\n" "@/code\n" ) + - constructor ("new", &new_sid, gsi::arg ("shape_iterator"), gsi::arg ("deep_shape_store"), gsi::arg ("area_ratio", 3.0), gsi::arg ("max_vertex_count", size_t (16)), + 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" "This constructor creates a hierarchical region. Use a \\DeepShapeStore object to " diff --git a/src/db/unit_tests/dbHierProcessorTests.cc b/src/db/unit_tests/dbHierProcessorTests.cc index a9d117c98..060611d8c 100644 --- a/src/db/unit_tests/dbHierProcessorTests.cc +++ b/src/db/unit_tests/dbHierProcessorTests.cc @@ -226,6 +226,8 @@ static void run_test_bool_gen (tl::TestBase *_this, const char *file, TestMode m db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ())); proc.set_threads (nthreads); + proc.set_area_ratio (3.0); + proc.set_max_vertex_count (16); if (! context_doc) { proc.run (lop, l1, l2, lout); @@ -242,6 +244,8 @@ static void run_test_bool_gen (tl::TestBase *_this, const char *file, TestMode m db::LocalProcessor proc (&layout_org, &layout_org.cell (*layout_org.begin_top_down ()), &layout_org2, &layout_org2.cell (*layout_org2.begin_top_down ())); proc.set_threads (nthreads); + proc.set_area_ratio (3.0); + proc.set_max_vertex_count (16); if (! context_doc) { proc.run (lop, l1, l2, lout); diff --git a/testdata/algo/hlp11.oas b/testdata/algo/hlp11.oas index df75656981e7595538ed2b7f85ce2e77581cd18d..e509c377f49afbe21ae364b373bc1d5a68e28729 100644 GIT binary patch delta 192 zcmdnac8G04rKTY>o3n?fkBbpAbBKQcFQZ5`Bf}N33mQjsE^3G>rZciE2wb82lWQXL z#1{sF8H`K|*lx)7ii#S5SPe##Z5So^MJ*Vaekk8yd3%js2o~WCApHYiLq>!mWvPYC*@)|~UVMD0l4-PWI cO;=k!nVUD`FQkj_6#}n7GKmFP)KP zLEsAApIj4}kLZXRW-u}>V7npPD=KQh$TCCg2Fp+76}oS)F#@?ji36&0r-GR~#23gf zDdc4m{J`+$8sh~G!4HfRWOhtpoSe&O!zEJ5)F9a-%Fs|d`5B`+k7YU|(*=zKswe7h l$WGqEs3ifn<-tLaVQ_0ED=>*MGEEL-dOtaViI0ha0RS_xJ?H=c diff --git a/testdata/algo/hlp12.oas b/testdata/algo/hlp12.oas index 259bf940c8883554a5067d2aff61e96c3b5b7c9d..6abd3565c0c6fb75c4a40ee400dfd1ae11090ff3 100644 GIT binary patch delta 178 zcmbQo_JnQ1k9xinKKs~Ss^(v0&08t?g?WW!-UZhD7pnW%L@gMZUa02%2;CtBVs`L- z(CbiNU;$)vys{6h5%$454Zwo8o1idTw=8ZdHAP((821KS&kAE6-4Dk9d<4KKs~Ss^(v0&08t?g?WW!-UZhD7piY0R!XiHy2!dt=%wlx<_9ik cI0&oR9MHjcA*z$_G9ygwCC1Hj8ILmp04kg>a{vGU