]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Revert Moritz's patch r24741 since it leads to all sorts of regressions.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 14 Nov 2011 13:25:03 +0000 (13:25 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 14 Nov 2011 13:25:03 +0000 (13:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@24748 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/base/work_stream.h

index cc9bcb4456dd7871aba19bdf307eb5c2a61cb2fb..745df8c147121c83af7d5c51f648e48e35295bbb 100644 (file)
@@ -82,11 +82,6 @@ enabled due to a missing include file in file
 <br>
 (Scott Miller, Jonathan Pitt, 2011/11/10)
 
-<li> Changed: WorkStream now allocates one scratch object per thread instead of
-one scratch object per item.
-<br>
-(Moritz Allmaras, 2011/11/10)
-
 <li> New: Implementation of an alternative handling of
 inhomogeneous constraints in ConstraintMatrix. This is controlled with
 a new parameter use_inhomogeneities_for_rhs in
index b6a2fc39a3e64827c02e439c6cb50cb9aa4e9e2a..12157b8e285c95c837dc3d429f3f305b5f5bd562 100644 (file)
@@ -18,7 +18,6 @@
 #include <deal.II/base/template_constraints.h>
 #include <deal.II/base/std_cxx1x/function.h>
 #include <deal.II/base/std_cxx1x/bind.h>
-#include <deal.II/base/thread_local_storage.h>
 
 #if DEAL_II_USE_MT == 1
 #  include <deal.II/base/thread_management.h>
@@ -156,7 +155,7 @@ namespace WorkStream
                                          */
        typedef
        std_cxx1x::tuple<std::vector<Iterator>,
-                        Threads::ThreadLocalStorage<ScratchData>*,
+                        ScratchData*,
                         std::vector<CopyData>,
                         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.size(); ++i)
+             delete std_cxx1x::get<1>(ring_buffer[i]);
+         }
+      
                                         /**
                                          * Create a item and return a
                                          * pointer to it.
@@ -250,12 +258,6 @@ namespace WorkStream
                                          */
        std::vector<ItemType>        ring_buffer;
 
-                                        /**
-                                         * Scratch data object. Each thread will 
-                                         * have its own local copy. 
-                                         */
-       Threads::ThreadLocalStorage<ScratchData> 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<std_cxx1x::get<3>(*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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.