WarpX
Public Member Functions | List of all members
VelocityCoincidenceThinning::HeapSort Struct Reference

This merging routine requires functionality to sort a GPU vector based on another GPU vector's values. The heap-sort functions below were obtained from https://www.geeksforgeeks.org/iterative-heap-sort/ and modified for the current purpose. It achieves the same as. More...

#include <VelocityCoincidenceThinning.H>

Public Member Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void swap (int &a, int &b) const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator() (int index_array[], const int bin_array[], const int start, const int n) const
 

Detailed Description

This merging routine requires functionality to sort a GPU vector based on another GPU vector's values. The heap-sort functions below were obtained from https://www.geeksforgeeks.org/iterative-heap-sort/ and modified for the current purpose. It achieves the same as.

std::sort(
sorted_indices_data + cell_start, sorted_indices_data + cell_stop,
[&momentum_bin_number_data](size_t i1, size_t i2) {
return momentum_bin_number_data[i1] < momentum_bin_number_data[i2];
}
);

but with support for device execution.

Member Function Documentation

◆ operator()()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void VelocityCoincidenceThinning::HeapSort::operator() ( int  index_array[],
const int  bin_array[],
const int  start,
const int  n 
) const
inline

◆ swap()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void VelocityCoincidenceThinning::HeapSort::swap ( int a,
int b 
) const
inline

The documentation for this struct was generated from the following file: