diff options
author | 2019-09-26 09:00:22 -0700 | |
---|---|---|
committer | 2019-10-01 16:32:38 -0700 | |
commit | fac016f1173aacbf4500a28ef63ed683365e4d3f (patch) | |
tree | 5d73a178b35aa47c82cde169ad99a1a85a5c72ab /Source/Particles/Sorting/SortingUtils.H | |
parent | 8575478f370f3db2525a8d5444e6949776e9da29 (diff) | |
download | WarpX-fac016f1173aacbf4500a28ef63ed683365e4d3f.tar.gz WarpX-fac016f1173aacbf4500a28ef63ed683365e4d3f.tar.zst WarpX-fac016f1173aacbf4500a28ef63ed683365e4d3f.zip |
Implemented iterator distance
Diffstat (limited to 'Source/Particles/Sorting/SortingUtils.H')
-rw-r--r-- | Source/Particles/Sorting/SortingUtils.H | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H index ede59b53b..7d53a352e 100644 --- a/Source/Particles/Sorting/SortingUtils.H +++ b/Source/Particles/Sorting/SortingUtils.H @@ -43,6 +43,19 @@ ForwardIterator stablePartition(ForwardIterator index_begin, } // TODO: Add documentation +template< typename ForwardIterator > +int iteratorDistance(ForwardIterator first, + ForwardIterator last) +{ +#ifdef AMREX_USE_GPU + // On GPU: Use thrust + return thrust::distance( first, last ); +#else + return std::distance( first, last ); +#endif +} + +// TODO: Add documentation class fillBufferFlag { public: |