@@ -744,7 +744,7 @@ local_processor_result_computation_task<TS, TI, TR>::perform ()
744744// LocalProcessorBase implementation
745745
746746LocalProcessorBase::LocalProcessorBase ()
747- : m_report_progress (true ), m_nthreads (0 ), m_max_vertex_count (0 ), m_area_ratio (0.0 ), m_boolean_core (false ),
747+ : m_report_progress (true ), m_nthreads (0 ), m_max_vertex_count (0 ), m_area_ratio (0.0 ), m_top_down ( false ), m_boolean_core (false ),
748748 m_base_verbosity (30 ), mp_vars (0 ), mp_current_cell (0 )
749749{
750750 // .. nothing yet ..
@@ -1034,84 +1034,90 @@ void local_processor<TS, TI, TR>::compute_contexts (local_processor_contexts<TS,
10341034 }
10351035 }
10361036
1037- // TODO: can we shortcut this if interactions is empty?
1038- for (std::vector<unsigned int >::const_iterator il = contexts.intruder_layers ().begin (); il != contexts.intruder_layers ().end (); ++il) {
1037+ // in top-down mode we are not interested in cell-to-cell interactions, nor shape-to-instance interactions
1038+ // except local ones (shape-to-child cells), hence we skip this part
1039+ if (! top_down ()) {
10391040
1040- db::box_convert <db::CellInstArray, true > inst_bci (*mp_intruder_layout, contexts.actual_intruder_layer (*il));
1041+ // TODO: can we shortcut this if interactions is empty?
1042+ for (std::vector<unsigned int >::const_iterator il = contexts.intruder_layers ().begin (); il != contexts.intruder_layers ().end (); ++il) {
10411043
1042- db::box_scanner2<db::CellInstArray, int , db::CellInstArray, int > scanner;
1043- interaction_registration_inst2inst<TS, TI, TR> rec (mp_subject_layout, contexts.subject_layer (), mp_intruder_layout, contexts.actual_intruder_layer (*il), contexts.is_foreign (*il), dist, &interactions);
1044+ db::box_convert <db::CellInstArray, true > inst_bci (*mp_intruder_layout, contexts.actual_intruder_layer (*il));
10441045
1045- unsigned int id = 0 ;
1046+ db::box_scanner2<db::CellInstArray, int , db::CellInstArray, int > scanner;
1047+ interaction_registration_inst2inst<TS, TI, TR> rec (mp_subject_layout, contexts.subject_layer (), mp_intruder_layout, contexts.actual_intruder_layer (*il), contexts.is_foreign (*il), dist, &interactions);
10461048
1047- if (subject_cell == intruder_cell) {
1049+ unsigned int id = 0 ;
10481050
1049- // Use the same id's for same instances - this way we can easily detect same instances
1050- // and don't make them self-interacting
1051+ if (subject_cell == intruder_cell) {
10511052
1052- for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1053- unsigned int iid = ++id;
1054- if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1055- scanner.insert1 (&i->cell_inst (), iid);
1056- }
1057- if (! inst_bci (i->cell_inst ()).empty () && ! intruder_cell_is_breakout (i->cell_index ())) {
1058- scanner.insert2 (&i->cell_inst (), iid);
1053+ // Use the same id's for same instances - this way we can easily detect same instances
1054+ // and don't make them self-interacting
1055+
1056+ for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1057+ unsigned int iid = ++id;
1058+ if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1059+ scanner.insert1 (&i->cell_inst (), iid);
1060+ }
1061+ if (! inst_bci (i->cell_inst ()).empty () && ! intruder_cell_is_breakout (i->cell_index ())) {
1062+ scanner.insert2 (&i->cell_inst (), iid);
1063+ }
10591064 }
1060- }
10611065
1062- } else {
1066+ } else {
10631067
1064- for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1065- if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1066- scanner.insert1 (&i->cell_inst (), ++id);
1068+ for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1069+ if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1070+ scanner.insert1 (&i->cell_inst (), ++id);
1071+ }
10671072 }
1068- }
10691073
1070- if (intruder_cell) {
1071- for (db::Cell::const_iterator i = intruder_cell->begin (); !i.at_end (); ++i) {
1072- if (! inst_bci (i->cell_inst ()).empty () && ! intruder_cell_is_breakout (i->cell_index ())) {
1073- scanner.insert2 (&i->cell_inst (), ++id);
1074+ if (intruder_cell) {
1075+ for (db::Cell::const_iterator i = intruder_cell->begin (); !i.at_end (); ++i) {
1076+ if (! inst_bci (i->cell_inst ()).empty () && ! intruder_cell_is_breakout (i->cell_index ())) {
1077+ scanner.insert2 (&i->cell_inst (), ++id);
1078+ }
10741079 }
10751080 }
1076- }
10771081
1078- }
1082+ }
10791083
1080- for (std::set<db::CellInstArray>::const_iterator i = intruders.first .begin (); i != intruders.first .end (); ++i) {
1081- if (! inst_bci (*i).empty ()) {
1082- scanner.insert2 (i.operator -> (), ++id);
1084+ for (std::set<db::CellInstArray>::const_iterator i = intruders.first .begin (); i != intruders.first .end (); ++i) {
1085+ if (! inst_bci (*i).empty ()) {
1086+ scanner.insert2 (i.operator -> (), ++id);
1087+ }
10831088 }
1084- }
10851089
1086- scanner.process (rec, dist, inst_bcs, inst_bci);
1090+ scanner.process (rec, dist, inst_bcs, inst_bci);
10871091
1088- }
1092+ }
10891093
1090- if (! intruders.second .empty () || ! intruder_shapes.empty ()) {
1094+ if (! intruders.second .empty () || ! intruder_shapes.empty ()) {
10911095
1092- db::box_scanner2<db::CellInstArray, int , TI, int > scanner;
1093- db::addressable_object_from_shape<TI> heap;
1094- interaction_registration_inst2shape<TS, TI, TR> rec (mp_subject_layout, contexts.subject_layer (), dist, &interactions);
1096+ db::box_scanner2<db::CellInstArray, int , TI, int > scanner;
1097+ db::addressable_object_from_shape<TI> heap;
1098+ interaction_registration_inst2shape<TS, TI, TR> rec (mp_subject_layout, contexts.subject_layer (), dist, &interactions);
10951099
1096- for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1097- if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1098- scanner.insert1 (&i->cell_inst (), 0 );
1100+ for (db::Cell::const_iterator i = subject_cell->begin (); !i.at_end (); ++i) {
1101+ if (! inst_bcs (i->cell_inst ()).empty () && ! subject_cell_is_breakout (i->cell_index ())) {
1102+ scanner.insert1 (&i->cell_inst (), 0 );
1103+ }
10991104 }
1100- }
11011105
1102- for (typename std::map<unsigned int , std::set<TI> >::const_iterator il = intruders.second .begin (); il != intruders.second .end (); ++il) {
1103- for (typename std::set<TI>::const_iterator i = il->second .begin (); i != il->second .end (); ++i) {
1104- scanner.insert2 (i.operator -> (), il->first );
1106+ for (typename std::map<unsigned int , std::set<TI> >::const_iterator il = intruders.second .begin (); il != intruders.second .end (); ++il) {
1107+ for (typename std::set<TI>::const_iterator i = il->second .begin (); i != il->second .end (); ++i) {
1108+ scanner.insert2 (i.operator -> (), il->first );
1109+ }
11051110 }
1106- }
11071111
1108- for (std::map<unsigned int , const db::Shapes *>::const_iterator im = intruder_shapes.begin (); im != intruder_shapes.end (); ++im) {
1109- for (db::Shapes::shape_iterator i = im->second ->begin (shape_flags<TI> ()); !i.at_end (); ++i) {
1110- scanner.insert2 (heap (*i), im->first );
1112+ for (std::map<unsigned int , const db::Shapes *>::const_iterator im = intruder_shapes.begin (); im != intruder_shapes.end (); ++im) {
1113+ for (db::Shapes::shape_iterator i = im->second ->begin (shape_flags<TI> ()); !i.at_end (); ++i) {
1114+ scanner.insert2 (heap (*i), im->first );
1115+ }
11111116 }
1112- }
11131117
1114- scanner.process (rec, dist, inst_bcs, db::box_convert<TI> ());
1118+ scanner.process (rec, dist, inst_bcs, db::box_convert<TI> ());
1119+
1120+ }
11151121
11161122 }
11171123
@@ -1417,14 +1423,14 @@ local_processor<TS, TI, TR>::compute_local_cell (const db::local_processor_conte
14171423 }
14181424 }
14191425
1420- // local shapes vs. child cell
1421-
14221426 db::box_convert<db::CellInstArray, true > inst_bci (*mp_intruder_layout, ail);
14231427
14241428 typename std::map<unsigned int , std::set<TI> >::const_iterator ipl = intruders.second .find (*il);
14251429 static std::set<TI> empty_intruders;
14261430
1427- if (! subject_shapes->empty () && (intruder_shapes || ipl != intruders.second .end ())) {
1431+ // local shapes vs. local shapes
1432+
1433+ if (! top_down () && ! subject_shapes->empty () && (intruder_shapes || ipl != intruders.second .end ())) {
14281434
14291435 if (subject_cell == intruder_cell && contexts.subject_layer () == ail && !foreign) {
14301436
@@ -1439,6 +1445,8 @@ local_processor<TS, TI, TR>::compute_local_cell (const db::local_processor_conte
14391445
14401446 }
14411447
1448+ // local shapes vs. child cells
1449+
14421450 if (! subject_shapes->empty () && ! ((! intruder_cell || intruder_cell->begin ().at_end ()) && intruders.first .empty ())) {
14431451
14441452 db::box_scanner2<TS, int , db::CellInstArray, int > scanner;
@@ -1452,7 +1460,7 @@ local_processor<TS, TI, TR>::compute_local_cell (const db::local_processor_conte
14521460
14531461 unsigned int inst_id = 0 ;
14541462
1455- if (subject_cell == intruder_cell && contexts.subject_layer () == ail && !foreign) {
1463+ if (! top_down () && subject_cell == intruder_cell && contexts.subject_layer () == ail && !foreign) {
14561464
14571465 // Same cell, same layer -> no shape to child instance interactions because this will be taken care of
14581466 // by the instances themselves (and their intruders). This also means, we prefer to deal with
0 commit comments