KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Public Member Functions | List of all members
Kratos::BlockPartition< TIterator, MaxThreads > Class Template Reference

#include <parallel_utilities.h>

Collaboration diagram for Kratos::BlockPartition< TIterator, MaxThreads >:

Public Member Functions

 BlockPartition (TIterator it_begin, TIterator it_end, int Nchunks=ParallelUtilities::GetNumThreads())
 
template<class TUnaryFunction >
void for_each (TUnaryFunction &&f)
 simple iteration loop. f called on every entry in rData More...
 
template<class TReducer , class TUnaryFunction >
TReducer::return_type for_each (TUnaryFunction &&f)
 loop allowing reductions. f called on every entry in rData the function f needs to return the values to be used by the reducer More...
 
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)
 loop with thread local storage (TLS) allowing reductions. f called on every entry in rData the function f needs to return the values to be used by the reducer More...
 

Detailed Description

template<class TIterator, int MaxThreads = Globals::MaxAllowedThreads>
class Kratos::BlockPartition< TIterator, MaxThreads >

Parameters
TIterator- type of iterator (must be a random access iterator)
MaxThreads- maximum number of threads allowed in the partitioning. must be known at compile time to avoid heap allocations in the partitioning

Constructor & Destructor Documentation

◆ BlockPartition()

template<class TIterator , int MaxThreads = Globals::MaxAllowedThreads>
Kratos::BlockPartition< TIterator, MaxThreads >::BlockPartition ( TIterator  it_begin,
TIterator  it_end,
int  Nchunks = ParallelUtilities::GetNumThreads() 
)
inline
Parameters
it_begin- iterator pointing at the beginning of the container
it_end- iterator pointing to the end of the container
Nchunks- number of threads to be used in the loop (must be lower than TMaxThreads)

Member Function Documentation

◆ for_each() [1/4]

template<class TIterator , int MaxThreads = Globals::MaxAllowedThreads>
template<class TThreadLocalStorage , class TFunction >
void Kratos::BlockPartition< TIterator, MaxThreads >::for_each ( const TThreadLocalStorage &  rThreadLocalStoragePrototype,
TFunction &&  f 
)
inline

loop with thread local storage (TLS). f called on every entry in rData

Parameters
TThreadLocalStoragetemplate parameter specifying the thread local storage
f- must be a function accepting as input TContainerType::value_type& and the thread local storage

◆ for_each() [2/4]

template<class TIterator , int MaxThreads = Globals::MaxAllowedThreads>
template<class TReducer , class TThreadLocalStorage , class TFunction >
TReducer::return_type Kratos::BlockPartition< TIterator, MaxThreads >::for_each ( const TThreadLocalStorage &  rThreadLocalStoragePrototype,
TFunction &&  f 
)
inline

loop with thread local storage (TLS) allowing reductions. f called on every entry in rData the function f needs to return the values to be used by the reducer

Parameters
TReducertemplate parameter specifying the reduction operation to be done
TThreadLocalStoragetemplate parameter specifying the thread local storage
f- must be a function accepting as input TContainerType::value_type& and the thread local storage

◆ for_each() [3/4]

template<class TIterator , int MaxThreads = Globals::MaxAllowedThreads>
template<class TUnaryFunction >
void Kratos::BlockPartition< TIterator, MaxThreads >::for_each ( TUnaryFunction &&  f)
inline

simple iteration loop. f called on every entry in rData

Parameters
f- must be a unary function accepting as input TContainerType::value_type&

◆ for_each() [4/4]

template<class TIterator , int MaxThreads = Globals::MaxAllowedThreads>
template<class TReducer , class TUnaryFunction >
TReducer::return_type Kratos::BlockPartition< TIterator, MaxThreads >::for_each ( TUnaryFunction &&  f)
inline

loop allowing reductions. f called on every entry in rData the function f needs to return the values to be used by the reducer

Parameters
TReducertemplate parameter specifying the reduction operation to be done
f- must be a unary function accepting as input TContainerType::value_type&

The documentation for this class was generated from the following file: