8 #ifndef WARPX_PARTICLES_SORTING_SORTINGUTILS_H_
9 #define WARPX_PARTICLES_SORTING_SORTINGUTILS_H_
45 template<
typename ForwardIterator >
47 ForwardIterator
const index_end,
53 int N =
static_cast<int>(std::distance(index_begin, index_end));
57 ForwardIterator sep = index_begin;
58 std::advance(sep, num_true);
61 ForwardIterator
const sep = std::stable_partition(
62 index_begin, index_end,
63 [&predicate](
long i) {
return predicate[
i]; }
76 template<
typename ForwardIterator >
78 ForwardIterator
const last)
80 return std::distance( first, last );
105 for (
int idim=0; idim<AMREX_SPACEDIM; idim++) {
156 long const start_index ) :
165 for (
int idim=0; idim<AMREX_SPACEDIM; idim++) {
202 template <
typename T>
#define AMREX_FORCE_INLINE
#define AMREX_FOR_1D(...)
#define AMREX_GPU_HOST_DEVICE
void fillWithConsecutiveIntegers(amrex::Gpu::DeviceVector< long > &v)
Fill the elements of the input vector with consecutive integer, starting from 0.
Definition: SortingUtils.H:22
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:46
int iteratorDistance(ForwardIterator const first, ForwardIterator const last)
Return the number of elements between first and last
Definition: SortingUtils.H:77
Definition: WarpXParticleContainer.H:52
const Real * InvCellSize() const noexcept
const Box & Domain() const noexcept
const Real * ProbLo() const noexcept
size_type size() const noexcept
iterator begin() noexcept
AoSRef GetArrayOfStructs() const
T_ParticleType ParticleType
Functor that copies the elements of src into dst, while reordering them according to indices
Definition: SortingUtils.H:204
T const * m_src_ptr
Definition: SortingUtils.H:222
copyAndReorder(amrex::Gpu::DeviceVector< T > const &src, amrex::Gpu::DeviceVector< T > &dst, amrex::Gpu::DeviceVector< long > const &indices)
Definition: SortingUtils.H:206
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void operator()(const long ip) const
Definition: SortingUtils.H:217
long const * m_indices_ptr
Definition: SortingUtils.H:224
T * m_dst_ptr
Definition: SortingUtils.H:223
Functor that fills the elements of the particle array inexflag with the value of the spatial array bm...
Definition: SortingUtils.H:94
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_inv_cell_size
Definition: SortingUtils.H:126
fillBufferFlag(WarpXParIter const &pti, amrex::iMultiFab const *bmasks, amrex::Gpu::DeviceVector< int > &inexflag, amrex::Geometry const &geom)
Definition: SortingUtils.H:96
amrex::Array4< int const > m_buffer_mask
Definition: SortingUtils.H:130
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_prob_lo
Definition: SortingUtils.H:125
WarpXParticleContainer::ParticleType const * m_particles
Definition: SortingUtils.H:129
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const long i) const
Definition: SortingUtils.H:113
int * m_inexflag_ptr
Definition: SortingUtils.H:128
amrex::Box m_domain
Definition: SortingUtils.H:127
Functor that fills the elements of the particle array inexflag with the value of the spatial array bm...
Definition: SortingUtils.H:148
long const * m_indices_ptr
Definition: SortingUtils.H:192
amrex::Box m_domain
Definition: SortingUtils.H:187
long const m_start_index
Definition: SortingUtils.H:191
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_inv_cell_size
Definition: SortingUtils.H:186
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > m_prob_lo
Definition: SortingUtils.H:185
fillBufferFlagRemainingParticles(WarpXParIter const &pti, amrex::iMultiFab const *bmasks, amrex::Gpu::DeviceVector< int > &inexflag, amrex::Geometry const &geom, amrex::Gpu::DeviceVector< long > const &particle_indices, long const start_index)
Definition: SortingUtils.H:150
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const long i) const
Definition: SortingUtils.H:173
amrex::Array4< int const > m_buffer_mask
Definition: SortingUtils.H:190
WarpXParticleContainer::ParticleType const * m_particles
Definition: SortingUtils.H:189
int * m_inexflag_ptr
Definition: SortingUtils.H:188
list data
open text file and read data #####
Definition: Excitation_Flag_Generator.py:24
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) noexcept
int StablePartition(T *data, int beg, int end, F &&f)
i
Definition: check_interp_points_and_weights.py:174