Go to the documentation of this file.
10 #ifndef vtk_m_cont_Algorithm_h
11 #define vtk_m_cont_Algorithm_h
30 template <
typename Device,
typename T>
31 inline auto DoPrepareArgForExec(T&&
object,
vtkm::cont::Token& token, std::true_type) -> decltype(
32 vtkm::cont::internal::CallPrepareForExecution(std::forward<T>(
object), Device{}, token))
35 return vtkm::cont::internal::CallPrepareForExecution(std::forward<T>(
object), Device{}, token);
38 template <
typename Device,
typename T>
41 static_assert(!vtkm::cont::internal::IsExecutionObjectBase<T>::value,
42 "Internal error: failed to detect execution object.");
43 return std::forward<T>(
object);
46 template <
typename Device,
typename T>
48 -> decltype(DoPrepareArgForExec<Device>(std::forward<T>(
object),
50 vtkm::cont::internal::IsExecutionObjectBase<T>{}))
52 return DoPrepareArgForExec<Device>(
53 std::forward<T>(
object), token, vtkm::cont::internal::IsExecutionObjectBase<T>{});
56 struct BitFieldToUnorderedSetFunctor
60 template <
typename Device,
typename... Args>
61 VTKM_CONT bool operator()(Device, Args&&... args)
66 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
73 template <
typename T,
typename S,
typename... Args>
81 template <
typename Device,
typename... Args>
82 VTKM_CONT bool operator()(Device device,
bool useExistingDevice, Args&&... args)
const
85 if (!useExistingDevice || this->InputArrayOnDevice(device, std::forward<Args>(args)...))
89 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
102 template <
typename Device,
typename... Args>
103 VTKM_CONT bool operator()(Device, Args&&... args)
const
108 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
113 struct CopySubRangeFunctor
117 CopySubRangeFunctor()
122 template <
typename Device,
typename... Args>
123 VTKM_CONT bool operator()(Device, Args&&... args)
128 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
133 struct CountSetBitsFunctor
137 template <
typename Device,
typename... Args>
138 VTKM_CONT bool operator()(Device, Args&&... args)
143 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
150 template <
typename Device,
typename... Args>
151 VTKM_CONT bool operator()(Device, Args&&... args)
156 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
161 struct LowerBoundsFunctor
164 template <
typename Device,
typename... Args>
165 VTKM_CONT bool operator()(Device, Args&&... args)
const
170 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
175 template <
typename U>
185 template <
typename Device,
typename... Args>
186 VTKM_CONT bool operator()(Device, Args&&... args)
191 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
196 struct ReduceByKeyFunctor
198 template <
typename Device,
typename... Args>
199 VTKM_CONT bool operator()(Device, Args&&... args)
const
204 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
209 template <
typename U>
210 struct ScanInclusiveResultFunctor
214 ScanInclusiveResultFunctor()
219 template <
typename Device,
typename... Args>
220 VTKM_CONT bool operator()(Device, Args&&... args)
225 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
230 struct ScanInclusiveByKeyFunctor
232 ScanInclusiveByKeyFunctor() {}
234 template <
typename Device,
typename... Args>
235 VTKM_CONT bool operator()(Device, Args&&... args)
const
240 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
245 template <
typename T>
246 struct ScanExclusiveFunctor
250 ScanExclusiveFunctor()
255 template <
typename Device,
typename... Args>
256 VTKM_CONT bool operator()(Device, Args&&... args)
261 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
266 struct ScanExclusiveByKeyFunctor
268 ScanExclusiveByKeyFunctor() {}
270 template <
typename Device,
typename... Args>
271 VTKM_CONT bool operator()(Device, Args&&... args)
const
276 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
281 template <
typename T>
282 struct ScanExtendedFunctor
284 template <
typename Device,
typename... Args>
285 VTKM_CONT bool operator()(Device, Args&&... args)
290 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
295 struct ScheduleFunctor
297 template <
typename Device,
typename... Args>
298 VTKM_CONT bool operator()(Device, Args&&... args)
303 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
310 template <
typename Device,
typename... Args>
311 VTKM_CONT bool operator()(Device, Args&&... args)
const
316 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
321 struct SortByKeyFunctor
323 template <
typename Device,
typename... Args>
324 VTKM_CONT bool operator()(Device, Args&&... args)
const
329 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
334 struct SynchronizeFunctor
336 template <
typename Device>
345 struct TransformFunctor
347 template <
typename Device,
typename... Args>
348 VTKM_CONT bool operator()(Device, Args&&... args)
const
353 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
360 template <
typename Device,
typename... Args>
361 VTKM_CONT bool operator()(Device, Args&&... args)
const
366 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
371 struct UpperBoundsFunctor
373 template <
typename Device,
typename... Args>
374 VTKM_CONT bool operator()(Device, Args&&... args)
const
379 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
389 template <
typename IndicesStorage>
395 detail::BitFieldToUnorderedSetFunctor functor;
397 return functor.Result;
400 template <
typename IndicesStorage>
405 detail::BitFieldToUnorderedSetFunctor functor;
407 return functor.Result;
410 template <
typename T,
typename U,
class CIn,
class COut>
427 template <
typename T,
typename U,
class CIn,
class COut>
435 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
443 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
452 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
457 UnaryPredicate unary_predicate)
460 devId, detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
462 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
466 UnaryPredicate unary_predicate)
472 template <
typename T,
typename U,
class CIn,
class COut>
480 detail::CopySubRangeFunctor functor;
482 devId, functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
483 return functor.valid;
485 template <
typename T,
typename U,
class CIn,
class COut>
495 numberOfElementsToCopy,
503 detail::CountSetBitsFunctor functor;
505 return functor.PopCount;
518 detail::FillFunctor functor;
531 detail::FillFunctor functor;
540 template <
typename WordType>
546 detail::FillFunctor functor;
550 template <
typename WordType>
556 template <
typename WordType>
561 detail::FillFunctor functor;
565 template <
typename WordType>
571 template <
typename T,
typename S>
576 detail::FillFunctor functor;
580 template <
typename T,
typename S>
586 template <
typename T,
typename S>
592 detail::FillFunctor functor;
596 template <
typename T,
typename S>
604 template <
typename T,
class CIn,
class CVal,
class COut>
612 template <
typename T,
class CIn,
class CVal,
class COut>
621 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
626 BinaryCompare binary_compare)
629 devId, detail::LowerBoundsFunctor(), input, values, output, binary_compare);
631 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
635 BinaryCompare binary_compare)
641 template <
class CIn,
class COut>
648 template <
class CIn,
class COut>
656 template <
typename T,
typename U,
class CIn>
661 detail::ReduceFunctor<U> functor;
663 return functor.result;
665 template <
typename T,
typename U,
class CIn>
672 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
676 BinaryFunctor binary_functor)
678 detail::ReduceFunctor<U> functor;
680 return functor.result;
682 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
685 BinaryFunctor binary_functor)
691 template <
typename T,
703 BinaryFunctor binary_functor)
706 detail::ReduceByKeyFunctor(),
713 template <
typename T,
724 BinaryFunctor binary_functor)
731 template <
typename T,
class CIn,
class COut>
736 detail::ScanInclusiveResultFunctor<T> functor;
738 return functor.result;
740 template <
typename T,
class CIn,
class COut>
748 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
752 BinaryFunctor binary_functor)
754 detail::ScanInclusiveResultFunctor<T> functor;
756 return functor.result;
758 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
761 BinaryFunctor binary_functor)
767 template <
typename T,
772 typename BinaryFunctor>
777 BinaryFunctor binary_functor)
780 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
782 template <
typename T,
787 typename BinaryFunctor>
791 BinaryFunctor binary_functor)
798 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
805 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
807 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
816 template <
typename T,
class CIn,
class COut>
821 detail::ScanExclusiveFunctor<T> functor;
823 return functor.result;
825 template <
typename T,
class CIn,
class COut>
833 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
837 BinaryFunctor binaryFunctor,
838 const T& initialValue)
840 detail::ScanExclusiveFunctor<T> functor;
842 return functor.result;
844 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
847 BinaryFunctor binaryFunctor,
848 const T& initialValue)
855 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
860 const U& initialValue,
861 BinaryFunctor binaryFunctor)
864 detail::ScanExclusiveByKeyFunctor(),
871 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
875 const U& initialValue,
876 BinaryFunctor binaryFunctor)
883 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
890 devId, detail::ScanExclusiveByKeyFunctor(), keys, values, output);
892 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
901 template <
typename T,
class CIn,
class COut>
906 detail::ScanExtendedFunctor<T> functor;
909 template <
typename T,
class CIn,
class COut>
917 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
921 BinaryFunctor binaryFunctor,
922 const T& initialValue)
924 detail::ScanExtendedFunctor<T> functor;
927 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
930 BinaryFunctor binaryFunctor,
931 const T& initialValue)
937 template <
typename Functor>
944 template <
typename... Hints,
typename Functor>
951 template <
typename Functor>
958 template <
typename Functor>
965 template <
typename... Hints,
typename Functor>
972 template <
typename Functor>
979 template <
typename T,
class Storage>
985 template <
typename T,
class Storage>
992 template <
typename T,
class Storage,
class BinaryCompare>
995 BinaryCompare binary_compare)
999 template <
typename T,
class Storage,
class BinaryCompare>
1001 BinaryCompare binary_compare)
1007 template <
typename T,
typename U,
class StorageT,
class StorageU>
1014 template <
typename T,
typename U,
class StorageT,
class StorageU>
1021 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1025 BinaryCompare binary_compare)
1029 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1032 BinaryCompare binary_compare)
1045 template <
typename T,
1051 typename BinaryFunctor>
1056 BinaryFunctor binaryFunctor)
1059 devId, detail::TransformFunctor(), input1, input2, output, binaryFunctor);
1061 template <
typename T,
1067 typename BinaryFunctor>
1071 BinaryFunctor binaryFunctor)
1077 template <
typename T,
class Storage>
1083 template <
typename T,
class Storage>
1090 template <
typename T,
class Storage,
class BinaryCompare>
1093 BinaryCompare binary_compare)
1097 template <
typename T,
class Storage,
class BinaryCompare>
1099 BinaryCompare binary_compare)
1105 template <
typename T,
class CIn,
class CVal,
class COut>
1113 template <
typename T,
class CIn,
class CVal,
class COut>
1122 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1127 BinaryCompare binary_compare)
1130 devId, detail::UpperBoundsFunctor(), input, values, output, binary_compare);
1132 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1136 BinaryCompare binary_compare)
1142 template <
class CIn,
class COut>
1149 template <
class CIn,
class COut>
1159 #endif //vtk_m_cont_Algorithm_h
static 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:642
static void UpperBounds(const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:1150
static 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:1123
static 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 void LowerBounds(const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
Definition: Algorithm.h:649
static void Unique(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1091
bool TryExecuteOnDevice(vtkm::cont::DeviceAdapterId devId, Functor &&functor)
Try to execute a functor on a specific device selected at runtime.
Definition: TryExecute.h:178
static void Schedule(Functor functor, vtkm::Id3 rangeMax)
Definition: Algorithm.h:973
static 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:799
static void Unique(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1078
Manages an array-worth of data.
Definition: ArrayHandle.h:300
static 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:473
static void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Fill the BitField with a specific pattern of bits.
static T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:817
static vtkm::Id BitFieldToUnorderedSet(const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:401
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, S > &handle, const T &value, const vtkm::Id numValues)
Definition: Algorithm.h:587
Groups connected points that have the same field value.
Definition: Atomic.h:19
static 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.
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
static void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1084
static 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:613
static 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:698
static T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:845
static void Schedule(Functor functor, vtkm::Id numInstances)
Schedule many instances of a function to run on concurrent threads.
static U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:666
static void SortByKey(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1008
static void Fill(vtkm::cont::BitField &bits, WordType word)
Definition: Algorithm.h:566
static T ScanInclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:732
static 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.
static U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:683
static void SortByKey(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1022
static 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:605
static void Copy(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Copy the contents of one ArrayHandle to another.
static void Schedule(Functor functor, vtkm::Id numInstances)
Definition: Algorithm.h:952
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:572
static 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 void Sort(vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1000
static vtkm::Id BitFieldToUnorderedSet(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:390
static void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1015
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, bool value)
Definition: Algorithm.h:527
static void Unique(vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1098
static void Fill(vtkm::cont::BitField &bits, bool value)
Definition: Algorithm.h:535
static 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:918
static vtkm::Id CountSetBits(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::BitField &bits)
Definition: Algorithm.h:500
static 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:622
static 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:788
static 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:1068
static U Reduce(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:657
static T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:826
static 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 void Schedule(vtkm::cont::internal::HintList< Hints... > hints, Functor functor, vtkm::Id numInstances)
Definition: Algorithm.h:945
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, WordType word)
Definition: Algorithm.h:557
static vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Returns the total number of "1" bits in BitField.
static void Fill(vtkm::cont::BitField &bits, WordType word, vtkm::Id numBits)
Definition: Algorithm.h:551
static void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
static 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:453
static T class BinaryFunctor 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)
static 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:444
static 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:1114
static void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1030
static 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:884
static 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 void Sort(vtkm::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
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)
Definition: Algorithm.h:872
static 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:463
#define VTKM_IS_EXECUTION_OBJECT(execObject)
Checks that the argument is a proper execution object.
Definition: ExecutionObjectBase.h:66
bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:244
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, WordType word, vtkm::Id numBits)
Definition: Algorithm.h:541
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
static 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:893
static void Copy(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:428
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:180
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:41
static 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:1133
static 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:773
static void Sort(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:980
static void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
static void Schedule(vtkm::cont::DeviceAdapterId devId, Functor functor, vtkm::Id3 rangeMax)
Definition: Algorithm.h:959
static bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:411
static 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 void Sort(vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:986
static void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Definition: Algorithm.h:522
static 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: Algorithm.h:386
static 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:486
static void Schedule(vtkm::cont::internal::HintList< Hints... > hints, Functor functor, vtkm::Id3 rangeMax)
Definition: Algorithm.h:966
bool IsOnDevice(vtkm::cont::DeviceAdapterId device) const
Returns true if the ArrayHandle's data is on the given device.
Definition: ArrayHandle.h:649
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
static 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:1143
static 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.
Definition: BitField.h:497
static void Synchronize()
Definition: Algorithm.h:1042
static void Fill(vtkm::cont::ArrayHandle< T, S > &handle, const T &value, const vtkm::Id numValues)
Definition: Algorithm.h:597
static void ScanExtended(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:928
static 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 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:1052
static void Synchronize(vtkm::cont::DeviceAdapterId devId)
Definition: Algorithm.h:1038
static 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:856
static void Fill(vtkm::cont::DeviceAdapterId devId, vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Definition: Algorithm.h:513
static U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
static void ScanExtended(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:902
static void ScanExtended(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:910
static 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:808
static void Fill(vtkm::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:581
static 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:749
static 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:436
static void Schedule(vtkm::cont::DeviceAdapterId devId, Functor functor, vtkm::Id numInstances)
Definition: Algorithm.h:938
static 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:720
static T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:759
static U Reduce(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:673
static 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 T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:741
static 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:834
static 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:632
static 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:1106
static void Sort(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:993
static vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Definition: Algorithm.h:508
#define VTKM_IS_DEVICE_ADAPTER_TAG(tag)
Checks that the argument is a proper device adapter tag.
Definition: DeviceAdapterTag.h:194