42 template <
typename IterType,
typename RawBinaryCompare>
45 using BinaryCompare = viskores::cont::internal::WrappedBinaryOperator<bool, RawBinaryCompare>;
46 using ValueType =
typename std::iterator_traits<IterType>::value_type;
77 this->SerialSize = 32768;
140 assert(numVals >= 9);
145 const viskores::Id seed = range[0] * 3 / 2 + range[1] * 11 / 3 + numVals * 10 / 7;
149 range[0] + ((seed + 0 * delta) % numVals), range[0] + ((seed + 1 * delta) % numVals),
150 range[0] + ((seed + 2 * delta) % numVals), range[0] + ((seed + 3 * delta) % numVals),
151 range[0] + ((seed + 4 * delta) % numVals), range[0] + ((seed + 5 * delta) % numVals),
152 range[0] + ((seed + 6 * delta) % numVals), range[0] + ((seed + 7 * delta) % numVals),
153 range[0] + ((seed + 8 * delta) % numVals)
173 swap(this->Data[origPivotIdx], this->Data[range[1] - 1]);
184 while (this->
Compare(this->Data[++dataCursors[0]], pivotVal))
186 while (this->
Compare(pivotVal, this->Data[--dataCursors[1]]) && dataCursors[1] > range[0])
190 if (dataCursors[0] >= dataCursors[1])
197 swap(this->Data[dataCursors[0]], this->Data[dataCursors[1]]);
201 if (!this->
Compare(this->Data[dataCursors[0]], pivotVal))
204 swap(this->Data[pivotCursors[0]], this->Data[dataCursors[0]]);
206 if (!this->
Compare(pivotVal, this->Data[dataCursors[1]]))
209 swap(this->Data[pivotCursors[1]], this->Data[dataCursors[1]]);
218 swap(this->Data[range[1] - 1], this->Data[dataCursors[0]]);
221 dataCursors =
viskores::Id2(dataCursors[0] - 1, dataCursors[0] + 1);
223 for (
viskores::Id i = range[0]; i < pivotCursors[0]; ++i, --dataCursors[0])
225 swap(this->Data[i], this->Data[dataCursors[0]]);
228 for (
viskores::Id i = range[1] - 2; i > pivotCursors[1]; --i, ++dataCursors[1])
230 swap(this->Data[i], this->Data[dataCursors[1]]);
245 std::sort(this->Data + range[0], this->Data + range[1], this->Compare);
256 auto explicitThis =
this;
260 explicitThis->Sort(rhRange);