1#ifndef AMREX_PARTITION_H_
2#define AMREX_PARTITION_H_
3#include <AMReX_Config.H>
17 template <
typename T,
typename F>
20 return Scan::PrefixSum<int> (n,
39 pv2[n-1-(i-s)] = pv[i];
79template <
typename T,
typename F>
108template <
typename T,
typename F>
111 return Partition(data, 0, n, std::forward<F>(f));
132template <
typename T,
typename F>
164template <
typename T,
typename F>
168 int n2 =
end - beg - n;
194template <
typename T,
typename F>
220template <
typename T,
typename F>
223 int n =
Partition(v, std::forward<F>(f));
224 int n2 =
static_cast<int>(v.
size()) - n;
251template <
typename T,
typename F>
254 auto it = std::partition(data + beg, data +
end, f);
255 return static_cast<int>(std::distance(data + beg, it));
277template <
typename T,
typename F>
280 return Partition(data, 0, n, std::forward<F>(f));
301template <
typename T,
typename F>
302int Partition (Gpu::DeviceVector<T>& v,
F && f)
304 auto it = std::partition(v.begin(), v.end(), f);
305 return static_cast<int>(std::distance(v.begin(), it));
330template <
typename T,
typename F>
333 auto it = std::stable_partition(data + beg, data +
end, f);
334 return static_cast<int>(std::distance(data + beg, it));
358template <
typename T,
typename F>
384template <
typename T,
typename F>
387 auto it = std::stable_partition(v.begin(), v.end(), f);
388 return static_cast<int>(std::distance(v.begin(), it));
#define AMREX_RESTRICT
Definition AMReX_Extension.H:37
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
Definition AMReX_PODVector.H:262
size_type size() const noexcept
Definition AMReX_PODVector.H:591
void swap(PODVector< T, Allocator > &a_vector) noexcept
Definition AMReX_PODVector.H:693
iterator begin() noexcept
Definition AMReX_PODVector.H:617
iterator end() noexcept
Definition AMReX_PODVector.H:621
T * dataPtr() noexcept
Definition AMReX_PODVector.H:613
void copy(HostToDevice, InIter begin, InIter end, OutIter result) noexcept
A host-to-device copy routine. Note this is just a wrapper around memcpy, so it assumes contiguous st...
Definition AMReX_GpuContainers.H:121
static constexpr DeviceToDevice deviceToDevice
Definition AMReX_GpuContainers.H:100
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:237
static constexpr struct amrex::Scan::Type::Exclusive exclusive
void amrex_stable_partition_helper(T *p, int n2)
Definition AMReX_Partition.H:46
int amrex_partition_helper(T const *AMREX_RESTRICT pv, T *AMREX_RESTRICT pv2, int n, F &&f)
Definition AMReX_Partition.H:18
Definition AMReX_Amr.cpp:49
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:191
int Partition(T *data, int beg, int end, F &&f)
A GPU-capable partition function for contiguous data.
Definition AMReX_Partition.H:80
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void Swap(T &t1, T &t2) noexcept
Definition AMReX_Algorithm.H:75
int StablePartition(T *data, int beg, int end, F &&f)
A GPU-capable partition function for contiguous data.
Definition AMReX_Partition.H:165
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 end(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:1890
Definition AMReX_FabArrayCommI.H:896