* argument.
*
* @param[in] comm MPI communicator.
- * @param[in] objects_to_send A map of `rank:object`, where the key `rank`
- * is the rank of the processor we want to send to, and `object` is the
- * object to send
+ * @param[in] object_to_send A object to send to all other processes
*
* @param[out] A vector of objects, with size equal to the number of
* processes in the MPI communicator. Each entry contains the object
Assert (false, ExcMessage ("The function some_to_some doesn't make"
"any sense if you do not have MPI enabled. "));
#else
- auto n_procs = dealii::Utilities::MPI::n_mpi_processes(comm);
- auto my_proc = dealii::Utilities::MPI::this_mpi_process(comm);
+ const auto n_procs = dealii::Utilities::MPI::n_mpi_processes(comm);
+ const auto my_proc = dealii::Utilities::MPI::this_mpi_process(comm);
std::vector<unsigned int> send_to(objects_to_send.size());
{
// Receiving buffers
std::map<unsigned int, T> received_objects;
{
- unsigned int i = 0;
std::vector<char> buffer;
-
// We do this on a first come/first served basis
- while (i<receive_from.size())
+ for (unsigned int i = 0; i<receive_from.size(); ++i)
{
// Probe what's going on. Take data from the first available sender
MPI_Status status;
ierr = MPI_Recv(buffer.data(), len, MPI_CHAR,
rank, 21, comm, MPI_STATUS_IGNORE);
AssertThrowMPI(ierr);
-
+ Assert(received_objects.find(rank) == received_objects.end(),
+ ExcInternalError("I should not receive again from this rank"));
received_objects[rank] = Utilities::unpack<T>(buffer);
- ++i;
}
}
Assert (false, ExcMessage ("The function all_gather doesn't make"
"any sense if you do not have MPI enabled. "));
#else
- auto n_procs = dealii::Utilities::MPI::n_mpi_processes(comm);
+ const auto n_procs = dealii::Utilities::MPI::n_mpi_processes(comm);
std::vector<char> buffer = Utilities::pack(object);