Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-03-07 15:03:14 +0300
committerbubnikv <bubnikv@gmail.com>2017-03-07 15:03:14 +0300
commitcb1a6eae1ed97b5e57dfd9d9ede87b453c043558 (patch)
tree33ffae5375e5e2aee8062fef94354cf83216267b /xs/src/libslic3r/TriangleMesh.cpp
parent8a42c0ad9fb7c46cd946179315cd67e28c0c3836 (diff)
Added dependencies on the Intel Thread Building Blocks.
Changed the C++ parallelization code to Intel Thread Building Blocks.
Diffstat (limited to 'xs/src/libslic3r/TriangleMesh.cpp')
-rw-r--r--xs/src/libslic3r/TriangleMesh.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp
index aa9705035..f1fe74902 100644
--- a/xs/src/libslic3r/TriangleMesh.cpp
+++ b/xs/src/libslic3r/TriangleMesh.cpp
@@ -13,6 +13,8 @@
#include <boost/log/trivial.hpp>
+#include <tbb/parallel_for.h>
+
#if 0
#define DEBUG
#define _DEBUG
@@ -672,10 +674,12 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
std::vector<IntersectionLines> lines(z.size());
{
boost::mutex lines_mutex;
- parallelize<int>(
- 0,
- this->mesh->stl.stats.number_of_facets-1,
- boost::bind(&TriangleMeshSlicer::_slice_do, this, _1, &lines, &lines_mutex, z)
+ tbb::parallel_for(
+ tbb::blocked_range<int>(0,this->mesh->stl.stats.number_of_facets),
+ [&lines, &lines_mutex, &z, this](const tbb::blocked_range<int>& range) {
+ for (int facet_idx = range.begin(); facet_idx < range.end(); ++ facet_idx)
+ this->_slice_do(facet_idx, &lines, &lines_mutex, z);
+ }
);
}
@@ -684,10 +688,12 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
// build loops
BOOST_LOG_TRIVIAL(trace) << "TriangleMeshSlicer::_make_loops_do";
layers->resize(z.size());
- parallelize<size_t>(
- 0,
- lines.size()-1,
- boost::bind(&TriangleMeshSlicer::_make_loops_do, this, _1, &lines, layers)
+ tbb::parallel_for(
+ tbb::blocked_range<size_t>(0, lines.size()),
+ [&lines, &layers, this](const tbb::blocked_range<size_t>& range) {
+ for (size_t line_idx = range.begin(); line_idx < range.end(); ++ line_idx)
+ this->make_loops(lines[line_idx], &(*layers)[line_idx]);
+ }
);
BOOST_LOG_TRIVIAL(trace) << "TriangleMeshSlicer::slice finished";
}
@@ -873,12 +879,6 @@ bool TriangleMeshSlicer::slice_facet(
return false;
}
-void
-TriangleMeshSlicer::_make_loops_do(size_t i, std::vector<IntersectionLines>* lines, std::vector<Polygons>* layers) const
-{
- this->make_loops((*lines)[i], &(*layers)[i]);
-}
-
void TriangleMeshSlicer::make_loops(std::vector<IntersectionLine> &lines, Polygons* loops) const
{
// Remove tangent edges.