diff --git a/src/db/db/dbAsIfFlatRegion.cc b/src/db/db/dbAsIfFlatRegion.cc index 8f8db97ae..77c580350 100644 --- a/src/db/db/dbAsIfFlatRegion.cc +++ b/src/db/db/dbAsIfFlatRegion.cc @@ -1045,6 +1045,8 @@ void region_cop_impl (AsIfFlatRegion *region, db::Shapes *output_to, db::Compoun { db::local_processor proc; proc.set_base_verbosity (region->base_verbosity ()); + proc.set_description (region->progress_desc ()); + proc.set_report_progress (region->report_progress ()); db::RegionIterator polygons (region->begin_merged ()); diff --git a/src/db/db/dbDeepShapeStore.h b/src/db/db/dbDeepShapeStore.h index 1b4f595b5..024bb9350 100644 --- a/src/db/db/dbDeepShapeStore.h +++ b/src/db/db/dbDeepShapeStore.h @@ -264,8 +264,8 @@ public: private: int m_threads; double m_max_area_ratio; - bool m_reject_odd_polygons; size_t m_max_vertex_count; + bool m_reject_odd_polygons; tl::Variant m_text_property_name; std::vector > m_breakout_cells; int m_text_enlargement; diff --git a/src/db/db/dbHierProcessor.cc b/src/db/db/dbHierProcessor.cc index 72f5ba68d..68bc38156 100644 --- a/src/db/db/dbHierProcessor.cc +++ b/src/db/db/dbHierProcessor.cc @@ -1218,7 +1218,7 @@ local_processor::local_processor (db::Layout *layout, db::Cell *top, : mp_subject_layout (layout), mp_intruder_layout (layout), mp_subject_top (top), mp_intruder_top (top), mp_subject_breakout_cells (breakout_cells), mp_intruder_breakout_cells (breakout_cells), - m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0) + m_report_progress (true), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0) { // .. nothing yet .. } @@ -1228,7 +1228,7 @@ local_processor::local_processor (db::Layout *subject_layout, db::Ce : mp_subject_layout (subject_layout), mp_intruder_layout (intruder_layout), mp_subject_top (subject_top), mp_intruder_top (intruder_top), mp_subject_breakout_cells (subject_breakout_cells), mp_intruder_breakout_cells (intruder_breakout_cells), - m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0) + m_report_progress (true), m_nthreads (0), m_max_vertex_count (0), m_area_ratio (0.0), m_base_verbosity (30), m_progress (0), mp_progress (0) { // .. nothing yet .. } @@ -1654,8 +1654,10 @@ local_processor::compute_results (local_processor_contexts::iterator c = contexts.begin (); c != contexts.end (); ++c) { - comp_effort += c->second.size (); + if (m_report_progress) { + for (typename local_processor_contexts::iterator c = contexts.begin (); c != contexts.end (); ++c) { + comp_effort += c->second.size (); + } } tl::RelativeProgress progress (description (op), comp_effort, 1); @@ -1738,7 +1740,7 @@ local_processor::compute_results (local_processor_contextsbegin_bottom_up (); bu != mp_subject_layout->end_bottom_up (); ++bu) { @@ -2026,7 +2028,7 @@ namespace template struct interaction_registration_shape1_scanner_combo { - interaction_registration_shape1_scanner_combo (shape_interactions *, unsigned int) + interaction_registration_shape1_scanner_combo (shape_interactions *, unsigned int, bool, const std::string &) { // can't have self-interactions with different types tl_assert (false); @@ -2046,8 +2048,8 @@ struct interaction_registration_shape1_scanner_combo template struct interaction_registration_shape1_scanner_combo { - interaction_registration_shape1_scanner_combo (shape_interactions *interactions, unsigned int intruder_layer_index) - : m_scanner (), m_rec (interactions, intruder_layer_index) + interaction_registration_shape1_scanner_combo (shape_interactions *interactions, unsigned int intruder_layer_index, bool report_progress, const std::string &progress_description) + : m_scanner (report_progress, progress_description), m_rec (interactions, intruder_layer_index) { // .. nothing yet .. } @@ -2080,6 +2082,26 @@ local_processor::run_flat (const generic_shape_iterator &subject tl_assert (mp_subject_top == 0); tl_assert (mp_intruder_top == 0); + std::string process_description, scan_description; + + if (m_report_progress) { + + process_description = description (op); + if (process_description.empty ()) { + process_description = tl::to_string (tr ("Processing")); + } else { + process_description += tl::to_string (tr (" (processing)")); + } + + scan_description = description (op); + if (scan_description.empty ()) { + scan_description = tl::to_string (tr ("Scanning")); + } else { + scan_description += tl::to_string (tr (" (scan)")); + } + + } + shape_interactions interactions; bool needs_isolated_subjects = (op->on_empty_intruder_hint () != OnEmptyIntruderHint::Drop); @@ -2129,7 +2151,7 @@ local_processor::run_flat (const generic_shape_iterator &subject if (*il == subjects && ! ff) { - interaction_registration_shape1_scanner_combo scanner (&interactions, il_index); + interaction_registration_shape1_scanner_combo scanner (&interactions, il_index, m_report_progress, scan_description); for (typename shape_interactions::subject_iterator s = interactions.begin_subjects (); s != interactions.end_subjects (); ++s) { scanner.insert (&s->second, s->first); @@ -2139,7 +2161,7 @@ local_processor::run_flat (const generic_shape_iterator &subject } else { - db::box_scanner2 scanner; + db::box_scanner2 scanner (m_report_progress, scan_description); interaction_registration_shape2shape rec (0 /*layout*/, &interactions, il_index); for (typename shape_interactions::subject_iterator s = interactions.begin_subjects (); s != interactions.end_subjects (); ++s) { @@ -2195,7 +2217,7 @@ local_processor::run_flat (const generic_shape_iterator &subject if (*il == subjects && ! ff) { - interaction_registration_shape1_scanner_combo scanner (&interactions, il_index); + interaction_registration_shape1_scanner_combo scanner (&interactions, il_index, m_report_progress, scan_description); addressable_shape_delivery is (subjects.confined (common_box, true)); unsigned int id = id_first; @@ -2208,7 +2230,7 @@ local_processor::run_flat (const generic_shape_iterator &subject } else { - db::box_scanner2 scanner; + db::box_scanner2 scanner (m_report_progress, scan_description); interaction_registration_shape2shape rec (0 /*layout*/, &interactions, il_index); if (*il == subjects) { @@ -2265,7 +2287,7 @@ local_processor::run_flat (const generic_shape_iterator &subject std::vector > result; result.resize (result_shapes.size ()); - op->compute_local (mp_subject_layout, interactions, result, m_max_vertex_count, m_area_ratio); + op->compute_local (mp_subject_layout, interactions, result, m_max_vertex_count, m_area_ratio, m_report_progress, process_description); for (std::vector::const_iterator r = result_shapes.begin (); r != result_shapes.end (); ++r) { if (*r) { diff --git a/src/db/db/dbHierProcessor.h b/src/db/db/dbHierProcessor.h index ab480c493..88ec91ac0 100644 --- a/src/db/db/dbHierProcessor.h +++ b/src/db/db/dbHierProcessor.h @@ -77,6 +77,11 @@ public: return m_interactions.end (); } + size_t size () const + { + return m_interactions.size (); + } + size_t num_interactions () const { return m_interactions.size (); @@ -428,6 +433,11 @@ public: m_description = d; } + void set_report_progress (bool rp) + { + m_report_progress = rp; + } + void set_base_verbosity (int vb) { m_base_verbosity = vb; @@ -479,6 +489,7 @@ private: const std::set *mp_subject_breakout_cells; const std::set *mp_intruder_breakout_cells; std::string m_description; + bool m_report_progress; unsigned int m_nthreads; size_t m_max_vertex_count; double m_area_ratio; diff --git a/src/db/db/dbLocalOperation.h b/src/db/db/dbLocalOperation.h index cf3d0b98b..eb488bede 100644 --- a/src/db/db/dbLocalOperation.h +++ b/src/db/db/dbLocalOperation.h @@ -29,10 +29,13 @@ #include "dbLayout.h" #include "dbEdgeBoolean.h" +#include "tlProgress.h" +#include "tlInternational.h" #include #include #include +#include namespace db { @@ -92,7 +95,7 @@ public: * * If the operation requests single subject mode, the interactions will be split into single subject/intruder clusters */ - void compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t max_vertex_count, double area_ratio) const + void compute_local (db::Layout *layout, const shape_interactions &interactions, std::vector > &results, size_t max_vertex_count, double area_ratio, bool report_progress = false, const std::string &progress_desc = std::string ()) const { if (interactions.num_subjects () <= 1 || ! requests_single_subjects ()) { @@ -100,6 +103,11 @@ public: } else { + std::auto_ptr progress; + if (report_progress) { + progress.reset (new tl::RelativeProgress (progress_desc, interactions.size ())); + } + for (typename shape_interactions::iterator i = interactions.begin (); i != interactions.end (); ++i) { const TS &subject_shape = interactions.subject_shape (i->first); @@ -122,6 +130,10 @@ public: do_compute_local (layout, single_interactions, results, max_vertex_count, area_ratio); + if (progress.get ()) { + ++*progress; + } + } } diff --git a/src/db/db/dbRegionDelegate.h b/src/db/db/dbRegionDelegate.h index e6d4d568b..593e4ed1d 100644 --- a/src/db/db/dbRegionDelegate.h +++ b/src/db/db/dbRegionDelegate.h @@ -311,7 +311,6 @@ public: virtual void insert_into (Layout *layout, db::cell_index_type into_cell, unsigned int into_layer) const = 0; -protected: const std::string &progress_desc () const { return m_progress_desc; @@ -322,6 +321,7 @@ protected: return m_report_progress; } +protected: virtual void merged_semantics_changed () { } virtual void min_coherence_changed () { }