ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
particle_reduction.hpp File Reference
#include <config/config.hpp>
#include "Particle.hpp"
#include "cell_system/CellStructure.hpp"
#include <Kokkos_Core.hpp>
#include <concepts>
#include <utility>
Include dependency graph for particle_reduction.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Reduction::KokkosReducer< ResultType, Kernel, Reduction >
 Custom reduction in the form required by Kokkos. More...

Namespaces

namespace  Reduction

Functions

template<typename ResultType, class Kernel, class Reduction>
KokkosReducer< ResultType, Kernel, Reduction > Reduction::make_kokkos_reducer (Kernel k, Reduction reduce_op)
template<typename ResultType>
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.

Function Documentation

◆ reduce_over_local_particles()

template<typename ResultType>
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.

Parameters
cscell structure to iterate over
add_partialfunction that accumulates a result from a single particle
reduce_opfunction that joins two reduction results

both functions have to implement the same reduction.

Definition at line 81 of file particle_reduction.hpp.

References CellStructure::decomposition(), ParticleDecomposition::local_cells(), Reduction::make_kokkos_reducer(), and ParticleRange::size().

Referenced by calc_dipole_moment(), calc_linear_momentum(), System::System::calculate_pressure(), CellStructure::check_resort_required(), and CoulombP3MImpl< FloatType, Architecture, FFTConfig >::count_charged_particles().