ALL 0.9.3
A Loadbalacing Library
Loading...
Searching...
No Matches
ALL::LB< T, W > Class Template Referenceabstract

#include <ALL_LB.hpp>

+ Inheritance diagram for ALL::LB< T, W >:
+ Collaboration diagram for ALL::LB< T, W >:

Public Member Functions

 LB (const int dim, const T g)
 
virtual ~LB ()=default
 destructor
 
virtual void balance (const int step)=0
 abstract definition of the balancing method
 
virtual int getDimension ()
 
double getEfficiency ()
 
virtual W getEstimatedEfficiency ()=0
 
virtual const T getGamma ()
 
virtual const std::vector< T > & getMinDomainSize ()
 
virtual std::vector< int > & getNeighbors ()=0
 
std::vector< T > & getNeighborVertices ()
 
int getNVertices ()
 
virtual std::vector< Point< T > > & getPrevVertices ()
 
virtual const std::vector< T > & getSysSize ()
 
virtual std::vector< Point< T > > & getVertices ()
 
virtual std::vector< W > & getWork ()
 
virtual void setAdditionalData (const void *data)=0
 
virtual void setCommunicator (const MPI_Comm comm)
 
virtual void setDimension (const int d)
 
virtual void setGamma (const T g)
 
virtual void setMinDomainSize (const std::vector< T > &minSize)
 
virtual void setSysSize (const std::vector< T > &newSysSize)
 
virtual void setup ()=0
 abstract definition of the setup method
 
virtual void setVertices (const std::vector< Point< T > > &vertices_in)
 
virtual void setWork (const std::vector< W > &w)
 
virtual void setWork (const W w)
 

Protected Member Functions

void resizeVertices (const int newSize)
 

Protected Attributes

int dimension
 dimension of the used vertices
 
gamma
 correction factor
 
std::vector< int > global_dims
 dimensions of the global process grid
 
MPI_Comm globalComm
 used MPI communicator
 
std::vector< int > local_coords
 cartesian coordinates of the local domain in the process grid
 
int localRank
 local rank in the used MPI communicator
 
std::vector< T > minSize
 
std::vector< T > neighborVertices
 vertices describing neighboring domains
 
std::vector< int > periodicity
 periodicity of the MPI communicator / system
 
std::vector< Point< T > > prevVertices
 original vertices before previous balancing step
 
std::vector< T > sysSize
 (orthogonal) system size
 
std::vector< Point< T > > vertices
 local vertices after previous balancing step
 
std::vector< W > work
 local work
 

Detailed Description

template<class T, class W>
class ALL::LB< T, W >
Template Parameters
Tdata for vertices and related data
Wdata for work and related data

Definition at line 43 of file ALL_LB.hpp.

Constructor & Destructor Documentation

◆ LB()

template<class T, class W>
ALL::LB< T, W >::LB ( const int dim,
const T g )
inline

constructor for the basic load-balancing class, sets up parameters required by all balancing methods

Parameters
[in]dimdimension of the vertices used
[in]gcorrection factor for the computation of shifts

Definition at line 49 of file ALL_LB.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~LB()

template<class T, class W>
virtual ALL::LB< T, W >::~LB ( )
virtualdefault

destructor

Member Function Documentation

◆ balance()

template<class T, class W>
virtual void ALL::LB< T, W >::balance ( const int step)
pure virtual

◆ getDimension()

template<class T, class W>
virtual int ALL::LB< T, W >::getDimension ( )
inlinevirtual

method to get the dimension of the vertices

Returns
the dimension of the vertices

Definition at line 99 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ getEfficiency()

template<class T, class W>
double ALL::LB< T, W >::getEfficiency ( )
inline

method to get the current LB efficiency with the given work distribution

Returns
current LB efficiency

Definition at line 182 of file ALL_LB.hpp.

◆ getEstimatedEfficiency()

template<class T, class W>
virtual W ALL::LB< T, W >::getEstimatedEfficiency ( )
pure virtual

method to get an estimated LB efficiency after the balance step (currently only implemented in ALL::HISTOGRAM!)

Returns
double providing the estimated LB after the balance step

Implemented in ALL::ForceBased_LB< T, W >, ALL::Histogram_LB< T, W >, ALL::Staggered_LB< T, W >, ALL::Tensor_LB< T, W >, and ALL::Voronoi_LB< T, W >.

◆ getGamma()

template<class T, class W>
virtual const T ALL::LB< T, W >::getGamma ( )
inlinevirtual

method to get the correction value currently used

Returns
the current correction value

Definition at line 107 of file ALL_LB.hpp.

◆ getMinDomainSize()

template<class T, class W>
virtual const std::vector< T > & ALL::LB< T, W >::getMinDomainSize ( )
inlinevirtual

method to get the minimum domain size the balancing methods have to obey

Returns
the minimum domain size allowed

Definition at line 129 of file ALL_LB.hpp.

◆ getNeighbors()

template<class T, class W>
virtual std::vector< int > & ALL::LB< T, W >::getNeighbors ( )
pure virtual

abstract definition of the method to get the neighbors of the local domain

Returns
std::vector<int> to store the MPI ranks of the neighbors to

Implemented in ALL::ForceBased_LB< T, W >, ALL::Histogram_LB< T, W >, ALL::Staggered_LB< T, W >, ALL::Tensor_LB< T, W >, and ALL::Voronoi_LB< T, W >.

◆ getNeighborVertices()

template<class T, class W>
std::vector< T > & ALL::LB< T, W >::getNeighborVertices ( )
inline

method to provide a list of vertices describing the neighboring domains currently only implemented for VORONOI, as a means to get the anchor points of the surrounding domains

Definition at line 201 of file ALL_LB.hpp.

◆ getNVertices()

template<class T, class W>
int ALL::LB< T, W >::getNVertices ( )
inline

method the get the number of vertices stored for the local domain

Returns
number of local vertices

Definition at line 168 of file ALL_LB.hpp.

◆ getPrevVertices()

template<class T, class W>
virtual std::vector< Point< T > > & ALL::LB< T, W >::getPrevVertices ( )
inlinevirtual

method to get the original vertices before the last balancing step

Returns
the original unmodified vertices before the last balancing step
Attention
since the original and resulting vertices are set up in the balancing method, the result is undefined before calling the balancing method at least once

Definition at line 155 of file ALL_LB.hpp.

◆ getSysSize()

template<class T, class W>
virtual const std::vector< T > & ALL::LB< T, W >::getSysSize ( )
inlinevirtual

method to get the currently stored system size

Returns
the currently stored system size

Definition at line 139 of file ALL_LB.hpp.

◆ getVertices()

template<class T, class W>
virtual std::vector< Point< T > > & ALL::LB< T, W >::getVertices ( )
inlinevirtual

method to get result vertices

Returns
the resulting vertices after a balancing step

Definition at line 148 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ getWork()

template<class T, class W>
virtual std::vector< W > & ALL::LB< T, W >::getWork ( )
inlinevirtual

method to get the currently stored work for the local process

Returns
the currently stored work
Attention
always returns a std::vector, for scalar work, it has length 1

Definition at line 144 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ resizeVertices()

template<class T, class W>
void ALL::LB< T, W >::resizeVertices ( const int newSize)
inlineprotected

method the resize the vertex list

Parameters
[in]new_sizethe new size of the vertex list

Definition at line 234 of file ALL_LB.hpp.

◆ setAdditionalData()

template<class T, class W>
virtual void ALL::LB< T, W >::setAdditionalData ( const void * data)
pure virtual

method to set undefined method specific data, which is not shared between different methods but needs to be set by a unified interface

Parameters
[in]datathe data be passed to the balancing method

Implemented in ALL::Histogram_LB< T, W >.

◆ setCommunicator()

template<class T, class W>
virtual void ALL::LB< T, W >::setCommunicator ( const MPI_Comm comm)
inlinevirtual

method to set the MPI communicator to be used by the balancing method

Parameters
[in]commthe MPI communicator to be used

Definition at line 159 of file ALL_LB.hpp.

◆ setDimension()

template<class T, class W>
virtual void ALL::LB< T, W >::setDimension ( const int d)
inlinevirtual

method to set the dimension of the vertices

Parameters
[in]dthe dimension to be used
Attention
most methods currently support 3D vertices only

Definition at line 88 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ setGamma()

template<class T, class W>
virtual void ALL::LB< T, W >::setGamma ( const T g)
inlinevirtual

method to set the correction value gamma

Parameters
[in]gthe correction value to use

Definition at line 103 of file ALL_LB.hpp.

◆ setMinDomainSize()

template<class T, class W>
virtual void ALL::LB< T, W >::setMinDomainSize ( const std::vector< T > & minSize)
inlinevirtual

method to set the minimum domain size in each dimension

Parameters
[in]minSizethe minimum size of a domain in all dimensions

Definition at line 123 of file ALL_LB.hpp.

◆ setSysSize()

template<class T, class W>
virtual void ALL::LB< T, W >::setSysSize ( const std::vector< T > & newSysSize)
inlinevirtual

method to set the (orthogonal) size of the system

Parameters
[in]sysSizesystem size in all dimensions

Definition at line 133 of file ALL_LB.hpp.

◆ setup()

template<class T, class W>
virtual void ALL::LB< T, W >::setup ( )
pure virtual

◆ setVertices()

template<class T, class W>
virtual void ALL::LB< T, W >::setVertices ( const std::vector< Point< T > > & vertices_in)
inlinevirtual

method to update the vertices used for the balancing step, overwrites old set of vertices

Parameters
[in]vertices_invector containg the new vertices to be used

Definition at line 76 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ setWork() [1/2]

template<class T, class W>
virtual void ALL::LB< T, W >::setWork ( const std::vector< W > & w)
inlinevirtual

method to set a multi-dimensional work for the local domain

Parameters
[in]wvector containing all the dimensions of the work to be used for the local domain

Definition at line 112 of file ALL_LB.hpp.

+ Here is the caller graph for this function:

◆ setWork() [2/2]

template<class T, class W>
virtual void ALL::LB< T, W >::setWork ( const W w)
inlinevirtual

method to set a scalar work for the local domain

Parameters
[in]wvalue containing the work to be used for the local domain

Definition at line 116 of file ALL_LB.hpp.

Member Data Documentation

◆ dimension

template<class T, class W>
int ALL::LB< T, W >::dimension
protected

dimension of the used vertices

Definition at line 208 of file ALL_LB.hpp.

◆ gamma

template<class T, class W>
T ALL::LB< T, W >::gamma
protected

correction factor

Definition at line 206 of file ALL_LB.hpp.

◆ global_dims

template<class T, class W>
std::vector<int> ALL::LB< T, W >::global_dims
protected

dimensions of the global process grid

Definition at line 225 of file ALL_LB.hpp.

◆ globalComm

template<class T, class W>
MPI_Comm ALL::LB< T, W >::globalComm
protected

used MPI communicator

Definition at line 210 of file ALL_LB.hpp.

◆ local_coords

template<class T, class W>
std::vector<int> ALL::LB< T, W >::local_coords
protected

cartesian coordinates of the local domain in the process grid

Definition at line 227 of file ALL_LB.hpp.

◆ localRank

template<class T, class W>
int ALL::LB< T, W >::localRank
protected

local rank in the used MPI communicator

Definition at line 212 of file ALL_LB.hpp.

◆ minSize

template<class T, class W>
std::vector<T> ALL::LB< T, W >::minSize
protected

minimum domain size

Attention
not all balancing method support this

Definition at line 215 of file ALL_LB.hpp.

◆ neighborVertices

template<class T, class W>
std::vector<T> ALL::LB< T, W >::neighborVertices
protected

vertices describing neighboring domains

Definition at line 231 of file ALL_LB.hpp.

◆ periodicity

template<class T, class W>
std::vector<int> ALL::LB< T, W >::periodicity
protected

periodicity of the MPI communicator / system

Definition at line 229 of file ALL_LB.hpp.

◆ prevVertices

template<class T, class W>
std::vector<Point<T> > ALL::LB< T, W >::prevVertices
protected

original vertices before previous balancing step

Definition at line 223 of file ALL_LB.hpp.

◆ sysSize

template<class T, class W>
std::vector<T> ALL::LB< T, W >::sysSize
protected

(orthogonal) system size

Definition at line 217 of file ALL_LB.hpp.

◆ vertices

template<class T, class W>
std::vector<Point<T> > ALL::LB< T, W >::vertices
protected

local vertices after previous balancing step

Definition at line 221 of file ALL_LB.hpp.

◆ work

template<class T, class W>
std::vector<W> ALL::LB< T, W >::work
protected

local work

Definition at line 219 of file ALL_LB.hpp.


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