42 std::vector<char>& payload, std::size_t stride,
44 std::vector<double>* weightOut =
nullptr) {
47 std::size_t ncells = 1;
48 for (
int d = 0; d < Dim; ++d)
49 ncells *=
static_cast<std::size_t
>(gsize[d]);
50 std::vector<double> localCount(ncells, 0.0), weight(ncells, 0.0);
59 dec.
init(
static_cast<std::size_t
>(sz), gsize, weight);
61 *weightOut = std::move(weight);
65 return mig.
migrate(pos, payload, stride);
IVec< Dim > cellOf(const Vec< Dim > &x) const
Global decomposition cell containing position x (after periodic wrap / boundary clamp).
std::size_t migrate(std::vector< Vec< Dim > > &pos, std::vector< char > &payload, std::size_t stride)
Reassign every particle to its owning rank.
int MPI_Allreduce(const void *sbuf, void *rbuf, int count, MPI_Datatype dt, MPI_Op, MPI_Comm)
std::size_t rebalanceByParticleCount(decomp::BlockDecomposer< Dim > &dec, ParticleMigrator< Dim > &mig, std::vector< typename detail::NonDeduced< Vec< Dim > >::type > &pos, std::vector< char > &payload, std::size_t stride, MPI_Comm comm=MPI_COMM_WORLD, std::vector< double > *weightOut=nullptr)
Re-decompose dec so each block holds a near-equal particle count, then migrate the particles (positio...