Go to the documentation of this file.
18 #ifndef viskores_cont_Algorithm_h
19 #define viskores_cont_Algorithm_h
38 template <
typename Device,
typename T>
40 -> decltype(viskores::cont::internal::CallPrepareForExecution(std::forward<T>(
object),
45 return viskores::cont::internal::CallPrepareForExecution(
46 std::forward<T>(
object), Device{}, token);
49 template <
typename Device,
typename T>
52 static_assert(!viskores::cont::internal::IsExecutionObjectBase<T>::value,
53 "Internal error: failed to detect execution object.");
54 return std::forward<T>(
object);
57 template <
typename Device,
typename T>
59 -> decltype(DoPrepareArgForExec<Device>(std::forward<T>(
object),
61 viskores::cont::internal::IsExecutionObjectBase<T>{}))
63 return DoPrepareArgForExec<Device>(
64 std::forward<T>(
object), token, viskores::cont::internal::IsExecutionObjectBase<T>{});
67 struct BitFieldToUnorderedSetFunctor
71 template <
typename Device,
typename... Args>
77 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
84 template <
typename T,
typename S,
typename... Args>
92 template <
typename Device,
typename... Args>
93 VISKORES_CONT bool operator()(Device device,
bool useExistingDevice, Args&&... args)
const
96 if (!useExistingDevice || this->InputArrayOnDevice(device, std::forward<Args>(args)...))
100 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
113 template <
typename Device,
typename... Args>
119 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
124 struct CopySubRangeFunctor
128 CopySubRangeFunctor()
133 template <
typename Device,
typename... Args>
139 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
144 struct CountSetBitsFunctor
148 template <
typename Device,
typename... Args>
154 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
161 template <
typename Device,
typename... Args>
167 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
172 struct LowerBoundsFunctor
175 template <
typename Device,
typename... Args>
181 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
186 template <
typename U>
196 template <
typename Device,
typename... Args>
202 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
207 struct ReduceByKeyFunctor
209 template <
typename Device,
typename... Args>
215 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
220 template <
typename U>
221 struct ScanInclusiveResultFunctor
225 ScanInclusiveResultFunctor()
230 template <
typename Device,
typename... Args>
236 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
241 struct ScanInclusiveByKeyFunctor
243 ScanInclusiveByKeyFunctor() {}
245 template <
typename Device,
typename... Args>
251 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
256 template <
typename T>
257 struct ScanExclusiveFunctor
261 ScanExclusiveFunctor()
266 template <
typename Device,
typename... Args>
272 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
277 struct ScanExclusiveByKeyFunctor
279 ScanExclusiveByKeyFunctor() {}
281 template <
typename Device,
typename... Args>
287 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
292 template <
typename T>
293 struct ScanExtendedFunctor
295 template <
typename Device,
typename... Args>
301 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
306 struct ScheduleFunctor
308 template <
typename Device,
typename... Args>
314 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
321 template <
typename Device,
typename... Args>
327 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
332 struct SortByKeyFunctor
334 template <
typename Device,
typename... Args>
340 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
345 struct SynchronizeFunctor
347 template <
typename Device>
356 struct TransformFunctor
358 template <
typename Device,
typename... Args>
364 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
371 template <
typename Device,
typename... Args>
377 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
382 struct UpperBoundsFunctor
384 template <
typename Device,
typename... Args>
390 PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
400 template <
typename IndicesStorage>
406 detail::BitFieldToUnorderedSetFunctor functor;
408 return functor.Result;
411 template <
typename IndicesStorage>
416 detail::BitFieldToUnorderedSetFunctor functor;
418 return functor.Result;
421 template <
typename T,
typename U,
class CIn,
class COut>
438 template <
typename T,
typename U,
class CIn,
class COut>
446 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
454 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut>
463 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
468 UnaryPredicate unary_predicate)
471 devId, detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
473 template <
typename T,
typename U,
class CIn,
class CStencil,
class COut,
class UnaryPredicate>
477 UnaryPredicate unary_predicate)
483 template <
typename T,
typename U,
class CIn,
class COut>
491 detail::CopySubRangeFunctor functor;
493 devId, functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
494 return functor.valid;
496 template <
typename T,
typename U,
class CIn,
class COut>
506 numberOfElementsToCopy,
514 detail::CountSetBitsFunctor functor;
516 return functor.PopCount;
529 detail::FillFunctor functor;
542 detail::FillFunctor functor;
551 template <
typename WordType>
557 detail::FillFunctor functor;
561 template <
typename WordType>
569 template <
typename WordType>
574 detail::FillFunctor functor;
578 template <
typename WordType>
584 template <
typename T,
typename S>
589 detail::FillFunctor functor;
593 template <
typename T,
typename S>
599 template <
typename T,
typename S>
605 detail::FillFunctor functor;
609 template <
typename T,
typename S>
617 template <
typename T,
class CIn,
class CVal,
class COut>
625 template <
typename T,
class CIn,
class CVal,
class COut>
634 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
639 BinaryCompare binary_compare)
642 devId, detail::LowerBoundsFunctor(), input, values, output, binary_compare);
644 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
648 BinaryCompare binary_compare)
654 template <
class CIn,
class COut>
662 template <
class CIn,
class COut>
671 template <
typename T,
typename U,
class CIn>
676 detail::ReduceFunctor<U> functor;
678 return functor.result;
680 template <
typename T,
typename U,
class CIn>
687 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
691 BinaryFunctor binary_functor)
693 detail::ReduceFunctor<U> functor;
695 return functor.result;
697 template <
typename T,
typename U,
class CIn,
class BinaryFunctor>
700 BinaryFunctor binary_functor)
706 template <
typename T,
718 BinaryFunctor binary_functor)
721 detail::ReduceByKeyFunctor(),
728 template <
typename T,
739 BinaryFunctor binary_functor)
750 template <
typename T,
class CIn,
class COut>
755 detail::ScanInclusiveResultFunctor<T> functor;
757 return functor.result;
759 template <
typename T,
class CIn,
class COut>
767 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
771 BinaryFunctor binary_functor)
773 detail::ScanInclusiveResultFunctor<T> functor;
775 return functor.result;
777 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
780 BinaryFunctor binary_functor)
786 template <
typename T,
791 typename BinaryFunctor>
796 BinaryFunctor binary_functor)
799 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
801 template <
typename T,
806 typename BinaryFunctor>
810 BinaryFunctor binary_functor)
817 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
824 devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
826 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut>
835 template <
typename T,
class CIn,
class COut>
840 detail::ScanExclusiveFunctor<T> functor;
842 return functor.result;
844 template <
typename T,
class CIn,
class COut>
852 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
856 BinaryFunctor binaryFunctor,
857 const T& initialValue)
859 detail::ScanExclusiveFunctor<T> functor;
861 return functor.result;
863 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
866 BinaryFunctor binaryFunctor,
867 const T& initialValue)
874 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
879 const U& initialValue,
880 BinaryFunctor binaryFunctor)
883 detail::ScanExclusiveByKeyFunctor(),
890 template <
typename T,
typename U,
typename KIn,
typename VIn,
typename VOut,
class BinaryFunctor>
894 const U& initialValue,
895 BinaryFunctor binaryFunctor)
902 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
909 devId, detail::ScanExclusiveByKeyFunctor(), keys, values, output);
911 template <
typename T,
typename U,
class KIn,
typename VIn,
typename VOut>
920 template <
typename T,
class CIn,
class COut>
925 detail::ScanExtendedFunctor<T> functor;
928 template <
typename T,
class CIn,
class COut>
936 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
940 BinaryFunctor binaryFunctor,
941 const T& initialValue)
943 detail::ScanExtendedFunctor<T> functor;
946 template <
typename T,
class CIn,
class COut,
class BinaryFunctor>
949 BinaryFunctor binaryFunctor,
950 const T& initialValue)
956 template <
typename Functor>
963 template <
typename... Hints,
typename Functor>
970 template <
typename Functor>
977 template <
typename Functor>
984 template <
typename... Hints,
typename Functor>
991 template <
typename Functor>
998 template <
typename T,
class Storage>
1004 template <
typename T,
class Storage>
1011 template <
typename T,
class Storage,
class BinaryCompare>
1014 BinaryCompare binary_compare)
1018 template <
typename T,
class Storage,
class BinaryCompare>
1020 BinaryCompare binary_compare)
1026 template <
typename T,
typename U,
class StorageT,
class StorageU>
1033 template <
typename T,
typename U,
class StorageT,
class StorageU>
1040 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1044 BinaryCompare binary_compare)
1047 devId, detail::SortByKeyFunctor(), keys, values, binary_compare);
1049 template <
typename T,
typename U,
class StorageT,
class StorageU,
class BinaryCompare>
1052 BinaryCompare binary_compare)
1065 template <
typename T,
1071 typename BinaryFunctor>
1076 BinaryFunctor binaryFunctor)
1079 devId, detail::TransformFunctor(), input1, input2, output, binaryFunctor);
1081 template <
typename T,
1087 typename BinaryFunctor>
1091 BinaryFunctor binaryFunctor)
1097 template <
typename T,
class Storage>
1103 template <
typename T,
class Storage>
1110 template <
typename T,
class Storage,
class BinaryCompare>
1113 BinaryCompare binary_compare)
1117 template <
typename T,
class Storage,
class BinaryCompare>
1119 BinaryCompare binary_compare)
1125 template <
typename T,
class CIn,
class CVal,
class COut>
1133 template <
typename T,
class CIn,
class CVal,
class COut>
1142 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1147 BinaryCompare binary_compare)
1150 devId, detail::UpperBoundsFunctor(), input, values, output, binary_compare);
1152 template <
typename T,
class CIn,
class CVal,
class COut,
class BinaryCompare>
1156 BinaryCompare binary_compare)
1162 template <
class CIn,
class COut>
1170 template <
class CIn,
class COut>
1181 #endif //viskores_cont_Algorithm_h
static viskores::Id BitFieldToUnorderedSet(viskores::cont::DeviceAdapterId devId, const viskores::cont::BitField &bits, viskores::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:401
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output)
Conditionally copy elements in the input array to the output array.
static void UpperBounds(const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:1171
static void ScanInclusiveByKey(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &values_output)
Definition: Algorithm.h:818
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:49
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, WordType word)
Definition: Algorithm.h:570
static void Synchronize()
Definition: Algorithm.h:1062
static void Schedule(viskores::cont::DeviceAdapterId devId, Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:957
static viskores::Id CountSetBits(const viskores::cont::BitField &bits)
Definition: Algorithm.h:519
static void Unique(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1098
static void UpperBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Output is the last index in input for each item in values that wouldn't alter the ordering of input.
static void ScanInclusiveByKey(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:792
static bool CopySubRange(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfElementsToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Definition: Algorithm.h:497
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, bool value)
Definition: Algorithm.h:538
static void Synchronize(viskores::cont::DeviceAdapterId devId)
Definition: Algorithm.h:1058
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1019
static void Sort(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:999
Definition: Algorithm.h:397
static void Schedule(viskores::cont::internal::HintList< Hints... > hints, Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:964
static viskores::Id CountSetBits(viskores::cont::DeviceAdapterId devId, const viskores::cont::BitField &bits)
Definition: Algorithm.h:511
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:698
static void Transform(const viskores::cont::ArrayHandle< T, StorageT > &input1, const viskores::cont::ArrayHandle< U, StorageU > &input2, viskores::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:1088
static void ScanExtended(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:947
static U Reduce(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:672
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1050
static void UpperBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:1153
static T ScanExclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:836
Manages an array-worth of data.
Definition: ArrayHandle.h:313
static void Sort(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1012
static void ReduceByKey(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CKeyIn > &keys, const viskores::cont::ArrayHandle< U, CValIn > &values, viskores::cont::ArrayHandle< T, CKeyOut > &keys_output, viskores::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:713
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:194
static void LowerBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:655
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Definition: Algorithm.h:524
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, WordType word, viskores::Id numBits)
Definition: Algorithm.h:552
static void CopyIf(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:447
#define VISKORES_IS_EXECUTION_OBJECT(execObject)
Checks that the argument is a proper execution object.
Definition: ExecutionObjectBase.h:75
static void ScanExtended(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:929
static void Unique(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1111
static void Fill(viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Definition: Algorithm.h:533
static void Fill(viskores::cont::BitField &bits, WordType word, viskores::Id numBits)
Definition: Algorithm.h:562
static void ScanInclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &values_output)
Definition: Algorithm.h:827
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an exclusive prefix sum operation on the input ArrayHandle.
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:760
static void UpperBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Definition: Algorithm.h:1134
static T ScanExclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:853
static void LowerBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:645
static void ScanExtended(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:937
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
Definition: Algorithm.h:474
static void ScanInclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Compute a segmented inclusive prefix sum operation on the input key value pairs.
static void ScanExclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:891
The TypeTraits class provides helpful compile-time information about the basic types used in Viskores...
Definition: TypeTraits.h:69
static bool Copy(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:422
static void Schedule(Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:971
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
static viskores::Id BitFieldToUnorderedSet(const viskores::cont::BitField &bits, viskores::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:412
static bool CopySubRange(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfElementsToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Copy the contents of a section of one ArrayHandle to another.
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
#define VISKORES_CONT
Definition: ExportMacros.h:65
static void CopyIf(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
Definition: Algorithm.h:464
Definition: BitField.h:507
Groups connected points that have the same field value.
Definition: Atomic.h:27
bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:252
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1104
static void ScanExtended(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an extended prefix sum operation on the input ArrayHandle.
static T ScanInclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:768
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Copy the contents of one ArrayHandle to another.
static void UpperBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:1143
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1034
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, S > &handle, const T &value, const viskores::Id numValues)
Definition: Algorithm.h:600
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1005
static U Reduce(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:688
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
static T ScanInclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:751
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an inclusive prefix sum operation on the input ArrayHandle.
static void Schedule(Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:992
static void LowerBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Definition: Algorithm.h:618
static void Transform(const viskores::cont::ArrayHandle< T, StorageT > &input1, const viskores::cont::ArrayHandle< U, StorageU > &input2, viskores::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Apply a given binary operation function element-wise to input arrays.
bool TryExecuteOnDevice(viskores::cont::DeviceAdapterId devId, Functor &&functor)
Try to execute a functor on a specific device selected at runtime.
Definition: TryExecute.h:186
static void LowerBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output, BinaryCompare binary_compare)
Definition: Algorithm.h:635
static void ScanExtended(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:921
static void ScanExclusiveByKey(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:875
static void Fill(viskores::cont::BitField &bits, bool value)
Definition: Algorithm.h:546
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:845
bool IsOnDevice(viskores::cont::DeviceAdapterId device) const
Returns true if the ArrayHandle's data is on the given device.
Definition: ArrayHandle.h:665
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:681
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:455
static void ReduceByKey(const viskores::cont::ArrayHandle< T, CKeyIn > &keys, const viskores::cont::ArrayHandle< U, CValIn > &values, viskores::cont::ArrayHandle< T, CKeyOut > &keys_output, viskores::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Compute a accumulated sum operation on the input key value pairs.
static void ScanInclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:807
static void SortByKey(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1027
static void ReduceByKey(const viskores::cont::ArrayHandle< T, CKeyIn > &keys, const viskores::cont::ArrayHandle< U, CValIn > &values, viskores::cont::ArrayHandle< T, CKeyOut > &keys_output, viskores::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: Algorithm.h:735
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:778
static viskores::Id BitFieldToUnorderedSet(const viskores::cont::BitField &bits, viskores::cont::ArrayHandle< Id, IndicesStorage > &indices)
Create a unique, unsorted list of indices denoting which bits are set in a bitfield.
static void Fill(viskores::cont::BitField &bits, WordType word)
Definition: Algorithm.h:579
static void SortByKey(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1041
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1118
static T class BinaryFunctor static void ScanExclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
static void UpperBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Definition: Algorithm.h:1126
static void ScanExclusiveByKey(const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &output)
Definition: Algorithm.h:912
static void Fill(viskores::cont::ArrayHandle< T, S > &handle, const T &value, const viskores::Id numValues)
Definition: Algorithm.h:610
static void Schedule(viskores::cont::DeviceAdapterId devId, Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:978
#define VISKORES_IS_DEVICE_ADAPTER_TAG(tag)
Checks that the argument is a proper device adapter tag.
Definition: DeviceAdapterTag.h:208
static void LowerBounds(const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:663
static void ScanExclusiveByKey(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, KIn > &keys, const viskores::cont::ArrayHandle< U, VIn > &values, viskores::cont::ArrayHandle< U, VOut > &output)
Definition: Algorithm.h:903
static void LowerBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Definition: Algorithm.h:626
static void Fill(viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Fill the BitField with a specific pattern of bits.
static void Transform(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, StorageT > &input1, const viskores::cont::ArrayHandle< U, StorageU > &input2, viskores::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
Definition: Algorithm.h:1072
static viskores::Id CountSetBits(const viskores::cont::BitField &bits)
Returns the total number of "1" bits in BitField.
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:585
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
static void LowerBounds(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< T, CVal > &values, viskores::cont::ArrayHandle< viskores::Id, COut > &output)
Output is the first index in input for each item in values that wouldn't alter the ordering of input.
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: Algorithm.h:864
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:439
static bool CopySubRange(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfElementsToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Definition: Algorithm.h:484
static void Fill(viskores::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:594
static void Schedule(viskores::cont::internal::HintList< Hints... > hints, Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:985
static void UpperBounds(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:1163
static void Schedule(Functor functor, viskores::Id numInstances)
Schedule many instances of a function to run on concurrent threads.