Commit 494c57c3 authored by Quentin Khan's avatar Quentin Khan

FAdaptiveSequential: change to new kernel interface

parent e196816b
......@@ -14,15 +14,15 @@
#include "Kernels/FKernelConcepts.hpp"
template<class _Tree, class _Kernel,
typename std::enable_if<scalfmm::sfinae::has_P2M<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_M2M<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_M2L<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_L2L<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_L2P<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_P2P<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_M2P<_Tree, _Kernel>::value>::type* = nullptr,
typename std::enable_if<scalfmm::sfinae::has_P2L<_Tree, _Kernel>::value>::type* = nullptr
template<class _Tree, class _Kernel//,
// typename std::enable_if<scalfmm::sfinae::has_P2M<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_M2M<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_M2L<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_L2L<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_L2P<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_P2P<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_M2P<_Tree, _Kernel>::value>::type* = nullptr,
// typename std::enable_if<scalfmm::sfinae::has_P2L<_Tree, _Kernel>::value>::type* = nullptr
>
class FAdaptiveSequential : public FAlgorithmInterface, public FAlgorithmTimers {
public:
......@@ -153,7 +153,9 @@ public:
void source_to_up() {
for(node_t* leaf : _tree.leaves()) {
if(leaf->getParticleContainer()->size() != 0) {
_kernel.P2M(leaf->getData(), leaf->getParticleContainer());
_kernel.P2M(&(leaf->getData()->getMultipoleData()),
&(leaf->getSymbolicData()),
leaf->getParticleContainer());
}
}
}
......@@ -164,19 +166,22 @@ public:
if(! node.is_leaf()) {
// Fill array of children data
typename node_t::data_t* child_data[node_t::child_count] = {};
typename node_t::data_t::multipole_t* child_data[node_t::child_count] = {};
for(node_t* child : node.getChildren()) {
child_data[child->getIndex() & (node_t::child_count-1)] = child->getData();
child_data[child->getIndex() & (node_t::child_count-1)]
= &(child->getData()->getMultipoleData());
}
// Call kernel module
_kernel.M2M(node.getData(), child_data, static_cast<int>(node.getDepth()));
_kernel.M2M(&(node.getData()->getMultipoleData()),
child_data,
static_cast<int>(node.getDepth()));
}
}
}
// M2L
void v_list_step() {
std::vector<decltype(std::declval<const node_t>().getData())> v_item_data_list;
std::vector<typename node_t::data_t::multipole_t*> v_item_data_list;
std::vector<int> v_item_indices;
for(node_t& node : _tree.in_order_walk()) {
......@@ -194,11 +199,15 @@ public:
continue;
}
v_item_indices.push_back(compute_box_offset_index(&node, v_item, 3));
v_item_data_list.push_back(v_item->getData());
v_item_data_list.push_back(&(v_item->getData()->getMultipoleData()));
}
// Call kernel M2L operator
_kernel.M2L(node.getData(), v_item_data_list.data(), v_item_indices.data(), static_cast<int>(v_item_data_list.size()), static_cast<int>(node.getDepth()));
_kernel.M2L(&(node.getData()->getLocalExpansionData()),
v_item_data_list.data(),
v_item_indices.data(),
static_cast<int>(v_item_data_list.size()),
static_cast<int>(node.getDepth()));
}
}
......@@ -215,7 +224,9 @@ public:
if(w_item->is_leaf() && w_item->getParticleContainer()->size() == 0) {
continue;
}
_kernel.P2L(w_item->getData(), node->getParticleContainer());
_kernel.P2L(&(w_item->getData()->getLocalExpansionData()),
&(w_item->getSymbolicData()),
node->getParticleContainer());
}
}
}
......@@ -225,11 +236,13 @@ public:
void down_to_down() {
for(node_t& node : _tree.pre_order_walk()) {
if(! node.is_leaf()) {
typename node_t::data_t* child_data[node_t::child_count];
typename node_t::data_t::local_expansion_t* child_data[node_t::child_count];
for(std::size_t i = 0; i < node_t::child_count; ++i) {
child_data[i] = node.getChild(i)->getData();
child_data[i] = &(node.getChild(i)->getData()->getLocalExpansionData());
}
_kernel.L2L(node.getData(), child_data, static_cast<int>(node.getDepth()));
_kernel.L2L(&(node.getData()->getLocalExpansionData()),
child_data,
static_cast<int>(node.getDepth()));
}
}
}
......@@ -242,7 +255,9 @@ public:
if(w_item->is_leaf() && w_item->getParticleContainer()->size() == 0) {
continue;
}
_kernel.M2P(w_item->getData(), node->getParticleContainer());
_kernel.M2P(&(w_item->getData()->getMultipoleData()),
&(w_item->getSymbolicData()),
node->getParticleContainer());
}
}
}
......@@ -252,7 +267,9 @@ public:
void down_to_target() {
for(node_t* leaf : _tree.leaves()) {
if(leaf->getParticleContainer()->size() != 0) {
_kernel.L2P(leaf->getData(), leaf->getParticleContainer());
_kernel.L2P(&(leaf->getData()->getLocalExpansionData()),
&(leaf->getSymbolicData()),
leaf->getParticleContainer());
}
}
}
......
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