11 #ifndef vtk_m_cont_tbb_internal_ParallelSort_h
12 #define vtk_m_cont_tbb_internal_ParallelSort_h
21 #include <vtkm/cont/tbb/internal/ParallelSortTBB.hxx>
23 #include <type_traits>
40 template <
typename T,
typename Container,
class BinaryCompare>
42 template <
typename T,
typename StorageT,
typename U,
typename StorageU,
class BinaryCompare>
48 template <
typename HandleType,
class BinaryCompare>
50 BinaryCompare binary_compare,
51 vtkm::cont::internal::radix::PSortTag)
57 IteratorsType iterators(arrayPortal);
59 internal::WrappedBinaryOperator<bool, BinaryCompare> wrappedCompare(binary_compare);
64 template <
typename T,
typename StorageT,
class BinaryCompare>
66 BinaryCompare binary_compare,
67 vtkm::cont::internal::radix::RadixSortTag)
69 using namespace vtkm::cont::internal::radix;
70 auto c = get_std_compare(binary_compare, T{});
74 valuesPortal.GetIteratorBegin(),
static_cast<std::size_t
>(values.
GetNumberOfValues()), c);
78 template <
typename T,
typename Container,
class BinaryCompare>
81 using namespace vtkm::cont::internal::radix;
82 using SortAlgorithmTag =
typename sort_tag_type<T, Container, BinaryCompare>::type;
88 template <
typename T,
typename StorageT,
typename U,
typename StorageU,
class BinaryCompare>
91 BinaryCompare binary_compare,
92 vtkm::cont::internal::radix::PSortTag)
94 using namespace vtkm::cont::internal::radix;
96 constexpr
bool larger_than_64bits =
sizeof(U) >
sizeof(
vtkm::Int64);
97 if (larger_than_64bits)
106 IndexType indexArray;
107 ValueType valuesScattered;
121 vtkm::cont::internal::KeyCompare<T, vtkm::Id, BinaryCompare>(binary_compare),
137 tbb::CopyPortals(inputPortal, outputPortal, 0, 0, valuesScattered.GetNumberOfValues());
147 zipHandle, vtkm::cont::internal::KeyCompare<T, U, BinaryCompare>(binary_compare), PSortTag{});
152 template <
typename T,
typename StorageT,
typename StorageU,
class BinaryCompare>
155 BinaryCompare binary_compare,
156 vtkm::cont::internal::radix::RadixSortTag)
158 using namespace vtkm::cont::internal::radix;
159 auto c = get_std_compare(binary_compare, T{});
164 valuesPortal.GetIteratorBegin(),
170 template <
typename T,
typename StorageT,
typename U,
typename StorageU,
class BinaryCompare>
173 BinaryCompare binary_compare,
174 vtkm::cont::internal::radix::RadixSortTag)
181 IndexType indexArray;
182 ValueType valuesScattered;
202 vtkm::cont::internal::KeyCompare<T, vtkm::Id, BinaryCompare>(binary_compare),
203 vtkm::cont::internal::radix::PSortTag{});
219 tbb::CopyPortals(inputPortal, outputPortal, 0, 0, valuesScattered.GetNumberOfValues());
224 template <
typename T,
typename StorageT,
typename U,
typename StorageU,
class BinaryCompare>
227 BinaryCompare binary_compare)
229 using namespace vtkm::cont::internal::radix;
230 using SortAlgorithmTag =
231 typename sortbykey_tag_type<T, U, StorageT, StorageU, BinaryCompare>::type;
239 #endif // vtk_m_cont_tbb_internal_ParallelSort_h