diff --git a/bhtree_mpi/src/simulation/MpiSimulation.cpp b/bhtree_mpi/src/simulation/MpiSimulation.cpp index 9c6fbc29790ea5c17fe4c445a5f77a107f7b5b49..cb3acb3dbdbfba5be9c7483e9b6e9dced749d555 100644 --- a/bhtree_mpi/src/simulation/MpiSimulation.cpp +++ b/bhtree_mpi/src/simulation/MpiSimulation.cpp @@ -86,11 +86,8 @@ namespace nbody { //mpi send wrapper void MpiSimulation::send(std::vector&& bodies, int target) { const auto bodySize = bodies.size(); - - //do unblocking send - auto store = std::make_unique(std::move(bodies)); //TODO(steinret): ask ponweist if this could be done w/o unique_ptr - - MPI_Isend(store->bodies.data(), bodySize, bodyType, target, 0, MPI_COMM_WORLD, &store->request); + SendStore store{ std::move(bodies) }; + MPI_Isend(store.bodies.data(), bodySize, bodyType, target, 0, MPI_COMM_WORLD, &store.request); sendStores.push_back(std::move(store)); } @@ -179,7 +176,7 @@ namespace nbody { void MpiSimulation::flushSendStore() { std::vector requests; - std::transform(std::begin(sendStores), std::end(sendStores), std::back_inserter(requests), [](const std::unique_ptr& ss) {return ss->request; }); + std::transform(std::begin(sendStores), std::end(sendStores), std::back_inserter(requests), [](const SendStore& ss) {return ss.request; }); MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); sendStores.clear(); } diff --git a/bhtree_mpi/src/simulation/MpiSimulation.hpp b/bhtree_mpi/src/simulation/MpiSimulation.hpp index 8fd932805a3880d6f7e15b9dc88f31d4ef90e338..b266b9ef6f4512c271f294b915fa4ea050ca2657 100644 --- a/bhtree_mpi/src/simulation/MpiSimulation.hpp +++ b/bhtree_mpi/src/simulation/MpiSimulation.hpp @@ -23,7 +23,7 @@ namespace nbody { MPI_Datatype boxType{MPI_DATATYPE_NULL}; std::vector domains; Box overallDomain; - std::vector> sendStores; + std::vector sendStores; void flushSendStore(); virtual void send(std::vector&& bodies, int target);