diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 60c7a84589d..2cc517d16c0 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -46,7 +46,7 @@ #include #ifdef CGAL_LINKED_WITH_TBB -# include +# include # include #endif @@ -1941,7 +1941,7 @@ private: // Parallel if (boost::is_convertible::value) { - tbb::parallel_do( + tbb::parallel_for_each( outdated_cells.begin(), outdated_cells.end(), Update_cell_facets(tr_, updater)); } @@ -2831,7 +2831,7 @@ rebuild_restricted_delaunay(ForwardIterator first_cell, // Parallel if (boost::is_convertible::value) { - tbb::parallel_do(first_cell, last_cell, + tbb::parallel_for_each(first_cell, last_cell, Update_cell(c3t3_, updater)); } // Sequential @@ -2853,7 +2853,7 @@ rebuild_restricted_delaunay(ForwardIterator first_cell, // Parallel if (boost::is_convertible::value) { - tbb::parallel_do( + tbb::parallel_for_each( facets.begin(), facets.end(), Update_facet( *this, c3t3_, updater, vertex_to_proj) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h index c12dac28be1..663c8b0fd62 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h @@ -59,13 +59,29 @@ namespace CGAL { // tbb::interface5::concurrent_hash_map template < class DSC, bool Const > std::size_t tbb_hasher(const std::pair, - CGAL::internal::CC_iterator >& p) + CGAL::internal::CC_iterator >& p) { return boost::hash, CGAL::internal::CC_iterator > >()(p); } - + struct Hash_compare_for_TBB { + template < class DSC, bool Const > + std::size_t hash(const std::pair, + CGAL::internal::CC_iterator >& p) const + { + return tbb_hasher(p); + } + template < class DSC, bool Const > + std::size_t operator()(const CGAL::internal::CC_iterator& it) + { + return CGAL::internal::hash_value(it); + } + template + bool equal(const T& v1, const T& v2) const { + return v1 == v2; + } + }; } #endif @@ -940,7 +956,8 @@ private: typedef typename Base::Pair_of_vertices Pair_of_vertices; #ifdef CGAL_LINKED_WITH_TBB - typedef tbb::concurrent_hash_map Edge_facet_counter; + typedef tbb::concurrent_hash_map Edge_facet_counter; #else // not CGAL_LINKED_WITH_TBB typedef std::map Edge_facet_counter; #endif // not CGAL_LINKED_WITH_TBB diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index 60d0276330d..8177abbade4 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -49,7 +49,7 @@ #ifdef CGAL_LINKED_WITH_TBB # include # include -# include +# include # include #endif @@ -794,7 +794,7 @@ compute_moves(Moving_vertices_set& moving_vertices) tbb::concurrent_vector vertices_not_moving_any_more; // Get move for each moving vertex - tbb::parallel_do( + tbb::parallel_for_each( moving_vertices.begin(), moving_vertices.end(), Compute_move( *this, sizing_field_, moves, do_freeze_, vertices_not_moving_any_more, @@ -1033,7 +1033,7 @@ fill_sizing_field() std::vector< std::pair > > Local_list; Local_list local_lists; - tbb::parallel_do( + tbb::parallel_for_each( tr_.finite_vertices_begin(), tr_.finite_vertices_end(), Compute_sizing_field_value(*this, tr_.geom_traits(), local_lists) ); diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index 952ae641ed9..eef04d11b70 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -26,7 +26,7 @@ #include #ifdef CGAL_LINKED_WITH_TBB #include - #include + #include #endif #include @@ -993,8 +993,8 @@ scan_triangulation_impl() # endif add_to_TLS_lists(true); - // PARALLEL_DO - tbb::parallel_do( + // PARALLEL FOR_EACH + tbb::parallel_for_each( this->r_tr_.finite_facets_begin(), this->r_tr_.finite_facets_end(), typename Rf_base::template Scan_facet(*this) ); diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index f30b1c82b46..bb118f9314b 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -127,8 +127,6 @@ if ( CGAL_FOUND ) execution___of__test_meshing_verbose execution___of__test_meshing_polyhedron_with_features execution___of__test_meshing_implicit_function - execution___of__test_meshing_3D_image - execution___of__test_meshing_3D_gray_image execution___of__test_meshing_unit_tetrahedron execution___of__test_meshing_polyhedron execution___of__test_meshing_polyhedral_complex @@ -136,7 +134,13 @@ if ( CGAL_FOUND ) execution___of__test_mesh_3_issue_1554 execution___of__test_mesh_polyhedral_domain_with_features_deprecated execution___of__test_mesh_cell_base_3 - PROPERTY RUN_SERIAL 1) + PROPERTY RUN_SERIAL 1) + if(TARGET test_meshing_3D_image) + set_property(TEST + execution___of__test_meshing_3D_image + execution___of__test_meshing_3D_gray_image + PROPERTY RUN_SERIAL 1) + endif() endif() endif() if(TARGET ITT::ITT)