diff --git a/src/db/db/dbEdgeNeighborhood.cc b/src/db/db/dbEdgeNeighborhood.cc index c171d04ae..cc01131c5 100644 --- a/src/db/db/dbEdgeNeighborhood.cc +++ b/src/db/db/dbEdgeNeighborhood.cc @@ -170,7 +170,20 @@ EdgeNeighborhoodCompoundOperationNode::do_collect_neighbors (db::box_scanner2 &interactions, std::vector > & /*results*/, const db::LocalProcessorBase * /*proc*/) const +EdgeNeighborhoodCompoundOperationNode::do_compute_local (CompoundRegionOperationCache *cache, db::Layout *layout, db::Cell *cell, const shape_interactions &interactions, std::vector > &results, const db::LocalProcessorBase *proc) const +{ + compute_local_impl (cache, layout, cell, interactions, results, proc); +} + +void +EdgeNeighborhoodCompoundOperationNode::do_compute_local (CompoundRegionOperationCache *cache, db::Layout *layout, db::Cell *cell, const shape_interactions &interactions, std::vector > &results, const db::LocalProcessorBase *proc) const +{ + compute_local_impl (cache, layout, cell, interactions, results, proc); +} + +template +void +EdgeNeighborhoodCompoundOperationNode::compute_local_impl (CompoundRegionOperationCache *cache, db::Layout *layout, db::Cell *cell, const shape_interactions &interactions, std::vector > & /*results*/, const db::LocalProcessorBase *proc) const { if (! mp_visitor) { return; @@ -182,13 +195,22 @@ EdgeNeighborhoodCompoundOperationNode::do_compute_local (CompoundRegionOperation std::list edges; std::list polygons; - for (auto i = interactions.begin_intruders (); i != interactions.end_intruders (); ++i) { - db::PolygonRef pr (i->second.second); - polygons.push_back (pr.instantiate ()); - scanner.insert2 (&polygons.back (), i->second.first); + for (unsigned int i = 0; i < children (); ++i) { + + std::vector > others; + others.push_back (std::unordered_set ()); + + shape_interactions computed_interactions; + child (i)->compute_local (cache, layout, cell, interactions_for_child (interactions, i, computed_interactions), others, proc); + + for (auto p = others.front ().begin (); p != others.front ().end (); ++p) { + polygons.push_back (p->instantiate ()); + scanner.insert2 (&polygons.back (), i); + } + } - const db::PolygonRef &pr = interactions.begin_subjects ()->second; + const T &pr = interactions.begin_subjects ()->second; unsigned int ie = 0; for (auto e = pr.begin_edge (); ! e.at_end (); ++e, ++ie) { edges.push_back (*e); @@ -200,35 +222,5 @@ EdgeNeighborhoodCompoundOperationNode::do_compute_local (CompoundRegionOperation const_cast (mp_visitor.get ())->end_polygon (); } -void -EdgeNeighborhoodCompoundOperationNode::do_compute_local (CompoundRegionOperationCache * /*cache*/, db::Layout *layout, db::Cell *cell, const shape_interactions &interactions, std::vector > & /*results*/, const db::LocalProcessorBase * /*proc*/) const -{ - if (! mp_visitor) { - return; - } - tl_assert (interactions.num_subjects () == 1); - - db::box_scanner2 scanner; - - std::list edges; - std::list polygons; - - for (auto i = interactions.begin_intruders (); i != interactions.end_intruders (); ++i) { - polygons.push_back (i->second.second); - scanner.insert2 (&polygons.back (), i->second.first); - } - - const db::Polygon &pr = interactions.begin_subjects ()->second; - unsigned int ie = 0; - for (auto e = pr.begin_edge (); ! e.at_end (); ++e, ++ie) { - edges.push_back (*e); - scanner.insert1 (&edges.back (), ie); - } - - const_cast (mp_visitor.get ())->begin_polygon (layout, cell, pr); - do_collect_neighbors (scanner, layout, cell); - const_cast (mp_visitor.get ())->end_polygon (); -} - } diff --git a/src/db/db/dbEdgeNeighborhood.h b/src/db/db/dbEdgeNeighborhood.h index b01295d18..6eec7ac47 100644 --- a/src/db/db/dbEdgeNeighborhood.h +++ b/src/db/db/dbEdgeNeighborhood.h @@ -110,6 +110,9 @@ private: tl::weak_ptr mp_visitor; void do_collect_neighbors (db::box_scanner2 &scanner, const db::Layout *layout, const db::Cell *cell) const; + + template + void compute_local_impl (CompoundRegionOperationCache * /*cache*/, db::Layout * /*layout*/, db::Cell * /*cell*/, const shape_interactions & /*interactions*/, std::vector > & /*results*/, const db::LocalProcessorBase * /*proc*/) const; }; }