Go to the documentation of this file.
10 #ifndef vtk_m_cont_Algorithm_h
11 #define vtk_m_cont_Algorithm_h
29 template <
typename Device,
typename T>
30 inline auto DoPrepareArgForExec(T&&
object,
vtkm::cont::Token& token, std::true_type) -> decltype(
31 vtkm::cont::internal::CallPrepareForExecution(std::forward<T>(
object), Device{}, token))
34 return vtkm::cont::internal::CallPrepareForExecution(std::forward<T>(
object), Device{}, token);
37 template <
typename Device,
typename T>
40 static_assert(!vtkm::cont::internal::IsExecutionObjectBase<T>::value,
41 "Internal error: failed to detect execution object.");
42 return std::forward<T>(
object);
45 template <
typename Device,
typename T>
47 -> decltype(DoPrepareArgForExec<Device>(std::forward<T>(
object),
49 vtkm::cont::internal::IsExecutionObjectBase<T>{}))
51 return DoPrepareArgForExec<Device>(
52 std::forward<T>(
object), token, vtkm::cont::internal::IsExecutionObjectBase<T>{});
55 struct BitFieldToUnorderedSetFunctor
59 template <
typename Device,
typename... Args>
60 VTKM_CONT bool operator()(Device, Args&&... args)
65 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
72 template <
typename T,
typename S,
typename... Args>
80 template <
typename Device,
typename... Args>
81 VTKM_CONT bool operator()(Device device,
bool useExistingDevice, Args&&... args)
const
84 if (!useExistingDevice || this->InputArrayOnDevice(device, std::forward<Args>(args)...))
88 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
101 template <
typename Device,
typename... Args>
102 VTKM_CONT bool operator()(Device, Args&&... args)
const
107 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
112 struct CopySubRangeFunctor
116 CopySubRangeFunctor()
121 template <
typename Device,
typename... Args>
122 VTKM_CONT bool operator()(Device, Args&&... args)
127 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
132 struct CountSetBitsFunctor
136 template <
typename Device,
typename... Args>
137 VTKM_CONT bool operator()(Device, Args&&... args)
142 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
149 template <
typename Device,
typename... Args>
150 VTKM_CONT bool operator()(Device, Args&&... args)
155 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
160 struct LowerBoundsFunctor
163 template <
typename Device,
typename... Args>
164 VTKM_CONT bool operator()(Device, Args&&... args)
const
169 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
174 template <
typename U>
184 template <
typename Device,
typename... Args>
185 VTKM_CONT bool operator()(Device, Args&&... args)
190 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
195 struct ReduceByKeyFunctor
197 template <
typename Device,
typename... Args>
198 VTKM_CONT bool operator()(Device, Args&&... args)
const
203 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
208 template <
typename U>
209 struct ScanInclusiveResultFunctor
213 ScanInclusiveResultFunctor()
218 template <
typename Device,
typename... Args>
219 VTKM_CONT bool operator()(Device, Args&&... args)
224 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
229 struct ScanInclusiveByKeyFunctor
231 ScanInclusiveByKeyFunctor() {}
233 template <
typename Device,
typename... Args>
234 VTKM_CONT bool operator()(Device, Args&&... args)
const
239 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
244 template <
typename T>
245 struct ScanExclusiveFunctor
249 ScanExclusiveFunctor()
254 template <
typename Device,
typename... Args>
255 VTKM_CONT bool operator()(Device, Args&&... args)
260 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
265 struct ScanExclusiveByKeyFunctor
267 ScanExclusiveByKeyFunctor() {}
269 template <
typename Device,
typename... Args>
270 VTKM_CONT bool operator()(Device, Args&&... args)
const
275 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
280 template <
typename T>
281 struct ScanExtendedFunctor
283 template <
typename Device,
typename... Args>
284 VTKM_CONT bool operator()(Device, Args&&... args)
289 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
294 struct ScheduleFunctor
296 template <
typename Device,
typename... Args>
297 VTKM_CONT bool operator()(Device, Args&&... args)
302 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
309 template <
typename Device,
typename... Args>
310 VTKM_CONT bool operator()(Device, Args&&... args)
const
315 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
320 struct SortByKeyFunctor
322 template <
typename Device,
typename... Args>
323 VTKM_CONT bool operator()(Device, Args&&... args)
const
328 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
333 struct SynchronizeFunctor
335 template <
typename Device>
344 struct TransformFunctor
346 template <
typename Device,
typename... Args>
347 VTKM_CONT bool operator()(Device, Args&&... args)
const
352 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
359 template <
typename Device,
typename... Args>
360 VTKM_CONT bool operator()(Device, Args&&... args)
const
365 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
370 struct UpperBoundsFunctor
372 template <
typename Device,
typename... Args>
373 VTKM_CONT bool operator()(Device, Args&&... args)
const
378 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
388 template <
typename IndicesStorage>
394 detail::BitFieldToUnorderedSetFunctor functor;
396 return functor.Result;
399 template <
typename IndicesStorage>
404 detail::BitFieldToUnorderedSetFunctor functor;
406 return functor.Result;
409 template <
typename T,
typename U,
class CIn,
class COut>
415 if (devId == vtkm::cont::DeviceAdapterTagAny())
426 template <
typename T,
typename U,
class CIn,
class COut>
430 Copy(vtkm::cont::DeviceAdapterTagAny(), input, output);
434 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
442 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
447 CopyIf(vtkm::cont::DeviceAdapterTagAny(), input, stencil, output);
451 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
456 UnaryPredicate unary_predicate)
459 devId, detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
461 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
465 UnaryPredicate unary_predicate)
467 CopyIf(vtkm::cont::DeviceAdapterTagAny(), input, stencil, output, unary_predicate);
471 template <
typename T,
typename U,
class CIn,
class COut>
479 detail::CopySubRangeFunctor functor;
481 devId, functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
482 return functor.valid;
484 template <
typename T,
typename U,
class CIn,
class COut>
494 numberOfElementsToCopy,
502 detail::CountSetBitsFunctor functor;
504 return functor.PopCount;
509 return CountSetBits(vtkm::cont::DeviceAdapterTagAny{}, bits);
517 detail::FillFunctor functor;
523 Fill(vtkm::cont::DeviceAdapterTagAny{}, bits, value, numBits);
530 detail::FillFunctor functor;
536 Fill(vtkm::cont::DeviceAdapterTagAny{}, bits, value);
539 template <
typename WordType>
545 detail::FillFunctor functor;
549 template <
typename WordType>
552 Fill(vtkm::cont::DeviceAdapterTagAny{}, bits, word, numBits);
555 template <
typename WordType>
560 detail::FillFunctor functor;
564 template <
typename WordType>
567 Fill(vtkm::cont::DeviceAdapterTagAny{}, bits, word);
570 template <
typename T,
typename S>
575 detail::FillFunctor functor;
579 template <
typename T,
typename S>
582 Fill(vtkm::cont::DeviceAdapterTagAny{}, handle, value);
585 template <
typename T,
typename S>
591 detail::FillFunctor functor;
595 template <
typename T,
typename S>
600 Fill(vtkm::cont::DeviceAdapterTagAny{}, handle, value, numValues);
603 template <
typename T,
class CIn,
class CVal,
class COut>
611 template <
typename T,
class CIn,
class CVal,
class COut>
616 LowerBounds(vtkm::cont::DeviceAdapterTagAny(), input, values, output);
620 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
625 BinaryCompare binary_compare)
628 devId, detail::LowerBoundsFunctor(), input, values, output, binary_compare);
630 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
634 BinaryCompare binary_compare)
636 LowerBounds(vtkm::cont::DeviceAdapterTagAny(), input, values, output, binary_compare);
640 template <
class CIn,
class COut>
647 template <
class CIn,
class COut>
651 LowerBounds(vtkm::cont::DeviceAdapterTagAny(), input, values_output);
655 template <
typename T,
typename U,
class CIn>
660 detail::ReduceFunctor<U> functor;
662 return functor.result;
664 template <
typename T,
typename U,
class CIn>
667 return Reduce(vtkm::cont::DeviceAdapterTagAny(), input, initialValue);
671 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
675 BinaryFunctor binary_functor)
677 detail::ReduceFunctor<U> functor;
679 return functor.result;
681 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
684 BinaryFunctor binary_functor)
686 return Reduce(vtkm::cont::DeviceAdapterTagAny(), input, initialValue, binary_functor);
690 template <
typename T,
702 BinaryFunctor binary_functor)
705 detail::ReduceByKeyFunctor(),
712 template <
typename T,
723 BinaryFunctor binary_functor)
726 vtkm::cont::DeviceAdapterTagAny(), keys, values, keys_output, values_output, binary_functor);
730 template <
typename T,
class CIn,
class COut>
735 detail::ScanInclusiveResultFunctor<T> functor;
737 return functor.result;
739 template <
typename T,
class CIn,
class COut>
743 return ScanInclusive(vtkm::cont::DeviceAdapterTagAny(), input, output);
747 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
751 BinaryFunctor binary_functor)
753 detail::ScanInclusiveResultFunctor<T> functor;
755 return functor.result;
757 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
760 BinaryFunctor binary_functor)
762 return ScanInclusive(vtkm::cont::DeviceAdapterTagAny(), input, output, binary_functor);
766 template <
typename T,
771 typename BinaryFunctor>
776 BinaryFunctor binary_functor)
779 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
781 template <
typename T,
786 typename BinaryFunctor>
790 BinaryFunctor binary_functor)
793 vtkm::cont::DeviceAdapterTagAny(), keys, values, values_output, binary_functor);
797 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
804 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
806 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
815 template <
typename T,
class CIn,
class COut>
820 detail::ScanExclusiveFunctor<T> functor;
822 return functor.result;
824 template <
typename T,
class CIn,
class COut>
828 return ScanExclusive(vtkm::cont::DeviceAdapterTagAny(), input, output);
832 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
836 BinaryFunctor binaryFunctor,
837 const T& initialValue)
839 detail::ScanExclusiveFunctor<T> functor;
841 return functor.result;
843 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
846 BinaryFunctor binaryFunctor,
847 const T& initialValue)
850 vtkm::cont::DeviceAdapterTagAny(), input, output, binaryFunctor, initialValue);
854 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
859 const U& initialValue,
860 BinaryFunctor binaryFunctor)
863 detail::ScanExclusiveByKeyFunctor(),
870 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
874 const U& initialValue,
875 BinaryFunctor binaryFunctor)
878 vtkm::cont::DeviceAdapterTagAny(), keys, values, output, initialValue, binaryFunctor);
882 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
889 devId, detail::ScanExclusiveByKeyFunctor(), keys, values, output);
891 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
900 template <
typename T,
class CIn,
class COut>
905 detail::ScanExtendedFunctor<T> functor;
908 template <
typename T,
class CIn,
class COut>
912 ScanExtended(vtkm::cont::DeviceAdapterTagAny(), input, output);
916 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
920 BinaryFunctor binaryFunctor,
921 const T& initialValue)
923 detail::ScanExtendedFunctor<T> functor;
926 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
929 BinaryFunctor binaryFunctor,
930 const T& initialValue)
932 ScanExtended(vtkm::cont::DeviceAdapterTagAny(), input, output, binaryFunctor, initialValue);
936 template <
class Functor>
943 template <
class Functor>
946 Schedule(vtkm::cont::DeviceAdapterTagAny(), functor, numInstances);
950 template <
class Functor>
957 template <
class Functor>
960 Schedule(vtkm::cont::DeviceAdapterTagAny(), functor, rangeMax);
964 template <
typename T,
class Storage>
970 template <
typename T,
class Storage>
973 Sort(vtkm::cont::DeviceAdapterTagAny(), values);
977 template <
typename T,
class Storage,
class BinaryCompare>
980 BinaryCompare binary_compare)
984 template <
typename T,
class Storage,
class BinaryCompare>
986 BinaryCompare binary_compare)
988 Sort(vtkm::cont::DeviceAdapterTagAny(), values, binary_compare);
992 template <
typename T,
typename U,
class StorageT,
class StorageU>
999 template <
typename T,
typename U,
class StorageT,
class StorageU>
1003 SortByKey(vtkm::cont::DeviceAdapterTagAny(), keys, values);
1006 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1010 BinaryCompare binary_compare)
1014 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1017 BinaryCompare binary_compare)
1019 SortByKey(vtkm::cont::DeviceAdapterTagAny(), keys, values, binary_compare);
1030 template <
typename T,
1036 typename BinaryFunctor>
1041 BinaryFunctor binaryFunctor)
1044 devId, detail::TransformFunctor(), input1, input2, output, binaryFunctor);
1046 template <
typename T,
1052 typename BinaryFunctor>
1056 BinaryFunctor binaryFunctor)
1058 Transform(vtkm::cont::DeviceAdapterTagAny(), input1, input2, output, binaryFunctor);
1062 template <
typename T,
class Storage>
1068 template <
typename T,
class Storage>
1071 Unique(vtkm::cont::DeviceAdapterTagAny(), values);
1075 template <
typename T,
class Storage,
class BinaryCompare>
1078 BinaryCompare binary_compare)
1082 template <
typename T,
class Storage,
class BinaryCompare>
1084 BinaryCompare binary_compare)
1086 Unique(vtkm::cont::DeviceAdapterTagAny(), values, binary_compare);
1090 template <
typename T,
class CIn,
class CVal,
class COut>
1098 template <
typename T,
class CIn,
class CVal,
class COut>
1103 UpperBounds(vtkm::cont::DeviceAdapterTagAny(), input, values, output);
1107 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1112 BinaryCompare binary_compare)
1115 devId, detail::UpperBoundsFunctor(), input, values, output, binary_compare);
1117 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1121 BinaryCompare binary_compare)
1123 UpperBounds(vtkm::cont::DeviceAdapterTagAny(), input, values, output, binary_compare);
1127 template <
class CIn,
class COut>
1134 template <
class CIn,
class COut>
1138 UpperBounds(vtkm::cont::DeviceAdapterTagAny(), input, values_output);
1144 #endif //vtk_m_cont_Algorithm_h
static VTKM_CONT void ScanExtended(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:909
static VTKM_CONT void SortByKey(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:993
static VTKM_CONT void Copy(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Copy the contents of one ArrayHandle to another.
static VTKM_CONT void ScanExclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output)
Definition: Algorithm.h:892
static VTKM_CONT T ScanInclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:731
static VTKM_CONT void ScanExtended(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Compute an extended prefix sum operation on the input ArrayHandle.
Groups connected points that have the same field value.
Definition: Atomic.h:19
static VTKM_CONT vtkm::Id BitFieldToUnorderedSet(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:389
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
static VTKM_CONT void ScanExclusiveByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output)
Definition: Algorithm.h:883
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, WordType word, vtkm::Id numBits)
Definition: Algorithm.h:540
static VTKM_CONT void Fill(vtkm::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:580
static VTKM_CONT void CopyIf(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:443
static VTKM_CONT void ScanExtended(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:927
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Fill the BitField with a specific pattern of bits.
static VTKM_CONT void ScanInclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output)
Definition: Algorithm.h:807
static VTKM_CONT void UpperBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Definition: Algorithm.h:1091
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:985
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:971
static VTKM_CONT void UpperBounds(const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:1135
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
static VTKM_CONT T ScanInclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:748
static VTKM_CONT void ScanInclusiveByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:772
static VTKM_CONT void Unique(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1076
static VTKM_CONT void Fill(vtkm::cont::ArrayHandle< T, S > &handle, const T &value, const vtkm::Id numValues)
Definition: Algorithm.h:596
static VTKM_CONT void LowerBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Definition: Algorithm.h:604
static VTKM_CONT void SortByKey(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1007
static VTKM_CONT bool CopySubRange(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Definition: Algorithm.h:472
static VTKM_CONT void Schedule(Functor functor, vtkm::Id numInstances)
Definition: Algorithm.h:944
static VTKM_CONT void Sort(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:965
static VTKM_CONT void ScanExtended(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:917
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Definition: Algorithm.h:521
static VTKM_CONT void LowerBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Output is the first index in input for each item in values that wouldn't alter the ordering of input.
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, WordType word)
Definition: Algorithm.h:565
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
static VTKM_CONT void ScanInclusiveByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output)
Definition: Algorithm.h:798
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
static VTKM_CONT vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Definition: Algorithm.h:507
static VTKM_CONT vtkm::Id BitFieldToUnorderedSet(const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Create a unique, unsorted list of indices denoting which bits are set in a bitfield.
static VTKM_CONT void CopyIf(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
Definition: Algorithm.h:452
static VTKM_CONT T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:833
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Compute an exclusive prefix sum operation on the input ArrayHandle.
static VTKM_CONT void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1015
static VTKM_CONT void Synchronize(vtkm::cont::DeviceAdapterId devId)
Definition: Algorithm.h:1023
VTKM_CONT bool TryExecuteOnDevice(vtkm::cont::DeviceAdapterId devId, Functor &&functor)
Try to execute a functor on a specific device selected at runtime.
Definition: TryExecute.h:178
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
static VTKM_CONT void Transform(const vtkm::cont::ArrayHandle< T, StorageT > &input1, const vtkm::cont::ArrayHandle< U, StorageU > &input2, vtkm::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:1053
static VTKM_CONT void ReduceByKey(const vtkm::cont::ArrayHandle< T, CKeyIn > &keys, const vtkm::cont::ArrayHandle< U, CValIn > &values, vtkm::cont::ArrayHandle< T, CKeyOut > &keys_output, vtkm::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:719
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, bool value)
Definition: Algorithm.h:534
static VTKM_CONT void Schedule(vtkm::cont::DeviceAdapterId devId, Functor functor, vtkm::Id numInstances)
Definition: Algorithm.h:937
static VTKM_CONT void Unique(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1063
static VTKM_CONT void LowerBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:621
static VTKM_CONT void Transform(const vtkm::cont::ArrayHandle< T, StorageT > &input1, const vtkm::cont::ArrayHandle< U, StorageU > &input2, vtkm::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Apply a given binary operation function element-wise to input arrays.
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:682
static VTKM_CONT void UpperBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:1128
static VTKM_CONT U Reduce(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:672
static VTKM_CONT void ScanExclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:871
static VTKM_CONT T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:816
static VTKM_CONT void Schedule(vtkm::cont::DeviceAdapterId devId, Functor functor, vtkm::Id3 rangeMax)
Definition: Algorithm.h:951
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:571
static VTKM_CONT void UpperBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:1118
static VTKM_CONT void UpperBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Definition: Algorithm.h:1099
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, S > &handle, const T &value, const vtkm::Id numValues)
Definition: Algorithm.h:586
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:740
#define VTKM_IS_EXECUTION_OBJECT(execObject)
Checks that the argument is a proper execution object.
Definition: ExecutionObjectBase.h:66
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Compute an inclusive prefix sum operation on the input ArrayHandle.
static VTKM_CONT void CopyIf(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:435
static VTKM_CONT bool CopySubRange(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Definition: Algorithm.h:485
static VTKM_CONT void UpperBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:1108
#define VTKM_CONT
Definition: ExportMacros.h:57
static VTKM_CONT void LowerBounds(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:641
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:825
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:41
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, WordType word, vtkm::Id numBits)
Definition: Algorithm.h:550
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Definition: Algorithm.h:512
static VTKM_CONT vtkm::Id BitFieldToUnorderedSet(const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:400
static VTKM_CONT void CopyIf(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
Definition: Algorithm.h:462
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:844
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:665
Definition: Algorithm.h:385
static VTKM_CONT vtkm::Id CountSetBits(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::BitField &bits)
Definition: Algorithm.h:499
static VTKM_CONT void LowerBounds(const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:648
Definition: DeviceAdapterTag.h:52
static VTKM_CONT vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Returns the total number of "1" bits in BitField.
static VTKM_CONT void Transform(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, StorageT > &input1, const vtkm::cont::ArrayHandle< U, StorageU > &input2, vtkm::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:1037
static VTKM_CONT bool CopySubRange(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Copy the contents of a section of one ArrayHandle to another.
Definition: BitField.h:497
static VTKM_CONT void ReduceByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CKeyIn > &keys, const vtkm::cont::ArrayHandle< U, CValIn > &values, vtkm::cont::ArrayHandle< T, CKeyOut > &keys_output, vtkm::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:697
static VTKM_CONT U Reduce(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:656
static VTKM_CONT void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
static VTKM_CONT void ScanExtended(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:901
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1083
static VTKM_CONT void CopyIf(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Conditionally copy elements in the input array to the output array.
static VTKM_CONT void Schedule(Functor functor, vtkm::Id numInstances)
Schedule many instances of a function to run on concurrent threads.
static VTKM_CONT void ScanExclusiveByKey(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:855
static VTKM_CONT void UpperBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Output is the last index in input for each item in values that wouldn't alter the ordering of input.
static VTKM_CONT void LowerBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
Definition: Algorithm.h:612
static VTKM_CONT void ReduceByKey(const vtkm::cont::ArrayHandle< T, CKeyIn > &keys, const vtkm::cont::ArrayHandle< U, CValIn > &values, vtkm::cont::ArrayHandle< T, CKeyOut > &keys_output, vtkm::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Compute a accumulated sum operation on the input key value pairs.
static VTKM_CONT void LowerBounds(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:631
VTKM_CONT bool IsOnDevice(vtkm::cont::DeviceAdapterId device) const
Returns true if the ArrayHandle's data is on the given device.
Definition: ArrayHandle.h:624
static VTKM_CONT void Sort(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:978
static VTKM_CONT void ScanInclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Compute a segmented inclusive prefix sum operation on the input key value pairs.
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1069
static VTKM_CONT void Synchronize()
Definition: Algorithm.h:1027
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:758
static VTKM_CONT void Schedule(Functor functor, vtkm::Id3 rangeMax)
Definition: Algorithm.h:958
static VTKM_CONT void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1000
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, bool value)
Definition: Algorithm.h:526
static VTKM_CONT void ScanInclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:787
static VTKM_CONT void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, WordType word)
Definition: Algorithm.h:556
static VTKM_CONT void Copy(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:427
VTKM_CONT bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:244
static VTKM_CONT T class BinaryFunctor VTKM_CONT static void ScanExclusiveByKey(const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
#define VTKM_IS_DEVICE_ADAPTER_TAG(tag)
Checks that the argument is a proper device adapter tag.
Definition: DeviceAdapterTag.h:164