1#ifndef DUNE_FEM_THREADSAFEVALUES_HH
2#define DUNE_FEM_THREADSAFEVALUES_HH
19#ifdef USE_SMP_PARALLEL
20 std::vector< T > value_;
29 template<
class ...Args >
31#ifdef USE_SMP_PARALLEL
34 : value_( std::forward< Args >( args )... )
41#ifdef USE_SMP_PARALLEL
60 assert( thread <
size() );
61#ifdef USE_SMP_PARALLEL
62 assert( thread < value_.size() );
65#ifdef USE_SMP_PARALLEL
73 assert( thread <
size() );
74#ifdef USE_SMP_PARALLEL
75 assert( thread < value_.size() );
78#ifdef USE_SMP_PARALLEL
Definition: bindguard.hh:11
Definition: mpimanager.hh:337
static int thread()
return thread number
Definition: mpimanager.hh:424
static int maxThreads()
return maximal number of threads possible in the current run
Definition: mpimanager.hh:418
ThreadSafeValue realizes thread safety for a given variable by creating an instance of this variable ...
Definition: threadsafevalue.hh:18
size_t size() const
return number of threads
Definition: threadsafevalue.hh:48
ValueType & operator*()
return reference to thread private value
Definition: threadsafevalue.hh:51
ValueType & operator[](const unsigned int thread)
return reference to private value for given thread number
Definition: threadsafevalue.hh:59
T ValueType
type of value to be thread safe
Definition: threadsafevalue.hh:26
ThreadSafeValue()
default constructor
Definition: threadsafevalue.hh:39
ThreadSafeValue(Args &&...args)
constructor initializing values for all threads given a init value
Definition: threadsafevalue.hh:30