WIP: more tests, debugging.

This commit is contained in:
Matthias Koefferlein 2020-12-26 15:41:20 +01:00
parent 3707fae3c2
commit 00a7021a30
8 changed files with 99 additions and 109 deletions

View File

@ -117,38 +117,6 @@ CompoundRegionOperationNode::compute_local (db::Layout *layout, const shape_inte
translate (layout, intermediate, results);
}
void
CompoundRegionOperationNode::compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
std::vector<std::unordered_set<db::PolygonRef> > intermediate;
implement_compute_local (layout, interactions, intermediate, max_vertex_count, area_ratio);
translate (layout, intermediate, results);
}
void
CompoundRegionOperationNode::compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
std::vector<std::unordered_set<db::Polygon> > intermediate;
implement_compute_local (layout, interactions, intermediate, max_vertex_count, area_ratio);
translate (layout, intermediate, results);
}
void
CompoundRegionOperationNode::compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
std::vector<std::unordered_set<db::PolygonRef> > intermediate;
implement_compute_local (layout, interactions, intermediate, max_vertex_count, area_ratio);
translate (layout, intermediate, results);
}
void
CompoundRegionOperationNode::compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::Polygon> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
std::vector<std::unordered_set<db::Polygon> > intermediate;
implement_compute_local (layout, interactions, intermediate, max_vertex_count, area_ratio);
translate (layout, intermediate, results);
}
// ---------------------------------------------------------------------------------------------
CompoundRegionOperationPrimaryNode::CompoundRegionOperationPrimaryNode ()
@ -785,6 +753,11 @@ namespace
result.insert (shape.edge ());
}
static void insert (db::Layout *, const db::Shape &shape, std::unordered_set<db::EdgePair> &result)
{
result.insert (shape.edge_pair ());
}
static void insert (db::Layout *, const db::Shape &shape, std::unordered_set<db::Polygon> &result)
{
db::Polygon p;
@ -875,8 +848,12 @@ void compound_region_generic_operation_node<TS, TI, TR>::implement_compute_local
// explicit instantiations
template void compound_region_generic_operation_node<db::Polygon, db::Polygon, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::PolygonRef> &, std::vector<std::unordered_set<db::PolygonRef> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Polygon, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Polygon> &, std::vector<std::unordered_set<db::Polygon> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Edge> &, std::vector<std::unordered_set<db::Polygon> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::Edge> &, std::vector<std::unordered_set<db::PolygonRef> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Polygon, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Polygon> &, std::vector<std::unordered_set<db::Edge> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Polygon, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Polygon> &, std::vector<std::unordered_set<db::EdgePair> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Polygon> &, std::vector<std::unordered_set<db::Polygon> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::PolygonRef> &, std::vector<std::unordered_set<db::PolygonRef> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::PolygonRef> &, std::vector<std::unordered_set<db::Edge> > &, size_t, double) const;
template void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::PolygonRef> &, std::vector<std::unordered_set<db::EdgePair> > &, size_t, double) const;
// ---------------------------------------------------------------------------------------------

View File

@ -124,54 +124,6 @@ public:
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const;
void compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const;
void compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::Edge> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::Edge> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const;
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::Polygon> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::Polygon> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const;
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::Edge> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
void compute_local (db::Layout *layout, const shape_interactions<db::Edge, db::Polygon> &interactions, std::vector<std::unordered_set<db::Edge> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
template <class T>
bool compute_local_bool (db::Layout *layout, const shape_interactions<T, T> &interactions, size_t max_vertex_count, double area_ratio) const
{
@ -218,14 +170,6 @@ protected:
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::PolygonRef, db::PolygonRef> & /*interactions*/, std::vector<std::unordered_set<db::PolygonRef> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::PolygonRef, db::PolygonRef> & /*interactions*/, std::vector<std::unordered_set<db::Edge> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::PolygonRef, db::PolygonRef> & /*interactions*/, std::vector<std::unordered_set<db::EdgePair> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::PolygonRef, db::Edge> & /*interactions*/, std::vector<std::unordered_set<db::PolygonRef> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Polygon, db::Edge> & /*interactions*/, std::vector<std::unordered_set<db::Polygon> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::PolygonRef, db::Edge> & /*interactions*/, std::vector<std::unordered_set<db::Edge> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Polygon, db::Edge> & /*interactions*/, std::vector<std::unordered_set<db::Edge> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Edge, db::PolygonRef> & /*interactions*/, std::vector<std::unordered_set<db::PolygonRef> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Edge, db::Polygon> & /*interactions*/, std::vector<std::unordered_set<db::Polygon> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Edge, db::PolygonRef> & /*interactions*/, std::vector<std::unordered_set<db::Edge> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual void do_compute_local (db::Layout * /*layout*/, const shape_interactions<db::Edge, db::Polygon> & /*interactions*/, std::vector<std::unordered_set<db::Edge> > & /*results*/, size_t /*max_vertex_count*/, double /*area_ratio*/) const { }
virtual std::string generated_description () const;
@ -622,12 +566,12 @@ public:
return std::string ("interact") + compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::description ();
}
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Polygon> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
@ -686,12 +630,12 @@ public:
return std::string ("pull") + compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::description ();
}
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Edge> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::Polygon, db::Polygon> &interactions, std::vector<std::unordered_set<db::Polygon> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::Edge> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::PolygonRef, db::PolygonRef> &interactions, std::vector<std::unordered_set<db::PolygonRef> > &results, size_t max_vertex_count, double area_ratio) const
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}

View File

@ -407,8 +407,8 @@ check_local_operation<TS, TI>::description () const
}
// explicit instantiations
template class check_local_operation<db::PolygonRef, db::PolygonRef>;
template class check_local_operation<db::Polygon, db::Polygon>;
template class DB_PUBLIC check_local_operation<db::PolygonRef, db::PolygonRef>;
template class DB_PUBLIC check_local_operation<db::Polygon, db::Polygon>;
// ---------------------------------------------------------------------------------------------------------------
@ -535,9 +535,9 @@ std::string interacting_local_operation<TS, TI, TR>::description () const
}
// explicit instantiations
template class interacting_local_operation<db::PolygonRef, db::PolygonRef, db::PolygonRef>;
template class interacting_local_operation<db::Polygon, db::Polygon, db::Polygon>;
template class interacting_local_operation<db::Polygon, db::Edge, db::Polygon>;
template class DB_PUBLIC interacting_local_operation<db::PolygonRef, db::PolygonRef, db::PolygonRef>;
template class DB_PUBLIC interacting_local_operation<db::Polygon, db::Polygon, db::Polygon>;
template class DB_PUBLIC interacting_local_operation<db::Polygon, db::Edge, db::Polygon>;
// ---------------------------------------------------------------------------------------------------------------
@ -614,8 +614,8 @@ std::string pull_local_operation<TS, TI, TR>::description () const
return tl::to_string (tr ("Pull regions by their geometrical relation to first"));
}
template class pull_local_operation<db::PolygonRef, db::PolygonRef, db::PolygonRef>;
template class pull_local_operation<db::Polygon, db::Polygon, db::Polygon>;
template class DB_PUBLIC pull_local_operation<db::PolygonRef, db::PolygonRef, db::PolygonRef>;
template class DB_PUBLIC pull_local_operation<db::Polygon, db::Polygon, db::Polygon>;
// ---------------------------------------------------------------------------------------------------------------
@ -700,8 +700,8 @@ std::string interacting_with_edge_local_operation<TS, TI, TR>::description () co
return tl::to_string (tr ("Select regions by their geometric relation to edges"));
}
template class interacting_with_edge_local_operation<db::PolygonRef, db::Edge, db::PolygonRef>;
template class interacting_with_edge_local_operation<db::Polygon, db::Edge, db::Polygon>;
template class DB_PUBLIC interacting_with_edge_local_operation<db::PolygonRef, db::Edge, db::PolygonRef>;
template class DB_PUBLIC interacting_with_edge_local_operation<db::Polygon, db::Edge, db::Polygon>;
// ---------------------------------------------------------------------------------------------------------------
@ -761,8 +761,8 @@ std::string pull_with_edge_local_operation<TS, TI, TR>::description () const
return tl::to_string (tr ("Pull edges from second by their geometric relation to first"));
}
template class pull_with_edge_local_operation<db::PolygonRef, db::Edge, db::Edge>;
template class pull_with_edge_local_operation<db::Polygon, db::Edge, db::Edge>;
template class DB_PUBLIC pull_with_edge_local_operation<db::PolygonRef, db::Edge, db::Edge>;
template class DB_PUBLIC pull_with_edge_local_operation<db::Polygon, db::Edge, db::Edge>;
// ---------------------------------------------------------------------------------------------------------------
@ -828,8 +828,8 @@ std::string pull_with_text_local_operation<TS, TI, TR>::description () const
return tl::to_string (tr ("Pull texts from second by their geometric relation to first"));
}
template class pull_with_text_local_operation<db::PolygonRef, db::TextRef, db::TextRef>;
template class pull_with_text_local_operation<db::Polygon, db::Text, db::Text>;
template class DB_PUBLIC pull_with_text_local_operation<db::PolygonRef, db::TextRef, db::TextRef>;
template class DB_PUBLIC pull_with_text_local_operation<db::Polygon, db::Text, db::Text>;
// ---------------------------------------------------------------------------------------------------------------
@ -914,7 +914,7 @@ std::string interacting_with_text_local_operation<TS, TI, TR>::description () co
}
// explicit instantiations
template class interacting_with_text_local_operation<db::PolygonRef, db::TextRef, db::PolygonRef>;
template class interacting_with_text_local_operation<db::Polygon, db::Text, db::Polygon>;
template class DB_PUBLIC interacting_with_text_local_operation<db::PolygonRef, db::TextRef, db::PolygonRef>;
template class DB_PUBLIC interacting_with_text_local_operation<db::Polygon, db::Text, db::Polygon>;
}

View File

@ -233,3 +233,72 @@ TEST(5_InteractOperation)
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au5.gds");
}
TEST(6_InteractWithEdgeOperation)
{
db::Layout ly;
{
std::string fn (tl::testsrc ());
fn += "/testdata/drc/compound_6.gds";
tl::InputStream stream (fn);
db::Reader reader (stream);
reader.read (ly);
}
db::RegionCheckOptions check_options;
check_options.metrics = db::Projection;
unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0));
db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1));
unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0));
db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2));
db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode ();
db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2);
db::CompoundRegionToEdgeProcessingOperationNode *secondary_edges = new db::CompoundRegionToEdgeProcessingOperationNode (new db::PolygonToEdgeProcessor (), secondary, true);
db::CompoundRegionInteractWithEdgeOperationNode interact (primary, secondary_edges, 0, true, false);
db::Region res = r.cop_to_region (interact);
unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0));
res.insert_into (&ly, *ly.begin_top_down (), l1000);
CHECKPOINT();
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au6.gds");
}
TEST(7_PullOperation)
{
db::Layout ly;
{
std::string fn (tl::testsrc ());
fn += "/testdata/drc/compound_7.gds";
tl::InputStream stream (fn);
db::Reader reader (stream);
reader.read (ly);
}
db::RegionCheckOptions check_options;
check_options.metrics = db::Projection;
unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0));
db::Region r (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l1));
unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0));
db::Region r2 (db::RecursiveShapeIterator (ly, ly.cell (*ly.begin_top_down ()), l2));
db::CompoundRegionOperationPrimaryNode *primary = new db::CompoundRegionOperationPrimaryNode ();
db::CompoundRegionOperationSecondaryNode *secondary = new db::CompoundRegionOperationSecondaryNode (&r2);
db::CompoundRegionPullOperationNode pull (primary, secondary, 0, true);
db::Region res = r.cop_to_region (pull);
unsigned int l1000 = ly.get_layer (db::LayerProperties (1000, 0));
res.insert_into (&ly, *ly.begin_top_down (), l1000);
CHECKPOINT();
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au7.gds");
}

BIN
testdata/drc/compound_6.gds vendored Normal file

Binary file not shown.

BIN
testdata/drc/compound_7.gds vendored Normal file

Binary file not shown.

BIN
testdata/drc/compound_au6.gds vendored Normal file

Binary file not shown.

BIN
testdata/drc/compound_au7.gds vendored Normal file

Binary file not shown.