1 #ifndef DUNE_FEM_THREADSAFEVALUES_HH 2 #define DUNE_FEM_THREADSAFEVALUES_HH 18 #ifdef USE_SMP_PARALLEL 19 std::vector< T > value_;
28 template<
class ...Args >
30 #ifdef USE_SMP_PARALLEL 33 : value_( std::forward< Args >( args )... )
40 #ifdef USE_SMP_PARALLEL
59 assert( thread <
size() );
61 #ifdef USE_SMP_PARALLEL 68 const ValueType&
operator [] (
const unsigned int thread )
const {
69 assert( thread <
size() );
71 #ifdef USE_SMP_PARALLEL ThreadSafeValue(Args &&...args)
constructor initializing values for all threads given a init value
Definition: threadsafevalue.hh:29
The ThreadManager wrapps basic shared memory functionality provided by OpenMP or pthreads such as thr...
Definition: threadmanager.hh:199
ValueType & operator[](const unsigned int thread)
return reference to private value for given thread number
Definition: threadsafevalue.hh:58
static int thread()
return thread number
Definition: threadmanager.hh:208
Definition: coordinate.hh:4
ValueType & operator*()
return reference to thread private value
Definition: threadsafevalue.hh:50
static int maxThreads()
return maximal number of threads possbile in the current run
Definition: threadmanager.hh:202
size_t size() const
return number of threads
Definition: threadsafevalue.hh:47
ThreadSafeValue realizes thread safety for a given variable by creating an instance of this variable ...
Definition: threadsafevalue.hh:16
T ValueType
type of value to be thread safe
Definition: threadsafevalue.hh:25
ThreadSafeValue()
default constructor
Definition: threadsafevalue.hh:38