Commit ea21ab57 authored by berenger-bramas's avatar berenger-bramas
Browse files

Refactore Light tree.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@200 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 75c2088d
......@@ -10,70 +10,13 @@
#include "../Containers/FBoolArray.hpp"
#include "../Containers/FOctree.hpp"
#include "../Containers/FLightOctree.hpp"
#include "../Utils/FMpi.hpp"
#include <omp.h>
/** This class is a light octree
* It is just a linked list with 8 pointers per node
*/
class FLightOctree {
class Node {
Node* next[8];
const void* data;
public:
Node(){
memset(next, 0, sizeof(Node*)*8);
}
virtual ~Node(){
for(int idxNext = 0 ; idxNext < 8 ; ++idxNext){
delete next[idxNext];
}
}
void insert(const MortonIndex& index, const void* const cell, const int level){
if(level){
const int host = (index >> (3 * (level-1))) & 0x07;
if(!next[host]){
next[host] = new Node();
}
next[host]->insert(index, cell, level - 1);
}
else{
data = cell;
}
}
const void* getCell(const MortonIndex& index, const int level) const {
if(level){
const int host = (index >> (3 * (level-1))) & 0x07;
if(next[host]){
return next[host]->getCell(index, level - 1);
}
return 0;
}
else{
return data;
}
}
};
Node root;
public:
FLightOctree(){
}
void insertCell(const MortonIndex& index, const void* const cell, const int level){
root.insert(index, cell, level);
}
const void* getCell(const MortonIndex& index, const int level) const{
return root.getCell(index, level);
}
};
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmThreadProc
......
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