walberla::blockforest::DynamicCurveBalance< PhantomData_T > Class Template Reference

Detailed Description

template<typename PhantomData_T>
class walberla::blockforest::DynamicCurveBalance< PhantomData_T >

This class implements Hilber and Morton space filling curves for load balancing.

All algorithms are implemented to work levelwise. Load balancing with levels ignored is possible by specifying levelwise = false in the constructor.

#include <DynamicCurve.h>

Public Types

using weight_t = typename PhantomData_T::weight_t
 
using pid_t = mpi::MPIRank
 
using idx_t = uint16_t
 
using Node = internal::Node< pid_t, idx_t >
 

Public Member Functions

 DynamicCurveBalance (const bool hilbert=true, const bool allGather=true, const bool levelwise=true)
 
bool operator() (std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom, const PhantomBlockForest &phantomForest, const uint_t iteration) const
 
void setMaxBlocksPerProcess (const int maxBlocks)
 
int getMaxBlocksPerProcess () const
 

Private Member Functions

void allGatherWeighted (std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom, const PhantomBlockForest &phantomForest) const
 
void allGatherNoWeight (std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom, const PhantomBlockForest &phantomForest) const
 
void masterWeighted (std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom, const PhantomBlockForest &phantomForest) const
 
void masterNoWeight (std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom, const PhantomBlockForest &phantomForest) const
 
void hilbertOrderWeighted (const std::vector< std::vector< std::pair< BlockID, weight_t > > > &allBlocks, std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, const PhantomBlockForest &phantomForest) const
 
void hilbertOrderNoWeight (const std::vector< std::vector< BlockID > > &allBlocks, std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, const PhantomBlockForest &phantomForest) const
 
void addBlockToForest (std::vector< shared_ptr< Node > > &forest, const std::pair< pid_t, idx_t > &index, BlockID &id, const uint_t level) const
 
void mortonOrderWeighted (const std::vector< std::vector< std::pair< BlockID, weight_t > > > &allBlocks, std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, const PhantomBlockForest &phantomForest) const
 
void mortonOrderNoWeight (const std::vector< std::vector< BlockID > > &allBlocks, std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, const PhantomBlockForest &phantomForest) const
 
void balanceWeighted (const std::vector< std::vector< std::pair< BlockID, weight_t > > > &allBlocks, const std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, std::vector< std::vector< pid_t > > &targets, std::vector< std::set< pid_t > > &sender) const
 
void balanceNoWeight (const std::vector< std::vector< BlockID > > &allBlocks, const std::vector< std::vector< std::pair< pid_t, idx_t > > > &blocksPerLevel, std::vector< std::vector< pid_t > > &targets, std::vector< std::set< pid_t > > &sender) const
 
void masterEnd (std::vector< std::vector< pid_t > > &targets, std::vector< std::set< pid_t > > &sender, std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom) const
 
void finalAssignment (const uint_t index, const std::vector< std::vector< pid_t > > &targets, const std::vector< std::set< pid_t > > &sender, std::vector< std::pair< const PhantomBlock *, uint_t > > &targetProcess, std::set< uint_t > &processesToRecvFrom) const
 
bool weightedBlocks () const
 
template<typename T >
pid_t pid_c (const T &value) const
 
template<typename T >
idx_t idx_c (const T &value) const
 

Private Attributes

bool hilbert_
 
bool allGather_
 
bool levelwise_
 All gets for levels are wrapped like. More...
 
int maxBlocksPerProcess_ = std::numeric_limits<int>::max()
 limits the maximum number of blocks per process More...
 

Member Typedef Documentation

◆ idx_t

template<typename PhantomData_T >
using walberla::blockforest::DynamicCurveBalance< PhantomData_T >::idx_t = uint16_t

◆ Node

template<typename PhantomData_T >
using walberla::blockforest::DynamicCurveBalance< PhantomData_T >::Node = internal::Node<pid_t, idx_t>

◆ pid_t

template<typename PhantomData_T >
using walberla::blockforest::DynamicCurveBalance< PhantomData_T >::pid_t = mpi::MPIRank

◆ weight_t

template<typename PhantomData_T >
using walberla::blockforest::DynamicCurveBalance< PhantomData_T >::weight_t = typename PhantomData_T::weight_t

Constructor & Destructor Documentation

◆ DynamicCurveBalance()

template<typename PhantomData_T >
walberla::blockforest::DynamicCurveBalance< PhantomData_T >::DynamicCurveBalance ( const bool  hilbert = true,
const bool  allGather = true,
const bool  levelwise = true 
)
inline

Member Function Documentation

◆ addBlockToForest()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::addBlockToForest ( std::vector< shared_ptr< Node > > &  forest,
const std::pair< pid_t, idx_t > &  index,
BlockID id,
const uint_t  level 
) const
private

◆ allGatherNoWeight()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::allGatherNoWeight ( std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom,
const PhantomBlockForest phantomForest 
) const
private

◆ allGatherWeighted()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::allGatherWeighted ( std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom,
const PhantomBlockForest phantomForest 
) const
private

◆ balanceNoWeight()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::balanceNoWeight ( const std::vector< std::vector< BlockID > > &  allBlocks,
const std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
std::vector< std::vector< pid_t > > &  targets,
std::vector< std::set< pid_t > > &  sender 
) const
private

◆ balanceWeighted()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::balanceWeighted ( const std::vector< std::vector< std::pair< BlockID, weight_t > > > &  allBlocks,
const std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
std::vector< std::vector< pid_t > > &  targets,
std::vector< std::set< pid_t > > &  sender 
) const
private

◆ finalAssignment()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::finalAssignment ( const uint_t  index,
const std::vector< std::vector< pid_t > > &  targets,
const std::vector< std::set< pid_t > > &  sender,
std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom 
) const
private

◆ getMaxBlocksPerProcess()

template<typename PhantomData_T >
int walberla::blockforest::DynamicCurveBalance< PhantomData_T >::getMaxBlocksPerProcess ( ) const
inline

◆ hilbertOrderNoWeight()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::hilbertOrderNoWeight ( const std::vector< std::vector< BlockID > > &  allBlocks,
std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
const PhantomBlockForest phantomForest 
) const
private

◆ hilbertOrderWeighted()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::hilbertOrderWeighted ( const std::vector< std::vector< std::pair< BlockID, weight_t > > > &  allBlocks,
std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
const PhantomBlockForest phantomForest 
) const
private

◆ idx_c()

template<typename PhantomData_T >
template<typename T >
idx_t walberla::blockforest::DynamicCurveBalance< PhantomData_T >::idx_c ( const T &  value) const
inlineprivate

◆ masterEnd()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::masterEnd ( std::vector< std::vector< pid_t > > &  targets,
std::vector< std::set< pid_t > > &  sender,
std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom 
) const
private

◆ masterNoWeight()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::masterNoWeight ( std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom,
const PhantomBlockForest phantomForest 
) const
private

◆ masterWeighted()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::masterWeighted ( std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom,
const PhantomBlockForest phantomForest 
) const
private

◆ mortonOrderNoWeight()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::mortonOrderNoWeight ( const std::vector< std::vector< BlockID > > &  allBlocks,
std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
const PhantomBlockForest phantomForest 
) const
private

◆ mortonOrderWeighted()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::mortonOrderWeighted ( const std::vector< std::vector< std::pair< BlockID, weight_t > > > &  allBlocks,
std::vector< std::vector< std::pair< pid_t, idx_t > > > &  blocksPerLevel,
const PhantomBlockForest phantomForest 
) const
private

◆ operator()()

template<typename PhantomData_T >
bool walberla::blockforest::DynamicCurveBalance< PhantomData_T >::operator() ( std::vector< std::pair< const PhantomBlock *, uint_t > > &  targetProcess,
std::set< uint_t > &  processesToRecvFrom,
const PhantomBlockForest phantomForest,
const uint_t  iteration 
) const

◆ pid_c()

template<typename PhantomData_T >
template<typename T >
pid_t walberla::blockforest::DynamicCurveBalance< PhantomData_T >::pid_c ( const T &  value) const
inlineprivate

◆ setMaxBlocksPerProcess()

template<typename PhantomData_T >
void walberla::blockforest::DynamicCurveBalance< PhantomData_T >::setMaxBlocksPerProcess ( const int  maxBlocks)
inline

◆ weightedBlocks()

template<typename PhantomData_T >
bool walberla::blockforest::DynamicCurveBalance< PhantomData_T >::weightedBlocks ( ) const
inlineprivate

Member Data Documentation

◆ allGather_

template<typename PhantomData_T >
bool walberla::blockforest::DynamicCurveBalance< PhantomData_T >::allGather_
private

◆ hilbert_

template<typename PhantomData_T >
bool walberla::blockforest::DynamicCurveBalance< PhantomData_T >::hilbert_
private

◆ levelwise_

template<typename PhantomData_T >
bool walberla::blockforest::DynamicCurveBalance< PhantomData_T >::levelwise_
private

All gets for levels are wrapped like.

levelwise_ ? getCorrectLevel() : 0

This allows to use the same algorithm for levelwise balancing as well as for balancing without levels.

◆ maxBlocksPerProcess_

template<typename PhantomData_T >
int walberla::blockforest::DynamicCurveBalance< PhantomData_T >::maxBlocksPerProcess_ = std::numeric_limits<int>::max()
private

limits the maximum number of blocks per process


The documentation for this class was generated from the following file:
bool levelwise_
All gets for levels are wrapped like.
Definition: DynamicCurve.h:199