Commit a51adc22 authored by Quentin Khan's avatar Quentin Khan
Browse files

FFmmAlgorithm: change to new kernel interface

parent 25288237
......@@ -16,6 +16,8 @@
#ifndef FFMMALGORITHM_HPP
#define FFMMALGORITHM_HPP
#include <array>
#include <algorithm>
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssert.hpp"
......@@ -127,7 +129,9 @@ protected:
// We need the current cell that represents the leaf
// and the list of particles
FLOG(computationCounter.tic());
kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
kernels->P2M(&(octreeIterator.getCurrentCell()->getMultipoleData()),
octreeIterator.getCurrentCell(),
octreeIterator.getCurrentListSrc());
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
......@@ -164,8 +168,15 @@ protected:
do{
// We need the current cell and the child
// child is an array (of 8 child) that may be null
using multipole_t = typename CellClass::multipole_t;
std::array<multipole_t*, 8> children_multipoles;
CellClass** children = octreeIterator.getCurrentChildren();
std::transform(children, children+8, children_multipoles.begin(),
[](CellClass* c) {return (c == nullptr ? nullptr : &(c->getMultipoleData()));});
FLOG(computationCounter.tic());
kernels->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
kernels->M2M(&(octreeIterator.getCurrentCell()->getMultipoleData()),
children_multipoles.data(),
idxLevel);
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
......@@ -211,8 +222,18 @@ protected:
// for each cells
do{
const int counter = tree->getInteractionNeighbors(neighbors, neighborPositions, octreeIterator.getCurrentGlobalCoordinate(), idxLevel, separationCriteria);
using multipole_t = typename CellClass::multipole_t;
std::array<const multipole_t*, 342> neighbor_multipoles;
std::transform(neighbors, neighbors+counter, neighbor_multipoles.begin(),
[](const CellClass* c) {return (c == nullptr ? nullptr : &(c->getMultipoleData()));});
FLOG(computationCounter.tic());
if(counter) kernels->M2L( octreeIterator.getCurrentCell() , neighbors, neighborPositions, counter, idxLevel);
if(counter) kernels->M2L(
&(octreeIterator.getCurrentCell()->getLocalExpansionData()) ,
neighbor_multipoles.data(),
neighborPositions,
counter, idxLevel);
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
......@@ -255,8 +276,18 @@ protected:
// for each cells
do{
using local_expansion_t = typename CellClass::local_expansion_t;
std::array<local_expansion_t*, 8> children_expansions;
CellClass** children = octreeIterator.getCurrentChildren();
std::transform(children, children+8, children_expansions.begin(),
[](CellClass* c) {return (c == nullptr ? nullptr
: &(c->getLocalExpansionData()));
});
FLOG(computationCounter.tic());
kernels->L2L( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
kernels->L2L(
&(octreeIterator.getCurrentCell()->getLocalExpansionData()),
children_expansions.data(),
idxLevel);
FLOG(computationCounter.tac());
} while(octreeIterator.moveRight());
......@@ -298,7 +329,9 @@ protected:
do{
if(l2pEnabled){
FLOG(computationCounterL2P.tic());
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentListTargets());
kernels->L2P(&(octreeIterator.getCurrentCell()->getLocalExpansionData()),
octreeIterator.getCurrentCell(),
octreeIterator.getCurrentListTargets());
FLOG(computationCounterL2P.tac());
}
if(p2pEnabled){
......
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