8 #ifndef WARPX_PARTICLES_SORTING_SORTINGUTILS_H_
9 #define WARPX_PARTICLES_SORTING_SORTINGUTILS_H_
35 template<
typename ForwardIterator >
37 ForwardIterator
const index_end,
43 int N =
static_cast<int>(std::distance(index_begin, index_end));
47 ForwardIterator sep = index_begin;
48 std::advance(sep, num_true);
51 ForwardIterator
const sep = std::stable_partition(
52 index_begin, index_end,
53 [&predicate](
int i) {
return predicate[
i]; }
66 template<
typename ForwardIterator >
68 ForwardIterator
const last)
70 return std::distance( first, last );
92 m_ptd{pti.GetParticleTile().getConstParticleTileData()},
95 for (
int idim=0; idim<AMREX_SPACEDIM; idim++) {
148 m_ptd{pti.GetParticleTile().getConstParticleTileData()},
153 for (
int idim=0; idim<AMREX_SPACEDIM; idim++) {
190 template <
typename T>
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
void fillWithConsecutiveIntegers(amrex::Gpu::DeviceVector< int > &v)
Fill the elements of the input vector with consecutive integer, starting from 0.
Definition: SortingUtils.cpp:11
ForwardIterator stablePartition(ForwardIterator const index_begin, ForwardIterator const index_end, amrex::Gpu::DeviceVector< int > const &predicate)
Find the indices that would reorder the elements of predicate so that the elements with non-zero valu...
Definition: SortingUtils.H:36
int iteratorDistance(ForwardIterator const first, ForwardIterator const last)
Return the number of elements between first and last
Definition: SortingUtils.H:67
Definition: WarpXParticleContainer.H:53
const Real * InvCellSize() const noexcept
const Real * ProbLo() const noexcept
Functor that copies the elements of src into dst, while reordering them according to indices
Definition: SortingUtils.H:192
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void operator()(const int ip) const
Definition: SortingUtils.H:205
T const * m_src_ptr
Definition: SortingUtils.H:210
copyAndReorder(amrex::Gpu::DeviceVector< T > const &src, amrex::Gpu::DeviceVector< T > &dst, amrex::Gpu::DeviceVector< int > const &indices)
Definition: SortingUtils.H:194
T * m_dst_ptr
Definition: SortingUtils.H:211
int const * m_indices_ptr
Definition: SortingUtils.H:212
Functor that fills the elements of the particle array inexflag with the value of the spatial array bm...
Definition: SortingUtils.H:84
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_inv_cell_size
Definition: SortingUtils.H:118
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const int i) const
Definition: SortingUtils.H:103
fillBufferFlag(WarpXParIter const &pti, amrex::iMultiFab const *bmasks, amrex::Gpu::DeviceVector< int > &inexflag, amrex::Geometry const &geom)
Definition: SortingUtils.H:86
amrex::Array4< int const > m_buffer_mask
Definition: SortingUtils.H:116
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_prob_lo
Definition: SortingUtils.H:117
WarpXParticleContainer::ParticleTileType::ConstParticleTileDataType m_ptd
Definition: SortingUtils.H:115
int * m_inexflag_ptr
Definition: SortingUtils.H:114
amrex::Box m_domain
Definition: SortingUtils.H:113
Functor that fills the elements of the particle array inexflag with the value of the spatial array bm...
Definition: SortingUtils.H:136
amrex::Box m_domain
Definition: SortingUtils.H:175
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_inv_cell_size
Definition: SortingUtils.H:174
WarpXParticleContainer::ParticleTileType::ConstParticleTileDataType const m_ptd
Definition: SortingUtils.H:177
fillBufferFlagRemainingParticles(WarpXParIter const &pti, amrex::iMultiFab const *bmasks, amrex::Gpu::DeviceVector< int > &inexflag, amrex::Geometry const &geom, amrex::Gpu::DeviceVector< int > const &particle_indices, int start_index)
Definition: SortingUtils.H:138
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_prob_lo
Definition: SortingUtils.H:173
int const * m_indices_ptr
Definition: SortingUtils.H:180
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const int i) const
Definition: SortingUtils.H:161
amrex::Array4< int const > m_buffer_mask
Definition: SortingUtils.H:178
int const m_start_index
Definition: SortingUtils.H:179
int * m_inexflag_ptr
Definition: SortingUtils.H:176
int StablePartition(T *data, int beg, int end, F &&f)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVect getParticleCell(P const &p, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &plo, amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > const &dxi, const Box &domain) noexcept
i
Definition: check_interp_points_and_weights.py:174