25#ifndef LOAD_BALANCER_H
26#define LOAD_BALANCER_H
40template<
typename T>
class CuboidGeometry3D;
41template<
typename T>
class CuboidGeometry2D;
42template<
typename T>
class HeuristicLoadBalancer;
104 return std::get<1>(*iter);
106 #ifdef PLATFORM_GPU_CUDA
109 #ifdef PLATFORM_CPU_SIMD
130 bool*
getBlock(std::size_t iBlock, std::size_t& sizeBlock,
bool loadingMode)
override;
132 void print(
bool multiOutput =
false)
const;
145 std::string defaultMode =
"Block";
152 bool newFile = ( fileAttr !=
"Attribute not found." );
160 bool verbose =
false;
164 if ( mode ==
"Attribute not found.") {
165 clout <<
"Warning: Cannot read parameter from Xml-file: Mode. Set default: mode = " << defaultMode << std::endl;
170 if ( mode ==
"Heuristic" ) {
172 double ratioFullEmpty;
173 if (!(*lbXml)[
"RatioFullEmpty"].read<double>(ratioFullEmpty, verbose)) {
182 else if ( mode ==
"Base" ) {
185 clout <<
"LOADING BASE LB NOT IMPLEMENTED YET!" << std::endl;
186 (*lbXml).setWarningsOn(
true);
192 else if ( mode ==
"Block" ) {
194 if (!(*lbXml)[
"Size"].read<int>(size, verbose)) {
195 clout <<
"Warning: Cannot read parameter from Xml-file: Size. Set default: size = 1"
202 (*lbXml).setWarningsOn(
true);
Base class for serializable objects of dynamic size
A cuboid geometry represents a voxel mesh.
Constructs a load balancer from a given cuboid geometry using a heurist.
Base class for all LoadBalancer.
int rank(const int &glob)
bool operator==(const LoadBalancer< T > &rhs) const
equal operator
virtual void setPlatform(int loc, Platform platform)
bool isLocal(const int &glob)
returns whether glob is on this process
virtual Platform platform(int loc) const
std::size_t getSerializableSize() const override
Binary size for the serializer.
void print(bool multiOutput=false) const
virtual ~LoadBalancer()
Default empty destructor.
std::map< int, Platform > _platform
maps global cuboid number to local platform
std::vector< int > _glob
content is 0,1,2,...,_size
int _size
number of cuboids after shrink -1 in appropriate thread
void swap(LoadBalancer< T > &loadBalancer)
Swap method.
std::size_t getNblock() const override
Number of data blocks for the serializable interface.
bool * getBlock(std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override
Return a pointer to the memory of the current block and its size for the serializable interface.
std::map< int, int > _rank
maps global cuboid number to the processing thread
std::map< int, int > _loc
maps global cuboid to (local) thread cuboid
LoadBalancer(int size=1)
Default empty constructor.
class for marking output with some text
std::string getAttribute(const std::string &aName) const
void setWarningsOn(bool warnings) const
switch warnings on/off
std::string getLogOutDir() const
Directories & directories()
Top level namespace for all of OpenLB.
LoadBalancer< T > * createLoadBalancer(XMLreader const &xmlReader, CuboidGeometry3D< T > *cGeo=NULL)
Creator Function for LoadBalancer from XMLreader.
Platform
OpenLB execution targets.
@ CPU_SIMD
Basic scalar CPU.
@ GPU_CUDA
Vector CPU (AVX2 / AVX-512 collision)
Definition of singletons: global, publicly available information.
Input/Output in XML format – header file.