From 6606fea4f21702930d7150a02860ac840ebb0f03 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 25 Dec 2013 11:13:36 +0000 Subject: [PATCH] Make Clang happy: Put default parameter to declaration as is required by the standard ([decl.fct.default] 3 + 4) Also remove tabs and reindent parts of the file git-svn-id: https://svn.dealii.org/trunk@32121 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/work_stream.h | 156 ++++++++++----------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index 561b8113cc..4c3eb912cf 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -1171,7 +1171,41 @@ namespace WorkStream #endif // DEAL_II_WITH_THREADS - // implementation 3 forward declaration + /** + * This is one of two main functions of the WorkStream concept, doing work as + * described in the introduction to this namespace. It corresponds to + * implementation 3 of the paper by Turcksin, Kronbichler and Bangerth, + * see @ref workstream_paper . + * As such, it takes not a range of iterators described by a begin + * and end iterator, but a "colored" graph of iterators where each + * color represents cells for which writing the cell contributions into + * the global object does not conflict (in other words, these cells + * are not neighbors). Each "color" is represented by std::vectors of cells. + * The first argument to this function, a set of sets of cells (which are + * represent as a vector of vectors, for efficiency), is typically + * constructed by calling GraphColoring::make_graph_coloring(). See there + * for more information. + * + * 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. + * + * The two data types ScratchData and CopyData need to + * have a working copy constructor. ScratchData is only used in the + * worker function, while CopyData is the object passed + * from the worker to the copier. + * + * The @p queue_length argument indicates the number of items that can be + * live at any given time. Each item consists of @p chunk_size elements of + * the input stream that will be worked on by the worker and copier + * functions one after the other on the same thread. + * + * @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 + * queue_length*chunk_size copies of the CopyData object + * are generated. + */ template void run (const std::vector > &colored_iterators, - Worker worker, - Copier copier, - const ScratchData &sample_scratch_data, - const CopyData &sample_copy_data, + Worker worker, + Copier copier, + 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 unsigned int chunk_size = 8); /** @@ -1278,13 +1312,13 @@ namespace WorkStream // Check that the copier exist if (static_cast& >(copier)) { - // create the three stages of the pipeline - internal::Implementation2::IteratorRangeToItemStream - iterator_range_to_item_stream (begin, end, - queue_length, - chunk_size, - sample_scratch_data, - sample_copy_data); + // create the three stages of the pipeline + internal::Implementation2::IteratorRangeToItemStream + iterator_range_to_item_stream (begin, end, + queue_length, + chunk_size, + sample_scratch_data, + sample_copy_data); internal::Implementation2::Worker worker_filter (worker); internal::Implementation2::Copier copier_filter (copier); @@ -1302,71 +1336,37 @@ namespace WorkStream } else { - // there is no copier function. in this case, we have an - // embarrassingly parallel problem where we can - // essentially apply parallel_for. because parallel_for - // requires subdividing the range for which operator- is - // necessary between iterators, it is often inefficient to - // apply it directory to cell ranges and similar iterator - // types for which operator- is expensive or, in fact, - // nonexistent. rather, in that case, we simply copy the - // iterators into a large array and use operator- on - // iterators to this array of iterators. - // - // instead of duplicating code, this is essentially the - // same situation we have in Implementation3 below, so we - // just defer to that place - std::vector > all_iterators (1); - for (Iterator p=begin; p!=end; ++p) - all_iterators[0].push_back (p); - - run (all_iterators, - worker, copier, - sample_scratch_data, - sample_copy_data, - queue_length, - chunk_size); + // there is no copier function. in this case, we have an + // embarrassingly parallel problem where we can + // essentially apply parallel_for. because parallel_for + // requires subdividing the range for which operator- is + // necessary between iterators, it is often inefficient to + // apply it directory to cell ranges and similar iterator + // types for which operator- is expensive or, in fact, + // nonexistent. rather, in that case, we simply copy the + // iterators into a large array and use operator- on + // iterators to this array of iterators. + // + // instead of duplicating code, this is essentially the + // same situation we have in Implementation3 below, so we + // just defer to that place + std::vector > all_iterators (1); + for (Iterator p=begin; p!=end; ++p) + all_iterators[0].push_back (p); + + run (all_iterators, + worker, copier, + sample_scratch_data, + sample_copy_data, + queue_length, + chunk_size); } } #endif } - /** - * This is one of two main functions of the WorkStream concept, doing work as - * described in the introduction to this namespace. It corresponds to - * implementation 3 of the paper by Turcksin, Kronbichler and Bangerth, - * see @ref workstream_paper . - * As such, it takes not a range of iterators described by a begin - * and end iterator, but a "colored" graph of iterators where each - * color represents cells for which writing the cell contributions into - * the global object does not conflict (in other words, these cells - * are not neighbors). Each "color" is represented by std::vectors of cells. - * The first argument to this function, a set of sets of cells (which are - * represent as a vector of vectors, for efficiency), is typically - * constructed by calling GraphColoring::make_graph_coloring(). See there - * for more information. - * - * 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. - * - * The two data types ScratchData and CopyData need to - * have a working copy constructor. ScratchData is only used in the - * worker function, while CopyData is the object passed - * from the worker to the copier. - * - * The @p queue_length argument indicates the number of items that can be - * live at any given time. Each item consists of @p chunk_size elements of - * the input stream that will be worked on by the worker and copier - * functions one after the other on the same thread. - * - * @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 - * queue_length*chunk_size copies of the CopyData object - * are generated. - */ + // Implementation 3: template void run (const std::vector > &colored_iterators, - Worker worker, - Copier copier, - const ScratchData &sample_scratch_data, - const CopyData &sample_copy_data, - const unsigned int queue_length, - const unsigned int chunk_size) + Worker worker, + Copier copier, + const ScratchData &sample_scratch_data, + const CopyData &sample_copy_data, + const unsigned int queue_length, + const unsigned int chunk_size) { Assert (queue_length > 0, ExcMessage ("The queue length must be at least one, and preferably " -- 2.39.5