From 68c303f592d1c93781e2edbbd6e9dd92f9c82a3d Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Thu, 26 Sep 2013 20:37:50 +0000 Subject: [PATCH] Use std_cxx1x::function for graph_coloring. git-svn-id: https://svn.dealii.org/trunk@30970 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/graph_coloring.h | 16 ++++++++++------ deal.II/include/deal.II/base/work_stream.h | 3 ++- tests/base/graph_coloring_01.cc | 3 ++- tests/base/graph_coloring_02.cc | 5 +++-- tests/base/graph_coloring_03.cc | 3 ++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/deal.II/include/deal.II/base/graph_coloring.h b/deal.II/include/deal.II/base/graph_coloring.h index b6d49e7d2d..2349fbe994 100644 --- a/deal.II/include/deal.II/base/graph_coloring.h +++ b/deal.II/include/deal.II/base/graph_coloring.h @@ -20,6 +20,7 @@ #include +#include #include #include #include @@ -38,7 +39,8 @@ namespace graph_coloring { template std::vector > create_partitioning(Iterator const &begin, typename identity::type const &end, - std::vector (*get_conflict_indices) (Iterator const&)) + std_cxx1x::function (Iterator const &)> + const &get_conflict_indices) { std::vector > partitioning(1,std::vector (1,begin)); // Number of iterators. @@ -47,7 +49,7 @@ namespace graph_coloring { boost::unordered_map > indices_to_iterators; for (Iterator it=begin; it!=end; ++it) { - std::vector conflict_indices = (*get_conflict_indices)(it); + std::vector conflict_indices = get_conflict_indices(it); const unsigned int n_conflict_indices(conflict_indices.size()); for (unsigned int i=0; i new_zone; for (; vector_it!=vector_end; ++vector_it) { - std::vector conflict_indices = (*get_conflict_indices)(*vector_it); + std::vector conflict_indices = get_conflict_indices(*vector_it); const unsigned int n_conflict_indices(conflict_indices.size()); for (unsigned int i=0; i std::vector > make_dsatur_coloring(std::vector &partition, - std::vector (*get_conflict_indices)(Iterator const&)) + std_cxx1x::function (Iterator const &)> + const &get_conflict_indices) { std::vector > partition_coloring; // Number of zones composing the partitioning. @@ -125,7 +128,7 @@ namespace graph_coloring { // set_intersection can be used later. for (unsigned int i=0; i std::vector > make_graph_coloring(Iterator const &begin,typename identity::type const &end, - std::vector (*get_conflict_indices)(Iterator const&)) + std_cxx1x::function (Iterator const &)> + const &get_conflict_indices) { // Create the partitioning. std::vector > partitioning = create_partitioning(begin,end, diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index 9ab55fec7f..21dfb52d09 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -936,7 +936,8 @@ namespace WorkStream Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, - std::vector (*get_conflict_indices) (const Iterator &), + const std_cxx1x::function (const Iterator &)> + &get_conflict_indices, const unsigned int queue_length = 2*multithread_info.n_default_threads, const unsigned int chunk_size = 8) { diff --git a/tests/base/graph_coloring_01.cc b/tests/base/graph_coloring_01.cc index 63f35366e9..9a0a79d745 100644 --- a/tests/base/graph_coloring_01.cc +++ b/tests/base/graph_coloring_01.cc @@ -58,7 +58,8 @@ void check() typename DoFHandler::active_cell_iterator cell(dof_handler.begin_active()); std::vector::active_cell_iterator> > coloring( graph_coloring::make_graph_coloring(cell,dof_handler.end(), - get_conflict_indices_cfem)); + std_cxx1x::function (typename + DoFHandler::active_cell_iterator const &)> (get_conflict_indices_cfem))); // Output the coloring for (unsigned int color=0; color std::vector get_conflict_indices_cfem( - typename DoFHandler::active_cell_iterator const &it) + typename DoFHandler::active_cell_iterator const &it) { std::vector local_dof_indices(it->get_fe().dofs_per_cell); it->get_dof_indices(local_dof_indices); @@ -68,7 +68,8 @@ void check() // Create the coloring std::vector::active_cell_iterator> > coloring( graph_coloring::make_graph_coloring(dof_handler.begin_active(),dof_handler.end(), - get_conflict_indices_cfem)); + std_cxx1x::function (typename + DoFHandler::active_cell_iterator const &)> (get_conflict_indices_cfem))); // Output the coloring for (unsigned int color=0; color::active_cell_iterator> > coloring( graph_coloring::make_graph_coloring(dof_handler.begin_active(),dof_handler.end(), - get_conflict_indices_cfem)); + std_cxx1x::function (typename + hp::DoFHandler::active_cell_iterator const &)> (get_conflict_indices_cfem))); // Output the coloring for (unsigned int color=0; color