aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/Sorting/SortingUtils.cpp
blob: 699119e8e18444e1b9e8fc0b98bec85f6eb0d87b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Copyright 2019-2020 Andrew Myers, Maxence Thevenet, Remi Lehe
 * Weiqun Zhang
 *
 * This file is part of WarpX.
 *
 * License: BSD-3-Clause-LBNL
 */

#include "SortingUtils.H"

void fillWithConsecutiveIntegers( amrex::Gpu::DeviceVector<long>& v )
{
#ifdef AMREX_USE_GPU
    // On GPU: Use amrex
    auto data = v.data();
    auto N = v.size();
    AMREX_FOR_1D( N, i, {data[i] = i;});
#else
    // On CPU: Use std library
    std::iota( v.begin(), v.end(), 0L );
#endif
}