21#include <alien/utils/Precomp.h>
23#include <arccore/message_passing/Messages.h>
28namespace RedistributionTools
32 static void computeCounts(ConstArrayView<T> offsets, ArrayView<T> counts)
34 if ((offsets.size() - 1) != counts.size())
35 FatalErrorException(
"Redistributor communication error");
36 for (Int32 p = 0; p < counts.size(); ++p) {
37 counts[p] = offsets[p + 1] - offsets[p];
42 static void exchange(IMessagePassingMng* pm, ConstArrayView<T> snd,
43 ConstArrayView<Int32> snd_offset, ArrayView<T> rcv,
44 ConstArrayView<Int32> rcv_offset)
46 Int32 comm_size = pm->commSize();
47 UniqueArray<Int32> snd_count(comm_size);
48 UniqueArray<Int32> rcv_count(comm_size);
49 Alien::RedistributionTools::computeCounts(snd_offset, snd_count.view());
50 Alien::RedistributionTools::computeCounts(rcv_offset, rcv_count.view());
51 Arccore::MessagePassing::mpAllToAllVariable(
52 pm, snd, snd_count, snd_offset, rcv, rcv_count, rcv_offset);
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --