108#ifdef ESPRESSO_SHARED_MEMORY_PARALLELISM
110 if (cells.size() > 1) {
111 auto reducer = Reduction::make_kokkos_reducer<ResultType>(
112 [&cells, add_partial](std::size_t
const c_index, ResultType &res) {
113 for (
auto const &p : cells[c_index]->particles()) {
118 Kokkos::parallel_reduce(
119 "reduce_on_local_particle", cells.size(), reducer, result);
123 auto const &particles = cells.front()->particles();
124 auto reducer = Reduction::make_kokkos_reducer<ResultType>(
125 [&particles, add_partial](std::size_t
const p_index, ResultType &res) {
126 add_partial(res, std::as_const(*(particles.begin() + p_index)));
129 Kokkos::parallel_reduce(
130 "reduce_on_local_particle", particles.
size(), reducer, result);
134 add_partial(result, p);
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, Reduction::AddPartialResultKernel< ResultType > add_partial, Reduction::ReductionOp< ResultType > reduce_op)
performs a reduction over all particles
Struct holding all information for one particle.