mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
replace ccr_::enumerate with flexible for_each
enumerate is unusual and would only work effectively with random access iterators this for_each takes advantage of tbb blocked_range replace ccr_::enumerate with flexible for_each enumerate is unusual and would only work effectively with random access iterators this for_each takes advantage of tbb blocked_range
This commit is contained in:
parent
9486901b93
commit
929cea59f3
7 changed files with 169 additions and 125 deletions
|
@ -264,11 +264,12 @@ void SLAPrint::Steps::slice_model(SLAPrintObject &po)
|
|||
std::vector<ExPolygons> interior_slices;
|
||||
interior_slicer.slice(slice_grid, SlicingMode::Regular, closing_r, &interior_slices, thr);
|
||||
|
||||
sla::ccr::enumerate(interior_slices.begin(), interior_slices.end(),
|
||||
[&po](const ExPolygons &slice, size_t i) {
|
||||
po.m_model_slices[i] =
|
||||
diff_ex(po.m_model_slices[i], slice);
|
||||
});
|
||||
sla::ccr::for_each(0ul, interior_slices.size(),
|
||||
[&po, &interior_slices] (size_t i) {
|
||||
const ExPolygons &slice = interior_slices[i];
|
||||
po.m_model_slices[i] =
|
||||
diff_ex(po.m_model_slices[i], slice);
|
||||
});
|
||||
}
|
||||
|
||||
auto mit = slindex_it;
|
||||
|
@ -679,14 +680,16 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
|
|||
using Lock = std::lock_guard<sla::ccr::SpinningMutex>;
|
||||
|
||||
// Going to parallel:
|
||||
auto printlayerfn = [
|
||||
auto printlayerfn = [this,
|
||||
// functions and read only vars
|
||||
areafn, area_fill, display_area, exp_time, init_exp_time, fast_tilt, slow_tilt, delta_fade_time,
|
||||
|
||||
// write vars
|
||||
&mutex, &models_volume, &supports_volume, &estim_time, &slow_layers,
|
||||
&fast_layers, &fade_layer_time](PrintLayer& layer, size_t sliced_layer_cnt)
|
||||
&fast_layers, &fade_layer_time](size_t sliced_layer_cnt)
|
||||
{
|
||||
PrintLayer &layer = m_print->m_printer_input[sliced_layer_cnt];
|
||||
|
||||
// vector of slice record references
|
||||
auto& slicerecord_references = layer.slices();
|
||||
|
||||
|
@ -789,7 +792,7 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
|
|||
|
||||
// sequential version for debugging:
|
||||
// for(size_t i = 0; i < m_printer_input.size(); ++i) printlayerfn(i);
|
||||
sla::ccr::enumerate(printer_input.begin(), printer_input.end(), printlayerfn);
|
||||
sla::ccr::for_each(0ul, printer_input.size(), printlayerfn);
|
||||
|
||||
auto SCALING2 = SCALING_FACTOR * SCALING_FACTOR;
|
||||
print_statistics.support_used_material = supports_volume * SCALING2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue