diff --git a/Src/GroupTree/Core/FGroupLinearTree.hpp b/Src/GroupTree/Core/FGroupLinearTree.hpp index ec5f9d6d80d047a5043b50cbdacaddaa33a71635..e6119cf6901e8fe2f89d148f7d88d10253e6c89f 100644 --- a/Src/GroupTree/Core/FGroupLinearTree.hpp +++ b/Src/GroupTree/Core/FGroupLinearTree.hpp @@ -21,7 +21,7 @@ protected: std::vector<node_t>* linear_tree; std::vector<std::pair<unsigned long long int,unsigned long long int>> particle_repartition; - bool unknow_particle_repartition = true:; + bool unknow_particle_repartition = true; public: @@ -179,14 +179,18 @@ public: return this->get_leaf_level(); } - size_t get_first_morton_index(){ + size_t get_first_morton_index() const{ return this->linear_tree->front().morton_index; } - size_t get_last_morton_index(){ + size_t get_last_morton_index() const{ return this->linear_tree->back().morton_index; } + /** + * This function print the information of this current class + * @author benjamin.dufoyer@inria.fr + */ void print_info_tree(){ std::cout << " nb_leaf : " << this->linear_tree->size() << std::endl; std::cout << " nb_block : " << nb_block << std::endl; @@ -196,6 +200,10 @@ public: } } + /** + * This function return the linear tree associated with this calss + * @author benjamin.dufoyer@inria.fr + */ std::vector<node_t>* get_tree(){ return this->linear_tree; } @@ -210,6 +218,7 @@ public: void set_particle_repartition( std::vector<particle_t> particle_container) { + unknow_particle_repartition = false; dstr_grp_tree_builder::know_particle_division( this->mpi_conf, particle_container, @@ -217,7 +226,7 @@ public: } std::vector<std::pair<unsigned long long int,unsigned long long int>>* - get_particle_repartition() + get_particle_repartition(){ // TO get the particle repartition, you will compute it before FAssert(!unknow_particle_repartition); return &this->particle_repartition; @@ -233,15 +242,17 @@ public: /** * return the max morton index of the left proc * it's needed for the distributed construction of the groupTree - * you will compute the repartition before calling this function + * [RESTRICTION] you will compute the repartition before calling this function * @author benjamin.dufoyer@inria.fr - * @return Morton Index + * @return max left morton index, -1 if he doesn't exist */ - unsigned long long int get_left_limit(){ + long long int get_left_limit(){ + // Check if the repartition have been compute FAssert(!unknow_particle_repartition); int my_rank = this->mpi_conf.comm.rank(); + long long int left_limit = -1; if(my_rank != 0){ - left_limit = this->particle_repartition[my_rank-1].second; + left_limit = (long long int )this->particle_repartition[my_rank-1].second; } return left_limit; } @@ -316,6 +327,19 @@ public: } + /** + * This function is used to show the FGroupLinearTee more easly + * @author benjamin.dufoyer@inria.fr + */ + friend + std::ostream& operator<<(std::ostream& os, const FGroupLinearTree& n) { + return os << "--> Number of leaf : " << n.get_nb_leaf() + << "\n first leaf : " << n.get_first_morton_index() + << "\n last leaf : " << n.get_last_morton_index() + << "\n block_size " << n.get_block_size() + << "\n number of block : " << n.get_nb_block(); + } + };