Commit a17c2d6f authored by COULAUD Olivier's avatar COULAUD Olivier
Browse files

rename size in all_size in variadic container. Define size in particle container

parent 495e19b9
......@@ -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}
......
......@@ -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
......
......@@ -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);
......
......@@ -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';
......
......@@ -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
///
......
// --------------------------------
// --------------------------------
// 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;
......
......@@ -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
......
......@@ -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.
......
......@@ -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)
......
......@@ -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);
......
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