Commit 55f52f6e authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

remove old commented code from block tree

parent 013fed02
......@@ -348,146 +348,6 @@ public:
// Can be deleted
/** @brief This private method take an array of Morton index to
* create the block and the cells, using the constructor of
* FGroupOfCells !!
/*CellGroupClass * createBlockFromArray(MortonIndex head[]){
//Store the start and end
MortonIndex start = head[0];
MortonIndex end = start;
int count = 0;
// Find the number of cell to allocate in the blocks
for(int idxHead = 0 ; idxHead<nbElementsPerBlock ; idxHead++){
if (head[idxHead] != CellIsEmptyFlag){
end = head[idxHead];
// else{
// break;
// }
//allocation of memory
CellGroupClass * newBlock = new CellGroupClass(start,end+1,count);
//allocation of cells
for(int idx=0 ; idx<count ; idx++){
newBlock->newCell(head[idx], idx);
return newBlock;
/** This constructor build the BlockOctree from an Octree, but only
* the cells at leaf level are read. The cells ares constructed with
* several walk through the leafs.
/*template<class OctreeClass>
FGroupTree(const int inTreeHeight, const int inNbElementsPerBlock, OctreeClass*const inOctreeSrc, int FLAG):
cellBlocksPerLevel = new std::list<CellGroupClass*>[treeHeight];
int *nbCellPerLevel = new int[treeHeight];
int nbLeaf = nbCellPerLevel[treeHeight-1];
delete[] nbCellPerLevel;
//We get the Morton index of all the cells at leaf level and store
//them in order to build our blocks
MortonIndex *leafsIdx = new MortonIndex[nbLeaf];
int idxLeafs = 0;
//Iterator on source octree
typename OctreeClass::Iterator octreeIterator(inOctreeSrc);
leafsIdx[idxLeafs] = octreeIterator.getCurrentGlobalIndex();
//Now the work start !!1!
idxLeafs = 0;
//Temporary Header, will be filled
MortonIndex * head = new MortonIndex[inNbElementsPerBlock];
//Creation and addition of all the cells at leaf level
while(idxLeafs < nbLeaf){
//Initialisation of header
idxLeafs += inNbElementsPerBlock;
//creation of the block and addition to the list
CellGroupClass * tempBlock = createBlockFromArray(head);
delete[] leafsIdx;
//Creation of the cells at others level
//Loop over levels
for(int idxLevel = treeHeight-2 ; idxLevel >= 0 ; --idxLevel){
//Set the storing system (a simple array) to CellIsEmptyFlag
int idxHead = -1;
MortonIndex previous = -1;
//Iterator over the list at a deeper level (READ)
typename std::list<CellGroupClass*>::const_iterator curBlockRead;
for(curBlockRead = cellBlocksPerLevel[idxLevel+1].begin() ; curBlockRead != cellBlocksPerLevel[idxLevel+1].end() ; ++curBlockRead){
//Loop over cells in READ list
for(MortonIndex idxCell = (*curBlockRead)->getStartingIndex() ; idxCell < (*curBlockRead)->getEndingIndex() ; ++idxCell){
MortonIndex newIdx(idxCell >> 3);
//printf("Lvl : %d Current Idx %lld, parent's one : %lld \n",idxLevel,idxCell,newIdx);
//For Head Increment, we need to know if this parent has
//already been created
if(newIdx != previous){
//test if (Read cell exists)
idxHead++; //cell at deeper level exist, so we increment the count to store it
//Test if a new Block is necessary
if(idxHead < inNbElementsPerBlock){
//No need for a Block, just the cell is created
head[idxHead] = newIdx;
previous = newIdx;
//Creation of the block from head, then reset head, and
//storage of new idx in new head
CellGroupClass * tempBlock = createBlockFromArray(head);
//Need a new block
head[0] = newIdx;
idxHead = 0;
previous = newIdx;
//Before changing Level, need to close current Block
CellGroupClass * tempBlock = createBlockFromArray(head);
printf("toto \n");
delete[] head;
// End of can be deleted
/** This function dealloc the tree by deleting each block */
for(int idxLevel = 0 ; idxLevel < treeHeight ; ++idxLevel){
Supports Markdown
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