diff options
author | 2023-09-14 08:38:12 +0900 | |
---|---|---|
committer | 2023-09-13 16:38:12 -0700 | |
commit | 6c4436e1f9ec0a2fcd40cdf2692beea14074e459 (patch) | |
tree | 720d1a912407136aea61edc1d4365ba728ea34a2 /Source/Particles/Sorting | |
parent | 5f40a2b5304d2a01c3c5676faca8dc5b9714ed4f (diff) | |
download | WarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.tar.gz WarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.tar.zst WarpX-6c4436e1f9ec0a2fcd40cdf2692beea14074e459.zip |
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
Diffstat (limited to 'Source/Particles/Sorting')
-rw-r--r-- | Source/Particles/Sorting/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/Particles/Sorting/Make.package | 2 | ||||
-rw-r--r-- | Source/Particles/Sorting/SortingUtils.H | 13 | ||||
-rw-r--r-- | Source/Particles/Sorting/SortingUtils.cpp | 22 |
4 files changed, 26 insertions, 12 deletions
diff --git a/Source/Particles/Sorting/CMakeLists.txt b/Source/Particles/Sorting/CMakeLists.txt index d3c378e43..60a156f46 100644 --- a/Source/Particles/Sorting/CMakeLists.txt +++ b/Source/Particles/Sorting/CMakeLists.txt @@ -3,5 +3,6 @@ foreach(D IN LISTS WarpX_DIMS) target_sources(lib_${SD} PRIVATE Partition.cpp + SortingUtils.cpp ) endforeach() diff --git a/Source/Particles/Sorting/Make.package b/Source/Particles/Sorting/Make.package index 16efc02b8..e6ad1604d 100644 --- a/Source/Particles/Sorting/Make.package +++ b/Source/Particles/Sorting/Make.package @@ -1,2 +1,4 @@ CEXE_sources += Partition.cpp +CEXE_sources += SortingUtils.cpp + VPATH_LOCATIONS += $(WARPX_HOME)/Source/Particles/Sorting diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H index 0bec92d6e..dd53ad6f6 100644 --- a/Source/Particles/Sorting/SortingUtils.H +++ b/Source/Particles/Sorting/SortingUtils.H @@ -19,18 +19,7 @@ * * \param[inout] v Vector of integers, to be filled by this routine */ -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 -} +void fillWithConsecutiveIntegers( amrex::Gpu::DeviceVector<long>& v ); /** \brief Find the indices that would reorder the elements of `predicate` * so that the elements with non-zero value precede the other elements 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<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 +} |