Commit 75044b07 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Add some comments

parent 7c386566
......@@ -25,35 +25,6 @@ protected:
//< all the blocks of leaves
std::list<FGroupOfParticles<NbAttributesPerParticle,AttributeClass>*> particleBlocks;
/** @brief This private method take an array of Morton index to
* create the block and the cells, using the constructor of
* FGroupOfCells !!
*/
FGroupOfCells<CellClass> * 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
FGroupOfCells<CellClass> * newBlock = new FGroupOfCells<CellClass>(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;
}
public:
/** This constructor create a blocked octree from a usual octree
......@@ -166,6 +137,41 @@ public:
}
}
////////////////////////////////////////////////////////////////////
// Work in progress part, build the tree from an array of particles
////////////////////////////////////////////////////////////////////
/** @brief This private method take an array of Morton index to
* create the block and the cells, using the constructor of
* FGroupOfCells !!
*/
FGroupOfCells<CellClass> * 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
FGroupOfCells<CellClass> * newBlock = new FGroupOfCells<CellClass>(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.
......@@ -267,6 +273,10 @@ public:
delete[] head;
}
////////////////////////////////////////////////////////////////////
// End work in progress part, build the tree from an array of particles
////////////////////////////////////////////////////////////////////
/** This function dealloc the tree by deleting each block */
~FGroupTree(){
......
......@@ -57,16 +57,16 @@ int main(int argc, char* argv[]){
const int groupSize = FParameters::getValue(argc,argv,"-bs", 250);
counter.tic();
GroupOctreeClass groupedTree(NbLevels, groupSize, &tree);
GroupOctreeClass groupedTree(NbLevels, groupSize, &tree, 0);
std::cout << "Done " << "(@Converting the tree with leafs only = " << counter.tacAndElapsed() << "s). Group size is " << groupSize << "." << std::endl;
counter.tic();
//GroupOctreeClass groupedTree2(NbLevels, groupSize, &tree);
GroupOctreeClass groupedTree2(NbLevels, groupSize, &tree);
std::cout << "Done " << "(@Converting the tree with all Octree = " << counter.tacAndElapsed() << "s). Group size is " << groupSize << "." << std::endl;
groupedTree.printInfoBlocks();
//groupedTree2.printInfoBlocks();
groupedTree2.printInfoBlocks();
return 0;
......
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