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 <functional>
#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 >
 Custom reduction in the form required by Kokkos. More...
 

Namespaces

namespace  Reduction
 

Typedefs

template<typename ResultType >
using Reduction::AddPartialResultKernel = std::function< void(ResultType &, Particle const &)>
 Kernel that adds the result from a single particle to a reduction.
 
template<typename ResultType >
using Reduction::ReductionOp = std::function< void(ResultType &, ResultType const &)>
 Join two partial reduction results.
 

Functions

template<typename ResultType , typename Kernel >
KokkosReducer< ResultType, Kernel > Reduction::make_kokkos_reducer (Kernel k, ReductionOp< ResultType > reduce_op)
 
template<typename ResultType >
ResultType reduce_over_local_particles (CellStructure const &cs, Reduction::AddPartialResultKernel< ResultType > add_partial, Reduction::ReductionOp< ResultType > reduce_op)
 performs a reduction over all particles
 

Function Documentation

◆ reduce_over_local_particles()

template<typename ResultType >
ResultType reduce_over_local_particles ( CellStructure const &  cs,
Reduction::AddPartialResultKernel< ResultType >  add_partial,
Reduction::ReductionOp< ResultType >  reduce_op 
)

performs a reduction over all particles

Parameters
cscell structure to iterate over
add_partialis a function that adds a reduction result from a single particle
reduce_opis a function that joins two reduction results

both functions have to implement the same reduction.

Definition at line 101 of file particle_reduction.hpp.

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

Referenced by CellStructure::check_resort_required(), and CoulombP3MHeffte< FloatType, Architecture, FFTConfig >::count_charged_particles().