<h3>Specific improvements</h3>
<ol>
+<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
<br>
(Jörg Frohne, 2011/11/01)
-<ol>
<li> Fixed: SparseMatrix::mmult and SpareMatrix::Tmmult had a number of
issues that are now fixed: (i) rebuilding the sparsity pattern was allowed
even if several of the matrices involved in these operations shared a
#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>
*/
typedef
std_cxx1x::tuple<std::vector<Iterator>,
- ScratchData*,
+ Threads::ThreadLocalStorage<ScratchData>*,
std::vector<CopyData>,
unsigned int>
ItemType;
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)
{
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.
*/
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
* 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,
std_cxx1x::get<0>(ring_buffer[element])
.resize (chunk_size, remaining_iterator_range.second);
std_cxx1x::get<1>(ring_buffer[element])
- = new ScratchData(sample_scratch_data);
+ = &thread_local_scratch;
std_cxx1x::get<2>(ring_buffer[element])
.resize (chunk_size, sample_copy_data);
}
// 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),
+ std_cxx1x::get<1>(*current_item)->get(),
std_cxx1x::get<2>(*current_item)[i]);
// then return the original pointer