diff --git a/experimental/examples/CMakeLists.txt b/experimental/examples/CMakeLists.txt index 5a10ed7f7212461c67beca03f9ee72ca8e6a699a..55e377d7774b2b3d0f2e48674e4aae9c81cfd324 100644 --- a/experimental/examples/CMakeLists.txt +++ b/experimental/examples/CMakeLists.txt @@ -20,7 +20,7 @@ set(source_tests_files # debug & check count_kernel.cpp test_l2p.cpp - test-build-let.cpp +# test-build-let.cpp ) #if(SCALFMM_USE_MPI) # set(source_tests_files ${source_tests_files} diff --git a/experimental/examples/direct_computation.cpp b/experimental/examples/direct_computation.cpp index be6e3badbcf51d7dffa600a57eb03876841e3764..3ccffb894abd0815030c277b7175144262b91fec 100644 --- a/experimental/examples/direct_computation.cpp +++ b/experimental/examples/direct_computation.cpp @@ -142,7 +142,7 @@ auto direct_run(const std::string& input_file, const std::string& output_file, c // read the data (pos and inputs). The outputs are set to zeros. laplace::read_data<dimension>(input_file, container, box_center, box_width); time.tac(); - const std::size_t number_of_particles = std::get<0>(container->size()); + const std::size_t number_of_particles{container->size()}; std::cout << scalfmm::colors::green << "... Done.\n" << scalfmm::colors::reset; std::cout << scalfmm::colors::green << "Box center = " << box_center << " box width = " << box_width diff --git a/experimental/examples/test-build-let.cpp b/experimental/examples/test-build-let.cpp index a93814e838ef9a824886f2988545881939663b9b..70a682af580848245e4f04e793e5447954f8beb2 100644 --- a/experimental/examples/test-build-let.cpp +++ b/experimental/examples/test-build-let.cpp @@ -82,7 +82,7 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int std::cout << scalfmm::colors::blue << "<params> Output file : " << output_file << scalfmm::colors::reset << '\n'; } - // const auto order{parser.get<args::order>()}; + const auto order{parser.get<args::order>()}; // // @@ -142,7 +142,7 @@ auto main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) -> int scalfmm::tree::let::buildLetTree(para, number_of_particles, particles_set, box, leaf_level, group_size, group_size, letGroupTree, - mortonCellDistribution, nb_block); + mortonCellDistribution, nb_block, order); // scalfmm::tree::print("rank(" + std::to_string(rank) + ") data distrib: ", mortonCellDistribution); diff --git a/experimental/examples/test_laplace_kernels.cpp b/experimental/examples/test_laplace_kernels.cpp index 0bc2181d1eb9b655972205581270e2e5da63a73f..49a8b723857033ecf43dc47f67ff4daecdbc05f0 100644 --- a/experimental/examples/test_laplace_kernels.cpp +++ b/experimental/examples/test_laplace_kernels.cpp @@ -84,8 +84,7 @@ auto run(const std::string& input_file, const std::string& output_file, const in nb_outputs_near, std::size_t>; using container_type = scalfmm::container::particle_container<particle_type>; using position_type = typename particle_type::position_type; - using cell_type = - scalfmm::component::cell<typename interpolator_type::storage_type>; + using cell_type = scalfmm::component::cell<typename interpolator_type::storage_type>; using leaf_type = scalfmm::component::leaf<particle_type>; using box_type = scalfmm::component::box<position_type>; using group_tree_type = scalfmm::component::group_tree<cell_type, leaf_type, box_type>; @@ -101,7 +100,7 @@ auto run(const std::string& input_file, const std::string& output_file, const in time.tac(); // const std::size_t number_of_particles = std::get<0>(container->size()); - const std::size_t number_of_particles = container->number_elements(); + const std::size_t number_of_particles = container->size(); std::cout << scalfmm::colors::green << "... Done.\n" << scalfmm::colors::reset; std::cout << scalfmm::colors::green << "Box center = " << box_center << " box width = " << box_width << scalfmm::colors::reset << '\n'; diff --git a/experimental/include/scalfmm/container/particle_container.hpp b/experimental/include/scalfmm/container/particle_container.hpp index 92d2d5c299d87c9e97b45b0f2a3d9f91984e5b3b..70ad5d32cb4c5c02e70570f6df992d6085c186a2 100644 --- a/experimental/include/scalfmm/container/particle_container.hpp +++ b/experimental/include/scalfmm/container/particle_container.hpp @@ -48,6 +48,7 @@ namespace scalfmm::container using self_type = particle_container<Particle>; using base_type = variadic_container_tuple<self_type, tuple_type>; using particle_type = Particle; + // using value_type = Particle; // Compatibility with vector // Forwarding constructors using base_type::base_type; @@ -64,10 +65,10 @@ namespace scalfmm::container return particle_type(*it); } /// - /// \brief number_elements + /// \brief size /// \return the number of particles inside the container /// - [[nodiscard]] inline auto number_elements() const -> std::size_t { return std::get<0>(base_type::size()); } + [[nodiscard]] inline auto size() const -> std::size_t { return std::get<0>(base_type::all_size()); } /// @brief /// diff --git a/experimental/include/scalfmm/container/variadic_adaptor.hpp b/experimental/include/scalfmm/container/variadic_adaptor.hpp index 2b915f29a5576c39797fefcff031b6914419e6b2..6a896b557fc875526ad8e9e9def73f87fc6cf460 100644 --- a/experimental/include/scalfmm/container/variadic_adaptor.hpp +++ b/experimental/include/scalfmm/container/variadic_adaptor.hpp @@ -1,4 +1,4 @@ -// -------------------------------- +// -------------------------------- // See LICENCE file at project root // File : container/variadic_adaptor.hpp // -------------------------------- @@ -21,7 +21,6 @@ namespace scalfmm::container { - /// @brief /// /// @tparam Container @@ -82,7 +81,6 @@ namespace scalfmm::container template<typename Container, std::size_t Size> using get_variadic_adaptor_t = decltype(get_variadic_adaptor<Container, Size>()); - template<typename Derived, typename... Containers> struct variadic_adaptor; @@ -103,7 +101,6 @@ namespace scalfmm::container vector_pointer_type vec_; int index_; - proxy_iterator(vector_pointer_type vec, int index) noexcept : vec_{vec} , index_{index} @@ -134,7 +131,7 @@ namespace scalfmm::container proxy_iterator(proxy_iterator const&) = default; proxy_iterator(proxy_iterator&&) = default; auto operator=(proxy_iterator const&) -> proxy_iterator& = default; - auto operator=(proxy_iterator &&) -> proxy_iterator& =default; + auto operator=(proxy_iterator&&) -> proxy_iterator& = default; [[nodiscard]] auto operator*() const noexcept { return make_proxy(Seq{}); } @@ -277,7 +274,7 @@ namespace scalfmm::container // =========================================================== template<typename DelayedReturnType = std::tuple<decltype( meta::delayed_trait<Containers, meta::has_size_func>(meta::has_size_func_f(Containers{})))...>> - [[nodiscard]] constexpr auto size() const noexcept + [[nodiscard]] constexpr auto all_size() const noexcept -> std::enable_if_t<meta::all(meta::has_size_func_v<Containers>...), DelayedReturnType> { std::tuple<meta::has_size_func_t<Containers>...> sizes; diff --git a/experimental/include/scalfmm/tree/group_let.hpp b/experimental/include/scalfmm/tree/group_let.hpp index 1e66ef53826bc30ee52c9712952fbaca408ffed6..c70a8b873ac04db350e06ac1aabb73988415bf2c 100644 --- a/experimental/include/scalfmm/tree/group_let.hpp +++ b/experimental/include/scalfmm/tree/group_let.hpp @@ -7,9 +7,11 @@ #include <tuple> //#include <scalfmm/tree/group_linear_tree.hpp> +#include "scalfmm/container/particle_container.hpp" #include <scalfmm/tree/utils.hpp> #include <scalfmm/utils/io_helpers.hpp> // for out::print #include <scalfmm/utils/parallel_manager.hpp> + #ifdef SCALFMM_USE_MPI #include <inria/algorithm/distributed/distribute.hpp> #include <inria/algorithm/distributed/mpi.hpp> @@ -764,12 +766,12 @@ namespace scalfmm::tree // @param[out] m_idx_distribution Distribution of the leaves on the // processors // @param[out] nb_blocks - template</*typename Loader_type,*/ typename Index_type, typename Container_type, typename Tree_type, + template</*typename Loader_type,*/ typename Index_type, typename Vector_type, typename Tree_type, typename Box_type> void buildLetTree(parallel_manager& manager, const std::size_t& number_of_particles, - Container_type& particle_container, const Box_type& box, const int leaf_level, + Vector_type& particle_container, const Box_type& box, const int leaf_level, const int groupSizeLeaves, const int groupSizeCells, Tree_type*& localGroupTree, - std::vector<Index_type>& m_idx_distribution, int& nb_blocks) + std::vector<Index_type>& m_idx_distribution, int& nb_blocks, const int order) { // using morton_type = std::int64_t; @@ -867,11 +869,24 @@ namespace scalfmm::tree /// /// Construct the let according to the distributions particles and cells /// - + if(manager.get_num_processes() > 1) + { + } /// /// construct the local tree based on the let + /// + // just for compatibility + using container_type = scalfmm::container::particle_container<typename Vector_type::value_type>; + container_type container(particle_container.size()); + for(std::size_t i = 0; i < particle_container.size(); ++i) + { + container.push_particle(i, particle_container[i)]; + } + localGroupTree = new Tree_type(static_cast<std::size_t>(leaf_level + 1), order, box, + static_cast<std::size_t>(groupSizeCells), container); /// return the tree + /// #ifdef TT diff --git a/experimental/include/scalfmm/tree/group_tree.hpp b/experimental/include/scalfmm/tree/group_tree.hpp index cefd0988f1df77892e566aa32ba5f2f82a4dd02e..2de2cfcccfaf97ce88f8bc15d72be559b97bff89 100644 --- a/experimental/include/scalfmm/tree/group_tree.hpp +++ b/experimental/include/scalfmm/tree/group_tree.hpp @@ -125,7 +125,8 @@ namespace scalfmm::component "group_tree : Particles contin in leafs are not the same as the ones in the container passed " "as argument to this constructor."); - auto number_of_particles{std::get<0>(particle_container.size())}; + // auto number_of_particles{std::get<0>(particle_container.size())}; + auto number_of_particles{particle_container.size()}; const std::size_t leaf_level{m_tree_height - 1}; // Storing group morton indexes. diff --git a/experimental/include/scalfmm/utils/sort.hpp b/experimental/include/scalfmm/utils/sort.hpp index 141fdb8aae32732971f3b4f606bb35a8e4c48963..031198a43d8894d22f5421d41081e7a319929b42 100644 --- a/experimental/include/scalfmm/utils/sort.hpp +++ b/experimental/include/scalfmm/utils/sort.hpp @@ -36,7 +36,7 @@ namespace scalfmm auto inline get_morton_permutation(const BOX_T& box, const Int& level, const CONTAINER_T& particle_container, const bool data_already_sorted = false) -> std::vector<indexing_structure> { - auto number_of_particles = particle_container.number_elements(); + auto number_of_particles = particle_container.size(); std::vector<indexing_structure> tuple_of_indexes(number_of_particles); for(std::size_t part = 0; part < number_of_particles; ++part) @@ -77,7 +77,7 @@ namespace scalfmm auto inline sort_container(const BOX_T& box, const Int& level, CONTAINER_T*& particle_container) -> void { auto perm = get_morton_permutation(box, level, *particle_container); - const auto number_of_particles = particle_container->number_elements(); + const auto number_of_particles = particle_container->size(); CONTAINER_T* ordered_container = new CONTAINER_T(number_of_particles); // std::cout << " pointer on ordered_container " << ordered_container << std::endl; for(std::size_t i = 0; i < number_of_particles; ++i) diff --git a/experimental/units/operators/l2p.cpp b/experimental/units/operators/l2p.cpp index 0eb821a939d5df2a188e46b212f0e73dedca396d..0e4268bd70432e7a6222b6367a5a3ee66f91933f 100644 --- a/experimental/units/operators/l2p.cpp +++ b/experimental/units/operators/l2p.cpp @@ -77,7 +77,7 @@ void test_l2p(std::size_t order) // outputs are set to zero in the function. auto container{utils::generate_particles<particle_type>(nb_particles, center, width)}; // We create the leaf corresponding to the box. - leaf_type leaf(std::cbegin(container), std::cend(container), std::get<0>(container.size()), center, width, 0); + leaf_type leaf(std::cbegin(container), std::cend(container), container.size(), center, width, 0); // Then the cell cell_type cell(center, width, order);