From 9d7f1e863cd5eb6876eeb5da8e6ca7ae4ebcb7a7 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 14 Nov 2011 13:25:03 +0000 Subject: [PATCH] Revert Moritz's patch r24741 since it leads to all sorts of regressions. git-svn-id: https://svn.dealii.org/trunk@24748 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 5 ----- deal.II/include/deal.II/base/work_stream.h | 25 ++++++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index cc9bcb4456..745df8c147 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -82,11 +82,6 @@ enabled due to a missing include file in file
(Scott Miller, Jonathan Pitt, 2011/11/10) -
  • Changed: WorkStream now allocates one scratch object per thread instead of -one scratch object per item. -
    -(Moritz Allmaras, 2011/11/10) -
  • New: Implementation of an alternative handling of inhomogeneous constraints in ConstraintMatrix. This is controlled with a new parameter use_inhomogeneities_for_rhs in diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index b6a2fc39a3..12157b8e28 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -18,7 +18,6 @@ #include #include #include -#include #if DEAL_II_USE_MT == 1 # include @@ -156,7 +155,7 @@ namespace WorkStream */ typedef std_cxx1x::tuple, - Threads::ThreadLocalStorage*, + ScratchData*, std::vector, unsigned int> ItemType; @@ -180,7 +179,6 @@ namespace WorkStream tbb::filter (/*is_serial=*/true), remaining_iterator_range (begin, end), ring_buffer (buffer_size), - thread_local_scratch(sample_scratch_data), n_emitted_items (0), chunk_size (chunk_size) { @@ -195,10 +193,20 @@ namespace WorkStream tasks += Threads::new_task (&IteratorRangeToItemStream::init_buffer_elements, *this, i, + std_cxx1x::cref(sample_scratch_data), std_cxx1x::cref(sample_copy_data)); tasks.join_all (); } + /** + * Destructor. + */ + ~IteratorRangeToItemStream () + { + for (unsigned int i=0; i(ring_buffer[i]); + } + /** * Create a item and return a * pointer to it. @@ -250,12 +258,6 @@ namespace WorkStream */ std::vector ring_buffer; - /** - * Scratch data object. Each thread will - * have its own local copy. - */ - Threads::ThreadLocalStorage thread_local_scratch; - /** * Counter for the number of emitted * items. Each item may consist of up @@ -283,6 +285,7 @@ namespace WorkStream * the ring buffer. */ void init_buffer_elements (const unsigned int element, + const ScratchData &sample_scratch_data, const CopyData &sample_copy_data) { Assert (std_cxx1x::get<1>(ring_buffer[element]) == 0, @@ -291,7 +294,7 @@ namespace WorkStream std_cxx1x::get<0>(ring_buffer[element]) .resize (chunk_size, remaining_iterator_range.second); std_cxx1x::get<1>(ring_buffer[element]) - = &thread_local_scratch; + = new ScratchData(sample_scratch_data); std_cxx1x::get<2>(ring_buffer[element]) .resize (chunk_size, sample_copy_data); } @@ -346,7 +349,7 @@ namespace WorkStream // were given for (unsigned int i=0; i(*current_item); ++i) worker (std_cxx1x::get<0>(*current_item)[i], - std_cxx1x::get<1>(*current_item)->get(), + *std_cxx1x::get<1>(*current_item), std_cxx1x::get<2>(*current_item)[i]); // then return the original pointer -- 2.39.5