From 4fc54affdf0a955bffdc65147d63d9d8ff082907 Mon Sep 17 00:00:00 2001 From: "xun.zhang" Date: Sat, 12 Oct 2024 22:10:08 +0800 Subject: [PATCH] FIX: fail to use tbb 1.this cause slice become very slow jira:NONE Signed-off-by: xun.zhang Change-Id: Ied3ffe74533c1f822780fdc3a20af4ff657c1853 --- src/libslic3r/PrintObject.cpp | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 8490defd0..bdf4e5d60 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1904,21 +1904,15 @@ void PrintObject::bridge_over_infill() const LayerRegion *region; double bridge_angle; }; - constexpr bool BRIDGE_INFILL_USE_TBB = true; std::map> surfaces_by_layer; // SECTION to gather and filter surfaces for expanding, and then cluster them by layer { tbb::concurrent_vector candidate_surfaces; -#if BRIDGE_INFILL_USE_TBB tbb::parallel_for(tbb::blocked_range(0, this->layers().size()), [po = static_cast(this), &candidate_surfaces](tbb::blocked_range r) { for (size_t lidx = r.begin(); lidx < r.end(); lidx++) { -#else - for(size_t lidx=0;lidxlayers().size();++lidx){ - auto po = static_cast(this); -#endif const Layer *layer = po->get_layer(lidx); if (layer->lower_layer == nullptr) { continue; @@ -1981,9 +1975,7 @@ void PrintObject::bridge_over_infill() } } } -#if BRIDGE_INFILL_USE_TBB }); -#endif for (const CandidateSurface &c : candidate_surfaces) { surfaces_by_layer[c.layer_index].push_back(c); @@ -2009,14 +2001,9 @@ void PrintObject::bridge_over_infill() backup_surfaces[lidx] = {}; } -#if BRIDGE_INFILL_USE_TBB tbb::parallel_for(tbb::blocked_range(0, this->layers().size()), [po = this, &backup_surfaces, &surfaces_by_layer](tbb::blocked_range r) { for (size_t lidx = r.begin(); lidx < r.end(); lidx++) { -#else - for(size_t lidx=0;lidxlayers().size();++lidx){ - auto po = this; -#endif if (surfaces_by_layer.find(lidx) == surfaces_by_layer.end()) continue; @@ -2069,9 +2056,7 @@ void PrintObject::bridge_over_infill() } } } -#if BRIDGE_INFILL_USE_TBB - }); -#endif + }); // Use the modified surfaces to generate expanded lightning anchors this->m_lightning_generator = this->prepare_lightning_infill_data(); @@ -2467,7 +2452,6 @@ void PrintObject::bridge_over_infill() return expanded_bridged_area; }; -#if BRIDGE_INFILL_USE_TBB tbb::parallel_for(tbb::blocked_range(0, clustered_layers_for_threads.size()), [po = static_cast(this), target_flow_height_factor, &surfaces_by_layer, &clustered_layers_for_threads, @@ -2476,10 +2460,6 @@ void PrintObject::bridge_over_infill() construct_anchored_polygon]( tbb::blocked_range r) { for (size_t cluster_idx = r.begin(); cluster_idx < r.end(); cluster_idx++) { -#else - for(size_t cluster_idx=0;cluster_idx(this); -#endif for (size_t job_idx = 0; job_idx < clustered_layers_for_threads[cluster_idx].size(); job_idx++) { size_t lidx = clustered_layers_for_threads[cluster_idx][job_idx]; const Layer *layer = po->get_layer(lidx); @@ -2658,19 +2638,12 @@ void PrintObject::bridge_over_infill() expanded_surfaces.clear(); } } -#if BRIDGE_INFILL_USE_TBB }); -#endif BOOST_LOG_TRIVIAL(info) << "Bridge over infill - Directions and expanded surfaces computed" << log_memory_info(); -#if BRIDGE_INFILL_USE_TBB tbb::parallel_for(tbb::blocked_range(0, this->layers().size()), [po = this, &surfaces_by_layer](tbb::blocked_range r) { for (size_t lidx = r.begin(); lidx < r.end(); lidx++) { -#else - for(size_t lidx=0;lidxlayers().size();++lidx){ - auto po = this; -#endif if (surfaces_by_layer.find(lidx) == surfaces_by_layer.end() && surfaces_by_layer.find(lidx + 1) == surfaces_by_layer.end()) continue; Layer *layer = po->get_layer(lidx); @@ -2742,9 +2715,7 @@ void PrintObject::bridge_over_infill() region->fill_surfaces.append(new_surfaces); } } -#if BRIDGE_INFILL_USE_TBB }); -#endif BOOST_LOG_TRIVIAL(info) << "Bridge over infill - End" << log_memory_info();