This class is useful for index iteration over containers.
More...
#include <parallel_utilities.h>
|
| IndexPartition (TIndexType Size, int Nchunks=ParallelUtilities::GetNumThreads()) |
| constructor using the size of the partition to be used More...
|
|
template<class TUnaryFunction > |
void | for_pure_c11 (TUnaryFunction &&f) |
|
template<class TUnaryFunction > |
void | for_each (TUnaryFunction &&f) |
|
template<class TReducer , class TUnaryFunction > |
TReducer::return_type | for_each (TUnaryFunction &&f) |
|
template<class TThreadLocalStorage , class TFunction > |
void | for_each (const TThreadLocalStorage &rThreadLocalStoragePrototype, TFunction &&f) |
| loop with thread local storage (TLS). f called on every entry in rData More...
|
|
template<class TReducer , class TThreadLocalStorage , class TFunction > |
TReducer::return_type | for_each (const TThreadLocalStorage &rThreadLocalStoragePrototype, TFunction &&f) |
|
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
class Kratos::IndexPartition< TIndexType, TMaxThreads >
This class is useful for index iteration over containers.
- Parameters
-
TIndexType | type of index to be used in the loop |
TMaxThreads | - maximum number of threads allowed in the partitioning. must be known at compile time to avoid heap allocations in the partitioning |
◆ IndexPartition()
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
constructor using the size of the partition to be used
- Parameters
-
Size | - the size of the partition |
Nchunks | - number of threads to be used in the loop (must be lower than TMaxThreads) |
◆ for_each() [1/4]
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
template<class TThreadLocalStorage , class TFunction >
void Kratos::IndexPartition< TIndexType, TMaxThreads >::for_each |
( |
const TThreadLocalStorage & |
rThreadLocalStoragePrototype, |
|
|
TFunction && |
f |
|
) |
| |
|
inline |
loop with thread local storage (TLS). f called on every entry in rData
- Parameters
-
TThreadLocalStorage | template parameter specifying the thread local storage |
f | - must be a function accepting as input IndexType and the thread local storage |
◆ for_each() [2/4]
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
template<class TReducer , class TThreadLocalStorage , class TFunction >
TReducer::return_type Kratos::IndexPartition< TIndexType, TMaxThreads >::for_each |
( |
const TThreadLocalStorage & |
rThreadLocalStoragePrototype, |
|
|
TFunction && |
f |
|
) |
| |
|
inline |
version with reduction and thread local storage (TLS) to be called for each index in the partition function f is expected to return the values to be reduced
- Parameters
-
TReducer | - template parameter specifying the type of reducer to be applied |
TThreadLocalStorage | template parameter specifying the thread local storage |
f | - must be a function accepting as input IndexType and the thread local storage |
◆ for_each() [3/4]
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
template<class TUnaryFunction >
simple version of for_each (no reduction) to be called for each index in the partition
- Parameters
-
f | - must be a unary function accepting as input IndexType |
◆ for_each() [4/4]
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
template<class TReducer , class TUnaryFunction >
version with reduction to be called for each index in the partition function f is expected to return the values to be reduced
- Parameters
-
TReducer | - template parameter specifying the type of reducer to be applied |
f | - must be a unary function accepting as input IndexType |
◆ for_pure_c11()
template<class TIndexType = std::size_t, int TMaxThreads = Globals::MaxAllowedThreads>
template<class TUnaryFunction >
The documentation for this class was generated from the following file: