Advanced Multi-Physics (AMP)
On-Line Documentation
loadBalanceSimulator.h
Go to the documentation of this file.
1#ifndef included_AMP_loadBalanceSimulator
2#define included_AMP_loadBalanceSimulator
3
4#include "AMP/utils/Database.h"
5
6
7namespace AMP::Mesh {
8
9
17{
18public:
24 loadBalanceSimulator( std::shared_ptr<const AMP::Database> params );
25
33 loadBalanceSimulator( double cost, int maxProc = 0, const std::string &name = "" );
34
42 loadBalanceSimulator( const std::vector<loadBalanceSimulator> &meshes,
43 int method = 2,
44 const std::string &name = "" );
45
48
50 size_t getMethod() const { return d_method; }
51
53 inline int nRanks() const { return d_end - d_begin; }
54
56 std::vector<int> getRanks() const;
57
59 inline std::vector<int> getRanks( int i ) const { return d_submeshes[i].getRanks(); }
60
62 inline int maxProcs() const { return d_max_procs; }
63
65 void setProcs( int N_ranks );
66
68 inline const auto &getSubmeshes() const { return d_submeshes; }
69
71 int getMeshCount() const;
72
74 double getCost() const { return d_cost; }
75
77 std::vector<double> getRankCost() const;
78
90 void print( uint8_t detail = 0, uint8_t indent = 0 );
91
92
93private: // Internal data
94 std::string d_name; // Name of mesh
95 double d_cost; // Total cost of the mesh
96 double d_maxCostRank; // Current maximum cost of any rank
97 int d_max_procs; // Maximum number of allowed ranks
98 int d_method; // Load balance method (see MultiMesh)
99 bool d_allEqual; // Is the cost of all meshes equal
100 int d_begin; // Begin assigned rank
101 int d_end; // End assigned rank
102 std::vector<loadBalanceSimulator> d_submeshes; // list of sub-meshes
103
104
105private: // Private functions
106 void setRanks( int begin, int end );
107 inline void setRanks( int rank ) { setRanks( rank, rank + 1 ); }
108 void addRankCost( std::vector<double> &cost ) const;
109 void addRank();
110 void addRanks( int N );
111 void copyRanks( const loadBalanceSimulator &x, int offset );
112 void loadBalance( int, std::vector<int> &N );
113};
114
115
116} // namespace AMP::Mesh
117
118#endif
Class used to contain simulated mesh load.
void print(uint8_t detail=0, uint8_t indent=0)
Print the mesh hierarchy.
std::vector< int > getRanks() const
Function to get the ranks for the mesh.
int getMeshCount() const
Return the number of base meshes.
double getCost() const
Function to get the total cost.
int maxProcs() const
Function to change the ranks.
loadBalanceSimulator(double cost, int maxProc=0, const std::string &name="")
Default constructor.
const auto & getSubmeshes() const
Return the submeshes.
loadBalanceSimulator(std::shared_ptr< const AMP::Database > params)
Default constructor.
void loadBalance(int, std::vector< int > &N)
void copyRanks(const loadBalanceSimulator &x, int offset)
void setRanks(int begin, int end)
std::vector< loadBalanceSimulator > d_submeshes
loadBalanceSimulator(const std::vector< loadBalanceSimulator > &meshes, int method=2, const std::string &name="")
Default constructor.
size_t getMethod() const
Function to get the current ranks in the load balance.
void setProcs(int N_ranks)
Function to change the ranks.
std::vector< int > getRanks(int i) const
Function to get the ranks for the ith submesh.
std::vector< double > getRankCost() const
Get the cost per rank ( # of elements * relative weight )
int nRanks() const
Return the number of assigned ranks.
loadBalanceSimulator()
Empty constructor.
void addRankCost(std::vector< double > &cost) const



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page