aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/balance.hh
blob: ccf7dad9178ca679eeebf195df7b50809ce7e10a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef BALANCE_HH
#define BALANCE_HH

#include <cctk.h>

#include <vector>

using namespace std;



namespace CarpetLib {
  
  // This routine splits N items over P workers.  It can split the
  // items if necessary to ensure a maximum imbalance, and it can
  // ensure (artificially) that each worker receives the same number
  // of items.

  template <typename T>
  void
  balance (vector<T> const& items_,
           vector<vector<T> >& split_items_,
           int nworkers,
           CCTK_REAL max_imbalance,
           bool ensure_same_size);
  
} // namespace CarpetLib

#endif  // #ifndef BALANCE_HH