From 6c4436e1f9ec0a2fcd40cdf2692beea14074e459 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Thu, 14 Sep 2023 08:38:12 +0900 Subject: Clang tidy CI test: add misc-definitions-in-headers check (#4253) * Clang-tidy: add misc-definitions-in-headers check * address issues found with clang-tidy * remove std::cout added for debug purposes * add back newline --- Source/Particles/Sorting/SortingUtils.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Source/Particles/Sorting/SortingUtils.cpp (limited to 'Source/Particles/Sorting/SortingUtils.cpp') diff --git a/Source/Particles/Sorting/SortingUtils.cpp b/Source/Particles/Sorting/SortingUtils.cpp new file mode 100644 index 000000000..699119e8e --- /dev/null +++ b/Source/Particles/Sorting/SortingUtils.cpp @@ -0,0 +1,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& 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 +} -- cgit v1.2.3