|
OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
|
Example struct used to access the binning variable for each particle. More...
#include <BinningTools.h>
Public Types | |
| using | value_type = typename bunch_type::Layout_t::value_type |
| Type representing the value of the binning variable (e.g., position or velocity). | |
| using | size_type = typename bunch_type::size_type |
| Type representing the size of the particle bunch. | |
| using | position_view_type = typename bunch_type::particle_position_type::view_type |
| Type representing the view of particle positions. | |
Public Member Functions | |
| CoordinateSelector (int axis_) | |
| Constructs a CoordinateSelector for a specific axis. | |
| void | updateDataArr (std::shared_ptr< bunch_type > bunch) |
| Updates the data array view with the latest particle data. | |
| KOKKOS_INLINE_FUNCTION value_type | operator() (const size_type &i) const |
| Returns the value of the binning variable for a given particle index. | |
Public Attributes | |
| position_view_type | data_arr |
| Kokkos view of the particle data array. | |
| const int | axis |
| Index of the coordinate axis to use for binning. | |
Example struct used to access the binning variable for each particle.
This struct provides a flexible way to select a specific coordinate axis (e.g., position or velocity) for binning. It allows specifying the axis index, making it versatile for different coordinate-based binning operations. Alternatively, custom structs could be defined for other binning variables, such as calculating energy with saved mass and velocity values.
Requirement:
operator() must be defined with the exact signature shown below.
value_type must be defined in the struct.
If operator() does not return value_type, AdaptBins will not compile, and may cause segmentation faults.
Example usage:
| bunch_type | Type of the particle bunch (derived from ParticleBase). |
Definition at line 77 of file BinningTools.h.
| using ParticleBinning::CoordinateSelector< bunch_type >::position_view_type = typename bunch_type::particle_position_type::view_type |
Type representing the view of particle positions.
Definition at line 85 of file BinningTools.h.
| using ParticleBinning::CoordinateSelector< bunch_type >::size_type = typename bunch_type::size_type |
Type representing the size of the particle bunch.
Definition at line 82 of file BinningTools.h.
| using ParticleBinning::CoordinateSelector< bunch_type >::value_type = typename bunch_type::Layout_t::value_type |
Type representing the value of the binning variable (e.g., position or velocity).
Definition at line 79 of file BinningTools.h.
|
inline |
Constructs a CoordinateSelector for a specific axis.
| data_ | Kokkos view representing the particle data array. |
| axis_ | Index of the axis to use for binning (e.g., 0 for x, 1 for y, 2 for z). |
Definition at line 96 of file BinningTools.h.
References axis.
|
inline |
Returns the value of the binning variable for a given particle index.
This function is called by AdaptBins to obtain the binning value for each particle.
| i | Index of the particle in the data array. |
Definition at line 121 of file BinningTools.h.
|
inline |
Updates the data array view with the latest particle data.
This function updates data_arr to reflect the latest particle data in the container by retrieving the view from bunch->R. This ensures data_arr is synchronized with any recent changes to the particle data (if bunch->create() is called between binnings!). AdaptBins calls this function automatically everytime the binning parameter is used.
Definition at line 110 of file BinningTools.h.
References data_arr.
| const int ParticleBinning::CoordinateSelector< bunch_type >::axis |
Index of the coordinate axis to use for binning.
Definition at line 88 of file BinningTools.h.
Referenced by CoordinateSelector(), and operator()().
| position_view_type ParticleBinning::CoordinateSelector< bunch_type >::data_arr |
Kokkos view of the particle data array.
Definition at line 87 of file BinningTools.h.
Referenced by operator()(), and updateDataArr().