Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 55f52f6e authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

remove old commented code from block tree

parent 013fed02
No related branches found
No related tags found
No related merge requests found
......@@ -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){
count++;
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);
(newBlock->getCell(head[idx]))->setMortonIndex(head[idx]);
//(this->getCell(head[idx]))->setCoordinate();
}
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):
treeHeight(inTreeHeight),nbElementsPerBlock(inNbElementsPerBlock),cellBlocksPerLevel(0)
{
cellBlocksPerLevel = new std::list<CellGroupClass*>[treeHeight];
int *nbCellPerLevel = new int[treeHeight];
inOctreeSrc->getNbCellsPerLevel(nbCellPerLevel);
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);
octreeIterator.gotoBottomLeft();
do{
leafsIdx[idxLeafs] = octreeIterator.getCurrentGlobalIndex();
idxLeafs++;
}
while(octreeIterator.moveRight());
//Now the work start !!1!
idxLeafs = 0;
//Temporary Header, will be filled
MortonIndex * head = new MortonIndex[inNbElementsPerBlock];
memset(head,CellIsEmptyFlag,sizeof(MortonIndex)*inNbElementsPerBlock);
//Creation and addition of all the cells at leaf level
while(idxLeafs < nbLeaf){
//Initialisation of header
memset(head,CellIsEmptyFlag,sizeof(MortonIndex)*inNbElementsPerBlock);
memcpy(head,&leafsIdx[idxLeafs],FMath::Min(sizeof(MortonIndex)*inNbElementsPerBlock,sizeof(MortonIndex)*(nbLeaf-idxLeafs)));
idxLeafs += inNbElementsPerBlock;
//creation of the block and addition to the list
CellGroupClass * tempBlock = createBlockFromArray(head);
cellBlocksPerLevel[treeHeight-1].push_back(tempBlock);
}
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
memset(head,CellIsEmptyFlag,sizeof(MortonIndex)*inNbElementsPerBlock);
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)
if((*curBlockRead)->exists(idxCell)){
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;
}
else{
//Creation of the block from head, then reset head, and
//storage of new idx in new head
CellGroupClass * tempBlock = createBlockFromArray(head);
cellBlocksPerLevel[idxLevel].push_back(tempBlock);
//Need a new block
memset(head,CellIsEmptyFlag,sizeof(MortonIndex)*nbElementsPerBlock);
head[0] = newIdx;
idxHead = 0;
previous = newIdx;
}
}
}
}
}
//Before changing Level, need to close current Block
CellGroupClass * tempBlock = createBlockFromArray(head);
cellBlocksPerLevel[idxLevel].push_back(tempBlock);
}
printf("toto \n");
delete[] head;
}*/
////////////////////////////////////////////////////////////////////
// End of can be deleted
////////////////////////////////////////////////////////////////////
/** This function dealloc the tree by deleting each block */
~FGroupTree(){
for(int idxLevel = 0 ; idxLevel < treeHeight ; ++idxLevel){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment