|
1 | 1 | #ifndef PHARE_BENCH_CORE_BENCH_H |
2 | 2 | #define PHARE_BENCH_CORE_BENCH_H |
3 | 3 |
|
4 | | -#include "core/utilities/box/box.hpp" |
5 | | - |
6 | 4 | #include "phare_core.hpp" |
7 | 5 |
|
| 6 | +#include "core/utilities/box/box.hpp" |
| 7 | + |
8 | 8 | #include "tests/core/data/vecfield/test_vecfield_fixtures.hpp" |
9 | 9 | #include "tests/core/data/electromag/test_electromag_fixtures.hpp" |
10 | 10 |
|
11 | 11 | #include "benchmark/benchmark.h" |
| 12 | + |
12 | 13 | #include <fstream> |
13 | | -#include <iterator> |
14 | 14 |
|
15 | 15 | namespace PHARE::core::bench |
16 | 16 | { |
@@ -60,8 +60,7 @@ template<std::size_t dim, typename ParticleArray_t = PHARE::core::ParticleArray< |
60 | 60 | auto make_particles(std::size_t n_particles) |
61 | 61 | { |
62 | 62 | auto particles = ParticleArray_t{Box<int, dim>{}}; |
63 | | - particles.vector() |
64 | | - = std::vector<typename ParticleArray_t::value_type>(n_particles, particle<dim>()); |
| 63 | + particles.vector().resize(n_particles, particle<dim>()); |
65 | 64 | return particles; |
66 | 65 | } |
67 | 66 |
|
@@ -93,10 +92,11 @@ void disperse(Particles& particles, std::size_t lo, std::size_t up, |
93 | 92 | disperse(particles, core::ConstArray<int, dim>(lo), core::ConstArray<int, dim>(up), seed); |
94 | 93 | } |
95 | 94 |
|
96 | | -template<std::size_t dim, typename Box> |
| 95 | +template<std::size_t dim, typename Box, typename ParticleArray_t = PHARE::core::ParticleArray<dim>> |
97 | 96 | auto make_particles(std::size_t ppc, Box disperse_in, std::optional<int> seed = std::nullopt) |
98 | 97 | { |
99 | | - auto particles = make_particles<dim>(ppc * disperse_in.size()); |
| 98 | + auto particles = ParticleArray_t{disperse_in}; |
| 99 | + particles.vector().resize(ppc * disperse_in.size(), particle<dim>()); |
100 | 100 | disperse(particles, disperse_in.lower, disperse_in.upper, seed); |
101 | 101 | return particles; |
102 | 102 | } |
|
0 commit comments