From f5561e7f3adbdde6514d61d9e30d342e4914274f Mon Sep 17 00:00:00 2001 From: Shihao Wu Date: Sun, 14 Dec 2014 20:56:26 +0800 Subject: [PATCH] Simply removed the TBB code for the compute_density_weight_for_original_point() It won't make much difference for small data because this is an initialization step and it is not inside of the loop. Otherwise, it need to add another functor. --- .../wlop_simplify_and_regularize_point_set.h | 79 ++++--------------- 1 file changed, 14 insertions(+), 65 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index 57781214164..ac69d5c7242 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -538,54 +538,23 @@ wlop_simplify_and_regularize_point_set( // Compute original density weight for original points if user needed std::vector original_density_weights; - if (require_uniform_sampling) + if (require_uniform_sampling)//default value is false { - //parallel -#ifdef CGAL_LINKED_WITH_TBB - if (boost::is_convertible::value) + //todo: this part could also be parallelized if needed + for (it = first_original_iter, i = 0; it != beyond ; ++it, ++i) { - original_density_weights.assign(number_of_original, FT(1.0)); - tbb::parallel_for( - tbb::blocked_range(0, number_of_original), - [&](const tbb::blocked_range& r) - { - for (size_t i = r.begin(); i < r.end(); ++i) - { - RandomAccessIterator cur = first; - std::advance(cur, i); - FT density = simplify_and_regularize_internal:: - compute_density_weight_for_original_point - ( - #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 - get(point_pmap, cur), - #else - get(point_pmap, *cur), - #endif - original_kd_tree, - radius); + FT density = simplify_and_regularize_internal:: + compute_density_weight_for_original_point + ( + #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 + get(point_pmap, it), + #else + get(point_pmap, *it), + #endif + original_kd_tree, + radius); - original_density_weights[i] = density; - } - } - ); - }else -#endif - { - for (it = first_original_iter, i = 0; it != beyond ; ++it, ++i) - { - FT density = simplify_and_regularize_internal:: - compute_density_weight_for_original_point - ( - #ifdef CGAL_USE_PROPERTY_MAPS_API_V1 - get(point_pmap, it), - #else - get(point_pmap, *it), - #endif - original_kd_tree, - radius); - - original_density_weights.push_back(density); - } + original_density_weights.push_back(density); } } @@ -623,26 +592,6 @@ wlop_simplify_and_regularize_point_set( #ifdef CGAL_LINKED_WITH_TBB if (boost::is_convertible::value) { -// tbb::parallel_for( -// tbb::blocked_range(0, number_of_sample), -// [&](const tbb::blocked_range& r) -// { -// for (size_t i = r.begin(); i != r.end(); ++i) -// { -// update_sample_points[i] = simplify_and_regularize_internal:: -// compute_update_sample_point -// (sample_points[i], -// original_kd_tree, -// sample_kd_tree, -// radius, -// original_density_weights, -// sample_density_weights); -// } -// } -// ); - tbb::blocked_range block(0, number_of_sample); Sample_point_updater sample_updater( &update_sample_points,