WIP: more tests, debugging

This commit is contained in:
Matthias Koefferlein 2020-12-26 16:04:35 +01:00
parent 00a7021a30
commit cc6ad01529
7 changed files with 67 additions and 27 deletions

View File

@ -846,14 +846,14 @@ 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::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;
template DB_PUBLIC 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 DB_PUBLIC 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 DB_PUBLIC 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 DB_PUBLIC 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 DB_PUBLIC 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 DB_PUBLIC 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 DB_PUBLIC void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Edge>::implement_compute_local (db::Layout *, const shape_interactions<db::PolygonRef, db::PolygonRef> &, std::vector<std::unordered_set<db::Edge> > &, size_t, double) const;
template DB_PUBLIC void compound_region_generic_operation_node<db::Polygon, db::Edge, db::Edge>::implement_compute_local (db::Layout *, const shape_interactions<db::Polygon, db::Polygon> &, std::vector<std::unordered_set<db::Edge> > &, size_t, double) const;
// ---------------------------------------------------------------------------------------------

View File

@ -555,8 +555,8 @@ class DB_PUBLIC CompoundRegionInteractWithEdgeOperationNode
: public compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>
{
public:
CompoundRegionInteractWithEdgeOperationNode (CompoundRegionOperationNode *a, CompoundRegionOperationNode *b, int mode, bool touching, bool inverse, size_t min_count = 0, size_t max_count = std::numeric_limits<size_t>::max ())
: compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon> (&m_op, a, b), m_op (mode, touching, inverse, min_count, max_count)
CompoundRegionInteractWithEdgeOperationNode (CompoundRegionOperationNode *a, CompoundRegionOperationNode *b, bool inverse, size_t min_count = 0, size_t max_count = std::numeric_limits<size_t>::max ())
: compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon> (&m_op, a, b), m_op (inverse, min_count, max_count)
{
// .. nothing yet ..
}
@ -577,7 +577,7 @@ public:
}
private:
db::interacting_local_operation<db::Polygon, db::Edge, db::Polygon> m_op;
db::interacting_with_edge_local_operation<db::Polygon, db::Edge, db::Polygon> m_op;
};
class DB_PUBLIC CompoundRegionPullOperationNode
@ -616,32 +616,32 @@ private:
};
class DB_PUBLIC CompoundRegionPullWithEdgeOperationNode
: public compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>
: public compound_region_generic_operation_node<db::Polygon, db::Edge, db::Edge>
{
public:
CompoundRegionPullWithEdgeOperationNode (CompoundRegionOperationNode *a, CompoundRegionOperationNode *b, int mode, bool touching)
: compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon> (&m_op, a, b), m_op (mode, touching)
CompoundRegionPullWithEdgeOperationNode (CompoundRegionOperationNode *a, CompoundRegionOperationNode *b)
: compound_region_generic_operation_node<db::Polygon, db::Edge, db::Edge> (&m_op, a, b), m_op ()
{
// .. nothing yet ..
}
std::string generated_description () const
{
return std::string ("pull") + compound_region_generic_operation_node<db::Polygon, db::Edge, db::Polygon>::description ();
return std::string ("pull") + compound_region_generic_operation_node<db::Polygon, db::Edge, db::Edge>::description ();
}
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
virtual void do_compute_local (db::Layout *layout, const shape_interactions<db::Polygon, 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);
}
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
{
implement_compute_local (layout, interactions, results, max_vertex_count, area_ratio);
}
private:
db::pull_local_operation<db::Polygon, db::Edge, db::Polygon> m_op;
db::pull_with_edge_local_operation<db::Polygon, db::Edge, db::Edge> m_op;
};
@ -835,8 +835,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<T> res;
for (typename std::unordered_set<T>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<T> res;
res.clear ();
processed (layout, *p, res);
results.front ().insert (res.begin (), res.end ());
}
@ -897,8 +898,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<T> res;
for (typename std::unordered_set<db::Edge>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<T> res;
res.clear ();
processed (layout, *p, res);
results.front ().insert (res.begin (), res.end ());
}
@ -937,8 +939,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<T> res;
for (typename std::unordered_set<db::EdgePair>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<T> res;
res.clear ();
processed (layout, *p, res);
results.front ().insert (res.begin (), res.end ());
}
@ -974,8 +977,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<db::Edge> res;
for (typename std::unordered_set<db::EdgePair>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<db::Edge> res;
res.clear ();
mp_proc->process (*p, res);
results.front ().insert (res.begin (), res.end ());
}
@ -1014,8 +1018,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<db::Edge> res;
for (typename std::unordered_set<T>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<db::Edge> res;
res.clear ();
processed (layout, *p, res);
results.front ().insert (res.begin (), res.end ());
}
@ -1064,8 +1069,9 @@ private:
child (0)->compute_local (layout, interactions, one, max_vertex_count, area_ratio);
std::vector<db::EdgePair> res;
for (typename std::unordered_set<T>::const_iterator p = one.front ().begin (); p != one.front ().end (); ++p) {
std::vector<db::EdgePair> res;
res.clear ();
processed (layout, *p, res);
results.front ().insert (res.begin (), res.end ());
}

View File

@ -537,7 +537,6 @@ std::string interacting_local_operation<TS, TI, TR>::description () const
// explicit instantiations
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>;
// ---------------------------------------------------------------------------------------------------------------

View File

@ -65,7 +65,7 @@ static db::CompoundRegionOperationNode *new_interacting (db::CompoundRegionOpera
if (b->result_type () == db::CompoundRegionOperationNode::Region) {
return new db::CompoundRegionInteractOperationNode (a, b, 0, true, inverse, min_count, max_count);
} else if (b->result_type () == db::CompoundRegionOperationNode::Edges) {
return new db::CompoundRegionInteractWithEdgeOperationNode (a, b, 0, true, inverse, min_count, max_count);
return new db::CompoundRegionInteractWithEdgeOperationNode (a, b, inverse, min_count, max_count);
} else {
throw tl::Exception ("Secondary input for interaction compound operation must be either of Region or Edges type");
}

View File

@ -257,7 +257,7 @@ TEST(6_InteractWithEdgeOperation)
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::CompoundRegionInteractWithEdgeOperationNode interact (primary, secondary_edges, false);
db::Region res = r.cop_to_region (interact);
@ -302,3 +302,38 @@ TEST(7_PullOperation)
db::compare_layouts (_this, ly, tl::testsrc () + "/testdata/drc/compound_au7.gds");
}
TEST(8_PullWithEdgeOperation)
{
db::Layout ly;
{
std::string fn (tl::testsrc ());
fn += "/testdata/drc/compound_8.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::CompoundRegionPullWithEdgeOperationNode pull (primary, secondary_edges);
db::Edges res = r.cop_to_edges (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_au8.gds");
}

BIN
testdata/drc/compound_8.gds vendored Normal file

Binary file not shown.

BIN
testdata/drc/compound_au8.gds vendored Normal file

Binary file not shown.