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];
79 template <
typename T,
typename F>
108 template <
typename T,
typename F>
111 return Partition(data, 0, n, std::forward<F>(
f));
132 template <
typename T,
typename F>
164 template <
typename T,
typename F>
168 int n2 =
end - beg - n;
194 template <
typename T,
typename F>
220 template <
typename T,
typename F>
224 int n2 =
static_cast<int>(v.
size()) - n;
251 template <
typename T,
typename F>
254 auto it = std::partition(data + beg, data +
end,
f);
255 return static_cast<int>(std::distance(data + beg, it));
277 template <
typename T,
typename F>
280 return Partition(data, 0, n, std::forward<F>(
f));
301 template <
typename T,
typename F>
302 int 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));
330 template <
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));
358 template <
typename T,
typename F>
384 template <
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:246
size_type size() const noexcept
Definition: AMReX_PODVector.H:575
void swap(PODVector< T, Allocator > &a_vector) noexcept
Definition: AMReX_PODVector.H:677
iterator begin() noexcept
Definition: AMReX_PODVector.H:601
iterator end() noexcept
Definition: AMReX_PODVector.H:605
T * dataPtr() noexcept
Definition: AMReX_PODVector.H:597
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
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
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:200
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:841