Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AMP::Mesh::loadBalanceSimulator Class Reference

Class used to contain simulated mesh load. More...

#include <loadBalanceSimulator.h>

Public Member Functions

double getCost () const
 Function to get the total cost.
 
int getMeshCount () const
 Return the number of base meshes.
 
size_t getMethod () const
 Function to get the current ranks in the load balance.
 
std::vector< double > getRankCost () const
 Get the cost per rank ( # of elements * relative weight )
 
std::vector< int > getRanks () const
 Function to get the ranks for the mesh.
 
std::vector< int > getRanks (int i) const
 Function to get the ranks for the ith submesh.
 
const auto & getSubmeshes () const
 Return the submeshes.
 
 loadBalanceSimulator ()
 Empty constructor.
 
 loadBalanceSimulator (const std::vector< loadBalanceSimulator > &meshes, int method=2, const std::string &name="")
 Default constructor.
 
 loadBalanceSimulator (double cost, int maxProc=0, const std::string &name="")
 Default constructor.
 
 loadBalanceSimulator (std::shared_ptr< const AMP::Database > params)
 Default constructor.
 
int maxProcs () const
 Function to change the ranks.
 
int nRanks () const
 Return the number of assigned ranks.
 
void print (uint8_t detail=0, uint8_t indent=0)
 Print the mesh hierarchy.
 
void setProcs (int N_ranks)
 Function to change the ranks.
 

Private Member Functions

void addRank ()
 
void addRankCost (std::vector< double > &cost) const
 
void addRanks (int N)
 
void copyRanks (const loadBalanceSimulator &x, int offset)
 
void loadBalance (int, std::vector< int > &N)
 
void setRanks (int begin, int end)
 
void setRanks (int rank)
 

Private Attributes

bool d_allEqual
 
int d_begin
 
double d_cost
 
int d_end
 
int d_max_procs
 
double d_maxCostRank
 
int d_method
 
std::string d_name
 
std::vector< loadBalanceSimulatord_submeshes
 

Detailed Description

Class used to contain simulated mesh load.

This structure provides info that can be used to simulate loading a mesh, and checking the resulting load balance

Definition at line 16 of file loadBalanceSimulator.h.

Constructor & Destructor Documentation

◆ loadBalanceSimulator() [1/4]

AMP::Mesh::loadBalanceSimulator::loadBalanceSimulator ( std::shared_ptr< const AMP::Database params)

Default constructor.

This will simulate creating a new load balance

Parameters
paramsInput parameters for the mesh that will be used

◆ loadBalanceSimulator() [2/4]

AMP::Mesh::loadBalanceSimulator::loadBalanceSimulator ( double  cost,
int  maxProc = 0,
const std::string &  name = "" 
)

Default constructor.

This will simulate creating a new load balance

Parameters
costThe cost of the mesh (# of elements)
maxProcThe maximum number of processors (0: no limit)
nameThe mesh name

◆ loadBalanceSimulator() [3/4]

AMP::Mesh::loadBalanceSimulator::loadBalanceSimulator ( const std::vector< loadBalanceSimulator > &  meshes,
int  method = 2,
const std::string &  name = "" 
)

Default constructor.

This will simulate creating a new load balance

Parameters
meshesThe list of meshes
methodThe load balance method
nameThe mesh name

◆ loadBalanceSimulator() [4/4]

AMP::Mesh::loadBalanceSimulator::loadBalanceSimulator ( )

Empty constructor.

Member Function Documentation

◆ addRank()

void AMP::Mesh::loadBalanceSimulator::addRank ( )
private

◆ addRankCost()

void AMP::Mesh::loadBalanceSimulator::addRankCost ( std::vector< double > &  cost) const
private

◆ addRanks()

void AMP::Mesh::loadBalanceSimulator::addRanks ( int  N)
private

◆ copyRanks()

void AMP::Mesh::loadBalanceSimulator::copyRanks ( const loadBalanceSimulator x,
int  offset 
)
private

◆ getCost()

double AMP::Mesh::loadBalanceSimulator::getCost ( ) const
inline

Function to get the total cost.

Definition at line 74 of file loadBalanceSimulator.h.

References d_cost.

◆ getMeshCount()

int AMP::Mesh::loadBalanceSimulator::getMeshCount ( ) const

Return the number of base meshes.

◆ getMethod()

size_t AMP::Mesh::loadBalanceSimulator::getMethod ( ) const
inline

Function to get the current ranks in the load balance.

Definition at line 50 of file loadBalanceSimulator.h.

References d_method.

◆ getRankCost()

std::vector< double > AMP::Mesh::loadBalanceSimulator::getRankCost ( ) const

Get the cost per rank ( # of elements * relative weight )

◆ getRanks() [1/2]

std::vector< int > AMP::Mesh::loadBalanceSimulator::getRanks ( ) const

Function to get the ranks for the mesh.

◆ getRanks() [2/2]

std::vector< int > AMP::Mesh::loadBalanceSimulator::getRanks ( int  i) const
inline

Function to get the ranks for the ith submesh.

Definition at line 59 of file loadBalanceSimulator.h.

References d_submeshes.

◆ getSubmeshes()

const auto & AMP::Mesh::loadBalanceSimulator::getSubmeshes ( ) const
inline

Return the submeshes.

Definition at line 68 of file loadBalanceSimulator.h.

References d_submeshes.

◆ loadBalance()

void AMP::Mesh::loadBalanceSimulator::loadBalance ( int  ,
std::vector< int > &  N 
)
private

◆ maxProcs()

int AMP::Mesh::loadBalanceSimulator::maxProcs ( ) const
inline

Function to change the ranks.

Definition at line 62 of file loadBalanceSimulator.h.

References d_max_procs.

◆ nRanks()

int AMP::Mesh::loadBalanceSimulator::nRanks ( ) const
inline

Return the number of assigned ranks.

Definition at line 53 of file loadBalanceSimulator.h.

References d_begin, and d_end.

◆ print()

void AMP::Mesh::loadBalanceSimulator::print ( uint8_t  detail = 0,
uint8_t  indent = 0 
)

Print the mesh hierarchy.

This function will print the load balance and mesh hierarchy

Parameters
detailThe details on what to print (bit mask) 0: Auto determine the level of info to print 1: Print summary info only 3: Print summary + rank info 5: Print summary + mesh info 6: Print summary + rank + mesh info
indentNumber of spaces to indent the printing

◆ setProcs()

void AMP::Mesh::loadBalanceSimulator::setProcs ( int  N_ranks)

Function to change the ranks.

◆ setRanks() [1/2]

void AMP::Mesh::loadBalanceSimulator::setRanks ( int  begin,
int  end 
)
private

◆ setRanks() [2/2]

void AMP::Mesh::loadBalanceSimulator::setRanks ( int  rank)
inlineprivate

Definition at line 107 of file loadBalanceSimulator.h.

References setRanks().

Referenced by setRanks().

Member Data Documentation

◆ d_allEqual

bool AMP::Mesh::loadBalanceSimulator::d_allEqual
private

Definition at line 99 of file loadBalanceSimulator.h.

◆ d_begin

int AMP::Mesh::loadBalanceSimulator::d_begin
private

Definition at line 100 of file loadBalanceSimulator.h.

Referenced by nRanks().

◆ d_cost

double AMP::Mesh::loadBalanceSimulator::d_cost
private

Definition at line 95 of file loadBalanceSimulator.h.

Referenced by getCost().

◆ d_end

int AMP::Mesh::loadBalanceSimulator::d_end
private

Definition at line 101 of file loadBalanceSimulator.h.

Referenced by nRanks().

◆ d_max_procs

int AMP::Mesh::loadBalanceSimulator::d_max_procs
private

Definition at line 97 of file loadBalanceSimulator.h.

Referenced by maxProcs().

◆ d_maxCostRank

double AMP::Mesh::loadBalanceSimulator::d_maxCostRank
private

Definition at line 96 of file loadBalanceSimulator.h.

◆ d_method

int AMP::Mesh::loadBalanceSimulator::d_method
private

Definition at line 98 of file loadBalanceSimulator.h.

Referenced by getMethod().

◆ d_name

std::string AMP::Mesh::loadBalanceSimulator::d_name
private

Definition at line 94 of file loadBalanceSimulator.h.

◆ d_submeshes

std::vector<loadBalanceSimulator> AMP::Mesh::loadBalanceSimulator::d_submeshes
private

Definition at line 102 of file loadBalanceSimulator.h.

Referenced by getRanks(), and getSubmeshes().


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



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:43.
Comments on this page