Commit 0daa92f4 authored by Quentin Khan's avatar Quentin Khan

FAdaptiveSequential: remove adjacent node sort in P2P

parent e8c46f96
......@@ -257,21 +257,12 @@ public:
void u_list_step() {
using container_t = typename node_t::particle_container_t;
// The following containers are reused for each leaf to avoid repeated
// dynamic allocation.
// Used to sort the U items by index
std::multimap<int, node_t*> sorted_u_items;
// Vectors to be filled after sort and passed to kernel P2P
// Vectors to pass to kernel P2P
std::vector<container_t*> u_item_source_particle_containers;
std::vector<int> u_item_indices;
for(node_t* leaf : _tree.leaves()) {
u_item_source_particle_containers.clear();
u_item_indices.clear();
sorted_u_items.clear();
container_t* const leaf_source_particle_container =
leaf->getParticleContainer();
container_t* const leaf_target_particle_container =
......@@ -283,7 +274,9 @@ public:
continue;
}
// Insert U items in sorteed multimap
u_item_source_particle_containers.clear();
u_item_indices.clear();
for(node_t* u_item : leaf->U) {
// The kernels do not consider leaf to be adjacent to
// itself. Skip empty u_items
......@@ -292,15 +285,8 @@ public:
{
continue;
}
sorted_u_items.insert({compute_box_offset_index(leaf, u_item, 1), u_item});
}
// Get sorted items and transfer them to vectors
for(auto& keyval : sorted_u_items) {
int key; node_t* u_item;
std::tie(key, u_item) = keyval;
u_item_source_particle_containers.push_back(u_item->getParticleContainer());
u_item_indices.push_back(key);
u_item_indices.push_back(compute_box_offset_index(leaf, u_item, 1));
}
// Call P2P on vectors data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment