Commit 0f5d615f authored by COULAUD Olivier's avatar COULAUD Olivier
Browse files

Use new group tree constructeur

parent 89dc83b7
......@@ -149,14 +149,13 @@ auto run(parallel_manager& para, const std::string& input_file, const int tree_h
#ifdef SCALFMM_USE_MPI
para.get_communicator().barrier();
#endif
if(para.io_master())
{
letGroupTree->print_distrib(std::cout);
}
// std::this_thread::sleep_for(std::chrono::seconds(2));
#endif
///
///////////////////////////////////////////////////////////////////////////////////////////////////////
///
......
......@@ -29,10 +29,11 @@ namespace scalfmm::component
/// Constructor
template<typename ParticleContainer>
explicit dist_group_tree(std::size_t tree_height, std::size_t order, Box const& box,
std::size_t number_of_component_per_group, ParticleContainer const& particle_container,
bool particles_are_sorted = false, int in_top_level = 2, int in_left_limit = -1)
: base_type(tree_height, order, box, number_of_component_per_group, particle_container, particles_are_sorted,
in_top_level, in_left_limit)
std::size_t size_leaf_blocking, std::size_t size_cell_blocking,
ParticleContainer const& particle_container, bool particles_are_sorted = false,
int in_top_level = 2 /*, int in_left_limit = -1*/)
: base_type(tree_height, order, box, size_leaf_blocking, size_cell_blocking, particle_container,
particles_are_sorted, in_top_level /*, in_left_limit*/)
{
m_cell_distrib.resize(tree_height);
}
......
......@@ -1209,7 +1209,7 @@ namespace scalfmm::tree
// _to_send
// check if the morton index exist locally
// bad_index the largest morton index in the whole indexes + 1
auto bad_index = distrib[nb_proc - 1][1] + 1;
// auto bad_index = distrib[nb_proc - 1][1] + 1;
std::vector<inria::mpi::request> tab_mpi_status;
std::vector<mortonIdx_type*> buffer(nb_proc, nullptr);
mpi_type = inria::mpi::get_datatype<mortonIdx_type>();
......@@ -1325,11 +1325,6 @@ namespace scalfmm::tree
delete[] buffer[i];
}
}
#else
std::cout << scalfmm::colors::red;
std::cerr << " distrib::check_if_morton_index_exist doesnt works in sequential (without MPI)" << std::endl;
std::cout << scalfmm::colors::reset << std::endl;
#endif
// We remove the bad_index in order to have only the existing components (leaf/cell)
......@@ -1581,10 +1576,12 @@ namespace scalfmm::tree
/// In fact we have all the leaves to add in leafMortonIdx - could be used to construct
/// the tree !!!
///
localGroupTree = new Tree_type(static_cast<std::size_t>(leaf_level + 1), order, box,
static_cast<std::size_t>(groupSizeCells), container, true);
auto last = std::unique(leafMortonIdx.begin(), leafMortonIdx.end());
leafMortonIdx.erase(last, leafMortonIdx.end());
// localGroupTree = new Tree_type(static_cast<std::size_t>(leaf_level + 1), order, box,
// static_cast<std::size_t>(groupSizeCells), container, true);
localGroupTree = new Tree_type(static_cast<std::size_t>(leaf_level + 1), order, box, groupSizeLeaves,
groupSizeCells, /*particle_*/ container, true, 2);
#ifdef SCALFMM_USE_MPI
// std::cout << scalfmm::colors::red;
// out::print("rank(" + std::to_string(rank) + ") leafMortonIdx: ", leafMortonIdx);
// std::cout << scalfmm::colors::reset << std::endl;
......@@ -1592,6 +1589,8 @@ namespace scalfmm::tree
////////////////////////////////////////////////////////////////////////////////////////////
///
///
auto last = std::unique(leafMortonIdx.begin(), leafMortonIdx.end());
leafMortonIdx.erase(last, leafMortonIdx.end());
if(manager.get_num_processes() > 1)
{
////////////////////////////////////////////////////////////////////////////////////////////
......@@ -1613,7 +1612,6 @@ namespace scalfmm::tree
//////////////////////////////////////////////////////////////////
/// Construct a uniform distribution of the morton index
///
#ifdef SCALFMM_USE_MPI
if(use_leaf_distribution && use_particle_distribution)
{
try
......@@ -1626,7 +1624,6 @@ namespace scalfmm::tree
std::cerr << e.what() << '\n';
}
}
#endif
///
/// Find and add the cells to add at the leaves level
std::vector<morton_distrib_type> level_dist(localGroupTree->height());
......@@ -1643,11 +1640,28 @@ namespace scalfmm::tree
localGroupTree->set_cell_distribution(l, level_dist[l]);
}
}
#ifdef SCALFMM_USE_MPI
std::cout << std::flush;
manager.get_communicator().barrier();
std::cout << scalfmm::colors::green << " --> End let::group_let() " << scalfmm::colors::reset << std::endl;
else
#endif
{
localGroupTree->set_leaf_distribution(particles_distrib);
localGroupTree->set_cell_distribution(leaf_level, leaves_distrib);
for(int l = leaf_level - 1; l >= localGroupTree->top_level(); --l)
{
morton_distrib_type local{{leaves_distrib[0][0] >> dimension, leaves_distrib[0][1] >> dimension}};
localGroupTree->set_cell_distribution(l, local);
}
}
//#else
// localGroupTree->set_leaf_distribution(particles_distrib);
// localGroupTree->set_cell_distribution(leaf_level, leaves_distrib);
// for(int l = leaf_level - 1; l >= localGroupTree->top_level(); --l)
// {
// morton_distrib_type local{{leaves_distrib[0][0] >> dimension, leaves_distrib[0][1] >>
// dimension}}; localGroupTree->set_cell_distribution(l, local);
// }
//#endif
std::cout << scalfmm::colors::green << " --> End let::group_let() " << scalfmm::colors::reset << std::endl;
}
} // namespace let
......
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