83 std::invocable<ResultType &, Particle const &>
auto add_partial,
84 [[maybe_unused]] std::invocable<ResultType &, ResultType const &>
auto
87 static_assert(std::is_invocable_r_v<void,
decltype(add_partial), ResultType &,
89 static_assert(std::is_invocable_r_v<void,
decltype(reduce_op), ResultType &,
94 if (cells.size() > 1) {
95 auto reducer = Reduction::make_kokkos_reducer<ResultType>(
96 [&cells, add_partial](std::size_t
const c_index, ResultType &res) {
97 for (
auto const &p : cells[c_index]->particles()) {
102 Kokkos::parallel_reduce(
103 "reduce_on_local_particle",
104 Kokkos::RangePolicy<Kokkos::DefaultHostExecutionSpace>(std::size_t{0},
110 auto const &particles = cells.front()->particles();
111 auto reducer = Reduction::make_kokkos_reducer<ResultType>(
112 [&particles, add_partial](std::size_t
const p_index, ResultType &res) {
113 add_partial(res, std::as_const(*(particles.begin() + p_index)));
116 Kokkos::parallel_reduce(
117 "reduce_on_local_particle",
118 Kokkos::RangePolicy<Kokkos::DefaultHostExecutionSpace>(std::size_t{0},
virtual std::span< Cell *const > local_cells() const =0
Get pointer to local cells.
base_type::size_type size() const
ResultType reduce_over_local_particles(CellStructure const &cs, std::invocable< ResultType &, Particle const & > auto add_partial, std::invocable< ResultType &, ResultType const & > auto reduce_op)
Run a reduction over all particles.
Struct holding all information for one particle.