32 template <
typename bin_index_type>
44 return modePreference;
76 template <
typename bunch_type>
79 using value_type =
typename bunch_type::Layout_t::value_type;
120 KOKKOS_INLINE_FUNCTION
124 return value / sqrt(1 + value * value);
139 template <
typename ViewType>
140 void computeFixSum(
const ViewType& input_view,
const ViewType& post_sum_view) {
141 using execution_space =
typename ViewType::execution_space;
143 using value_type =
typename ViewType::value_type;
146 if (post_sum_view.extent(0) != input_view.extent(0) + 1) {
147 Inform m(
"computePostSum");
148 m <<
"Output view must have size input_view.extent(0) + 1" <<
endl;
155 post_sum_view(0) = 0;
159 Kokkos::parallel_scan(
"ComputePostSum", Kokkos::RangePolicy<execution_space>(0, input_view.extent(0)),
160 KOKKOS_LAMBDA(
const size_type& i, value_type& partial_sum,
bool final) {
161 partial_sum += input_view(i);
163 post_sum_view(i + 1) = partial_sum;
181 template <
typename ValueType,
typename SizeType,
typename HashType>
182 bool viewIsSorted (
const Kokkos::View<ValueType*> view, HashType indices, SizeType npart) {
185 if (view(indices(i)) > view(indices(i + 1))) update =
false;
186 }, Kokkos::LAnd<bool>(sorted));
typename ippl::detail::ViewType< ippl::Vector< double, Dim >, 1 >::view_type view_type
ippl::detail::size_type size_type
Inform & endl(Inform &inf)
void computeFixSum(const ViewType &input_view, const ViewType &post_sum_view)
Computes the post- or prefix-sum of the input view and stores the result in the .....
HistoReductionMode determineHistoReductionMode(HistoReductionMode modePreference, bin_index_type binCount)
Determines the appropriate histogram reduction mode based on user preference, bin count,...
bool viewIsSorted(const Kokkos::View< ValueType * > view, HashType indices, SizeType npart)
Checks if the elements in a Kokkos::View are sorted in non-decreasing order.
void parallel_for(const std::string &name, const ExecPolicy &policy, const FunctorType &functor)
void parallel_reduce(const std::string &name, const ExecPolicy &policy, const FunctorType &functor, ReducerArgument &&... reducer)
std::unique_ptr< mpi::Communicator > Comm
Example struct used to access the binning variable for each particle.
position_view_type data_arr
Kokkos view of the particle data array.
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.
typename bunch_type::particle_position_type::view_type position_view_type
Type representing the view of particle positions.
const int axis
Index of the coordinate axis to use for binning.
CoordinateSelector(int axis_)
Constructs a CoordinateSelector for a specific axis.
typename bunch_type::size_type size_type
Type representing the size of the particle bunch.
typename bunch_type::Layout_t::value_type value_type
Type representing the value of the binning variable (e.g., position or velocity).