12 #ifndef CD_LoadBalancing_H
13 #define CD_LoadBalancing_H
19 #include <CD_NamespaceHeader.H>
36 makeBalance(Vector<int>& a_ranks,
const Vector<T>& a_loads,
const Vector<Box>& a_boxes);
49 makeBalance(Vector<int>& a_ranks,
Loads& a_rankLoads,
const Vector<T>& a_boxLoads,
const Vector<Box>& a_boxes);
60 sort(Vector<Vector<Box>>& a_boxes, Vector<Vector<T>>& a_loads,
const BoxSorting a_whichSorting);
71 sort(Vector<Box>& a_boxes, Vector<T>& a_loads,
const BoxSorting a_which);
128 static std::vector<std::pair<Box, T>>
129 packPairs(
const Vector<Box>& a_boxes,
const Vector<T>& a_loads);
139 unpackPairs(Vector<Box>& a_boxes, Vector<T>& a_loads,
const std::vector<std::pair<Box, T>>& a_pairs);
159 shuffleSort(Vector<Box>& a_boxes, Vector<T>& a_loads);
169 mortonSort(Vector<Box>& a_boxes, Vector<T>& a_loads);
180 mortonComparator(
const int a_maxBits,
const std::pair<Box, T>& a_lhs,
const std::pair<Box, T>& a_rhs);
188 maxBits(std::vector<Box>::iterator a_first, std::vector<Box>::iterator a_last);
191 #include <CD_NamespaceFooter.H>
Declaration of an enum for identifying various ways of sorting grid patches.
BoxSorting
Enum for sorting boxes.
Definition: CD_BoxSorting.H:21
Declaration of a simple class for holding computational loads.
Static class which contains various load balancing routines.
Definition: CD_LoadBalancing.H:25
static int maxBits(std::vector< Box >::iterator a_first, std::vector< Box >::iterator a_last)
Utility function for Morton sorting which needs the maximum bits.
Definition: CD_LoadBalancing.cpp:279
static void gatherLoads(Vector< Real > &a_loads)
Gather computational loads.
Definition: CD_LoadBalancing.cpp:109
static void gatherBoxes(Vector< Box > &a_boxes)
Gather boxes.
Definition: CD_LoadBalancing.cpp:31
static void gatherBoxesAndLoads(Vector< Box > &a_boxes, Vector< int > &a_loads)
Gather boxes and loads.
Definition: CD_LoadBalancing.cpp:269
static void makeBalance(Vector< int > &a_ranks, const Vector< T > &a_loads, const Vector< Box > &a_boxes)
Load balancing, assigning ranks to boxes.
Definition: CD_LoadBalancingImplem.H:31
static void sort(Vector< Vector< Box >> &a_boxes, Vector< Vector< T >> &a_loads, const BoxSorting a_whichSorting)
Sorts boxes and loads over a hierarchy according to some sorting criterion.
Definition: CD_LoadBalancingImplem.H:221
static void standardSort(Vector< Box > &a_boxes, Vector< T > &a_loads)
Standard box sorting, calls C++ std::sort.
Definition: CD_LoadBalancingImplem.H:265
static void mortonSort(Vector< Box > &a_boxes, Vector< T > &a_loads)
Sort boxes using Morton code.
Definition: CD_LoadBalancingImplem.H:304
static bool mortonComparator(const int a_maxBits, const std::pair< Box, T > &a_lhs, const std::pair< Box, T > &a_rhs)
Morton comparator.
Definition: CD_LoadBalancingImplem.H:325
static std::vector< std::pair< Box, T > > packPairs(const Vector< Box > &a_boxes, const Vector< T > &a_loads)
Utility function which packs boxes and loads into a vector of pairs.
Definition: CD_LoadBalancingImplem.H:191
static void unpackPairs(Vector< Box > &a_boxes, Vector< T > &a_loads, const std::vector< std::pair< Box, T >> &a_pairs)
Splits vector pair into separate boxes and loads.
Definition: CD_LoadBalancingImplem.H:205
static void shuffleSort(Vector< Box > &a_boxes, Vector< T > &a_loads)
Randomly shuffles boxes and loads.
Definition: CD_LoadBalancingImplem.H:281
Class for holding computational loads.
Definition: CD_Loads.H:30