Commit a30c7e72 authored by Quentin Khan's avatar Quentin Khan

FAdaptiveSequential: refactor P2P to reduce call count

parent f030f6e5
......@@ -203,27 +203,39 @@ public:
}
}
// P2P
void u_list_step() {
using container_t = typename node_t::particle_container_t;
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();
container_t* const leaf_source_particle_container =
leaf->getParticleContainer();
const container_t* const leaf_target_particle_container =
leaf->getParticleContainer();
for(node_t* u_item : leaf->U) {
int u_item_index = compute_box_offset_index(leaf, u_item, 1);
container_t* const leaf_source_particle_container =
leaf->getParticleContainer();
const container_t* const leaf_target_particle_container =
leaf->getParticleContainer();
container_t* const u_item_source_particle_container[1] =
{u_item->getParticleContainer()};
_kernel.P2P(FTreeCoordinate(MortonIndex(leaf->getIndex()), static_cast<int>(leaf->getDepth())),
leaf_source_particle_container,
leaf_target_particle_container,
u_item_source_particle_container,
&u_item_index,
1);
if(u_item == leaf) {
continue;
}
u_item_indices.push_back(compute_box_offset_index(leaf, u_item, 1));
u_item_source_particle_containers.push_back(u_item->getParticleContainer());
}
_kernel.P2P(
FTreeCoordinate(MortonIndex(leaf->getIndex())),
leaf_source_particle_container,
leaf_target_particle_container,
u_item_source_particle_containers.data(),
u_item_indices.data(),
static_cast<int>(leaf->U.size()-1),
leaf->getData()
);
}
}
......
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