1#ifndef AMREX_PARTITION_H_
2#define AMREX_PARTITION_H_
3#include <AMReX_Config.H>
18 template <
typename T,
typename F>
21 return Scan::PrefixSum<int> (n,
40 pv2[n-1-(i-s)] = pv[i];
47 void amrex_stable_partition_helper (T* p,
int n2)
83template <
typename T,
typename F>
88 int tot = detail::amrex_partition_helper(data + beg, v2.
dataPtr(), n, std::forward<F>(f));
112template <
typename T,
typename F>
115 return Partition(data, 0, n, std::forward<F>(f));
136template <
typename T,
typename F>
141 int tot = detail::amrex_partition_helper(v.
dataPtr(), v2.
dataPtr(), n, std::forward<F>(f));
168template <
typename T,
typename F>
172 int n2 =
end - beg - n;
173 detail::amrex_stable_partition_helper(data + beg + n, n2);
198template <
typename T,
typename F>
224template <
typename T,
typename F>
227 int n =
Partition(v, std::forward<F>(f));
228 int n2 =
static_cast<int>(v.
size()) - n;
229 detail::amrex_stable_partition_helper(v.
dataPtr() + n, n2);
255template <
typename T,
typename F>
258 auto it = std::partition(data + beg, data +
end, f);
259 return static_cast<int>(std::distance(data + beg, it));
281template <
typename T,
typename F>
284 return Partition(data, 0, n, std::forward<F>(f));
305template <
typename T,
typename F>
306int Partition (Gpu::DeviceVector<T>& v,
F && f)
308 auto it = std::partition(v.begin(), v.end(), f);
309 return static_cast<int>(std::distance(v.begin(), it));
334template <
typename T,
typename F>
337 auto it = std::stable_partition(data + beg, data +
end, f);
338 return static_cast<int>(std::distance(data + beg, it));
362template <
typename T,
typename F>
388template <
typename T,
typename F>
391 auto it = std::stable_partition(v.begin(), v.end(), f);
392 return static_cast<int>(std::distance(v.begin(), it));
#define AMREX_RESTRICT
Definition AMReX_Extension.H:32
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
Dynamically allocated vector for trivially copyable data.
Definition AMReX_PODVector.H:308
size_type size() const noexcept
Definition AMReX_PODVector.H:648
void swap(PODVector< T, Allocator > &a_vector) noexcept
Definition AMReX_PODVector.H:840
iterator begin() noexcept
Definition AMReX_PODVector.H:674
iterator end() noexcept
Definition AMReX_PODVector.H:678
T * dataPtr() noexcept
Definition AMReX_PODVector.H:670
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:128
static constexpr DeviceToDevice deviceToDevice
Definition AMReX_GpuContainers.H:107
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:152
static constexpr struct amrex::Scan::Type::Exclusive exclusive
Definition AMReX_Amr.cpp:49
__host__ __device__ void Swap(T &t1, T &t2) noexcept
Definition AMReX_Algorithm.H:93
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:193
int Partition(T *data, int beg, int end, F &&f)
A GPU-capable partition function for contiguous data.
Definition AMReX_Partition.H:84
int StablePartition(T *data, int beg, int end, F &&f)
A GPU-capable partition function for contiguous data.
Definition AMReX_Partition.H:169
__host__ __device__ Dim3 end(BoxND< dim > const &box) noexcept
Definition AMReX_Box.H:2015