From: Bruno Turcksin Date: Mon, 25 Nov 2013 18:05:23 +0000 (+0000) Subject: Change the way copier can be ignored in WorkStream. X-Git-Tag: v8.1.0~169 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b660025851364134a383a157162745877f2e9ac;p=dealii.git Change the way copier can be ignored in WorkStream. git-svn-id: https://svn.dealii.org/trunk@31799 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index 41f8a32a9e..3ccf789b45 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -1150,7 +1150,8 @@ namespace WorkStream * * This function that can be used for worker and copier objects that * are either pointers to non-member functions or objects that allow to be - * called with an operator(), for example objects created by std::bind. + * called with an operator(), for example objects created by std::bind. If + * the copier is an empty function, it is ignore in the pipeline. * * The argument passed as @p end must be convertible to the same type as @p * begin, but doesn't have to be of the same type itself. This allows to @@ -1169,9 +1170,6 @@ namespace WorkStream * the input stream that will be worked on by the worker and copier * functions one after the other on the same thread. * - * The last argument @p empty_copier can be set to true when the copier is - * empty. In this case, the copier is not used which can improve speed. - * * @note If your data objects are large, or their constructors are * expensive, it is helpful to keep in mind that queue_length * copies of the ScratchData object and @@ -1191,8 +1189,7 @@ namespace WorkStream const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length = 2*multithread_info.n_threads(), - const unsigned int chunk_size = 8, - const bool empty_copier = false) + const unsigned int chunk_size = 8) { Assert (queue_length > 0, ExcMessage ("The queue length must be at least one, and preferably " @@ -1241,37 +1238,20 @@ namespace WorkStream sample_scratch_data, sample_copy_data); + internal::Implementation2::Worker worker_filter (worker); + internal::Implementation2::Copier copier_filter (copier); - if (empty_copier==false) - { - internal::Implementation2::Worker worker_filter (worker); - internal::Implementation2::Copier copier_filter (copier); - - // now create a pipeline from these stages - tbb::pipeline assembly_line; - assembly_line.add_filter (iterator_range_to_item_stream); - assembly_line.add_filter (worker_filter); - assembly_line.add_filter (copier_filter); - - // and run it - assembly_line.run (queue_length); + // now create a pipeline from these stages + tbb::pipeline assembly_line; + assembly_line.add_filter (iterator_range_to_item_stream); + assembly_line.add_filter (worker_filter); + if (static_cast& >(copier)) + assembly_line.add_filter (copier_filter); - assembly_line.clear (); - } - else - { - internal::Implementation2::Worker worker_filter (worker); - - // now create a pipeline from these stages - tbb::pipeline assembly_line; - assembly_line.add_filter (iterator_range_to_item_stream); - assembly_line.add_filter (worker_filter); + // and run it + assembly_line.run (queue_length); - // and run it - assembly_line.run (queue_length); - - assembly_line.clear (); - } + assembly_line.clear (); } #endif } @@ -1403,7 +1383,8 @@ namespace WorkStream * and Bangerth (see @ref workstream_paper). * * This is the function that can be used for worker and copier functions - * that are member functions of a class. + * that are member functions of a class. If the copier is an empty function, + * it is ignore in the pipeline. * * The argument passed as @p end must be convertible to the same type as @p * begin, but doesn't have to be of the same type itself. This allows to @@ -1417,9 +1398,6 @@ namespace WorkStream * the input stream that will be worked on by the worker and copier * functions one after the other on the same thread. * - * The last argument @p empty_copier can be set to true when the copier is - * empty. In this case, the copier is not used which can improve speed. - * * @note If your data objects are large, or their constructors are * expensive, it is helpful to keep in mind that queue_length * copies of the ScratchData object and @@ -1441,8 +1419,7 @@ namespace WorkStream const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length = 2*multithread_info.n_threads(), - const unsigned int chunk_size = 8, - const bool empty_copier = false) + const unsigned int chunk_size = 8) { // forward to the other function run (begin, end, @@ -1455,8 +1432,7 @@ namespace WorkStream sample_scratch_data, sample_copy_data, queue_length, - chunk_size, - empty_copier); + chunk_size); } } diff --git a/deal.II/source/numerics/data_out.cc b/deal.II/source/numerics/data_out.cc index 00fb6c6df8..d242eaa816 100644 --- a/deal.II/source/numerics/data_out.cc +++ b/deal.II/source/numerics/data_out.cc @@ -462,8 +462,7 @@ void DataOut::build_patches (const Mapping &mapping, std_cxx1x::cref(mapping), std_cxx1x::cref(dof_handler), std_cxx1x::cref(solution),component)), - static_cast > - (internal::Assembler::copier),internal::Assembler::Scratch (), - internal::Assembler::CopyData (), - 2*multithread_info.n_threads(),8,true); + std_cxx1x::function (), + internal::Assembler::Scratch (),internal::Assembler::CopyData ()); }