Viskores  1.0
Algorithm.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_Algorithm_h
19 #define viskores_cont_Algorithm_h
20 
21 #include <viskores/Types.h>
22 
23 #include <viskores/cont/BitField.h>
26 #include <viskores/cont/Token.h>
29 
30 
31 namespace viskores
32 {
33 namespace cont
34 {
36 namespace detail
37 {
38 template <typename Device, typename T>
39 inline auto DoPrepareArgForExec(T&& object, viskores::cont::Token& token, std::true_type)
40  -> decltype(viskores::cont::internal::CallPrepareForExecution(std::forward<T>(object),
41  Device{},
42  token))
43 {
45  return viskores::cont::internal::CallPrepareForExecution(
46  std::forward<T>(object), Device{}, token);
47 }
48 
49 template <typename Device, typename T>
50 inline T&& DoPrepareArgForExec(T&& object, viskores::cont::Token&, std::false_type)
51 {
52  static_assert(!viskores::cont::internal::IsExecutionObjectBase<T>::value,
53  "Internal error: failed to detect execution object.");
54  return std::forward<T>(object);
55 }
56 
57 template <typename Device, typename T>
58 auto PrepareArgForExec(T&& object, viskores::cont::Token& token)
59  -> decltype(DoPrepareArgForExec<Device>(std::forward<T>(object),
60  token,
61  viskores::cont::internal::IsExecutionObjectBase<T>{}))
62 {
63  return DoPrepareArgForExec<Device>(
64  std::forward<T>(object), token, viskores::cont::internal::IsExecutionObjectBase<T>{});
65 }
66 
67 struct BitFieldToUnorderedSetFunctor
68 {
69  viskores::Id Result{ 0 };
70 
71  template <typename Device, typename... Args>
72  VISKORES_CONT bool operator()(Device, Args&&... args)
73  {
77  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
78  return true;
79  }
80 };
81 
82 struct CopyFunctor
83 {
84  template <typename T, typename S, typename... Args>
85  VISKORES_CONT bool InputArrayOnDevice(viskores::cont::DeviceAdapterId device,
87  Args&&...) const
88  {
89  return input.IsOnDevice(device);
90  }
91 
92  template <typename Device, typename... Args>
93  VISKORES_CONT bool operator()(Device device, bool useExistingDevice, Args&&... args) const
94  {
96  if (!useExistingDevice || this->InputArrayOnDevice(device, std::forward<Args>(args)...))
97  {
100  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
101  return true;
102  }
103  else
104  {
105  return false;
106  }
107  }
108 };
109 
110 struct CopyIfFunctor
111 {
112 
113  template <typename Device, typename... Args>
114  VISKORES_CONT bool operator()(Device, Args&&... args) const
115  {
117  viskores::cont::Token token;
119  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
120  return true;
121  }
122 };
123 
124 struct CopySubRangeFunctor
125 {
126  bool valid;
127 
128  CopySubRangeFunctor()
129  : valid(false)
130  {
131  }
132 
133  template <typename Device, typename... Args>
134  VISKORES_CONT bool operator()(Device, Args&&... args)
135  {
137  viskores::cont::Token token;
139  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
140  return true;
141  }
142 };
143 
144 struct CountSetBitsFunctor
145 {
146  viskores::Id PopCount{ 0 };
147 
148  template <typename Device, typename... Args>
149  VISKORES_CONT bool operator()(Device, Args&&... args)
150  {
152  viskores::cont::Token token;
154  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
155  return true;
156  }
157 };
158 
159 struct FillFunctor
160 {
161  template <typename Device, typename... Args>
162  VISKORES_CONT bool operator()(Device, Args&&... args)
163  {
165  viskores::cont::Token token;
167  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
168  return true;
169  }
170 };
171 
172 struct LowerBoundsFunctor
173 {
174 
175  template <typename Device, typename... Args>
176  VISKORES_CONT bool operator()(Device, Args&&... args) const
177  {
179  viskores::cont::Token token;
181  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
182  return true;
183  }
184 };
185 
186 template <typename U>
187 struct ReduceFunctor
188 {
189  U result;
190 
191  ReduceFunctor()
193  {
194  }
195 
196  template <typename Device, typename... Args>
197  VISKORES_CONT bool operator()(Device, Args&&... args)
198  {
200  viskores::cont::Token token;
202  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
203  return true;
204  }
205 };
206 
207 struct ReduceByKeyFunctor
208 {
209  template <typename Device, typename... Args>
210  VISKORES_CONT bool operator()(Device, Args&&... args) const
211  {
213  viskores::cont::Token token;
215  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
216  return true;
217  }
218 };
219 
220 template <typename U>
221 struct ScanInclusiveResultFunctor
222 {
223  U result;
224 
225  ScanInclusiveResultFunctor()
227  {
228  }
229 
230  template <typename Device, typename... Args>
231  VISKORES_CONT bool operator()(Device, Args&&... args)
232  {
234  viskores::cont::Token token;
236  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
237  return true;
238  }
239 };
240 
241 struct ScanInclusiveByKeyFunctor
242 {
243  ScanInclusiveByKeyFunctor() {}
244 
245  template <typename Device, typename... Args>
246  VISKORES_CONT bool operator()(Device, Args&&... args) const
247  {
249  viskores::cont::Token token;
251  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
252  return true;
253  }
254 };
255 
256 template <typename T>
257 struct ScanExclusiveFunctor
258 {
259  T result;
260 
261  ScanExclusiveFunctor()
262  : result(T())
263  {
264  }
265 
266  template <typename Device, typename... Args>
267  VISKORES_CONT bool operator()(Device, Args&&... args)
268  {
270  viskores::cont::Token token;
272  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
273  return true;
274  }
275 };
276 
277 struct ScanExclusiveByKeyFunctor
278 {
279  ScanExclusiveByKeyFunctor() {}
280 
281  template <typename Device, typename... Args>
282  VISKORES_CONT bool operator()(Device, Args&&... args) const
283  {
285  viskores::cont::Token token;
287  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
288  return true;
289  }
290 };
291 
292 template <typename T>
293 struct ScanExtendedFunctor
294 {
295  template <typename Device, typename... Args>
296  VISKORES_CONT bool operator()(Device, Args&&... args)
297  {
299  viskores::cont::Token token;
301  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
302  return true;
303  }
304 };
305 
306 struct ScheduleFunctor
307 {
308  template <typename Device, typename... Args>
309  VISKORES_CONT bool operator()(Device, Args&&... args)
310  {
312  viskores::cont::Token token;
314  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
315  return true;
316  }
317 };
318 
319 struct SortFunctor
320 {
321  template <typename Device, typename... Args>
322  VISKORES_CONT bool operator()(Device, Args&&... args) const
323  {
325  viskores::cont::Token token;
327  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
328  return true;
329  }
330 };
331 
332 struct SortByKeyFunctor
333 {
334  template <typename Device, typename... Args>
335  VISKORES_CONT bool operator()(Device, Args&&... args) const
336  {
338  viskores::cont::Token token;
340  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
341  return true;
342  }
343 };
344 
345 struct SynchronizeFunctor
346 {
347  template <typename Device>
348  VISKORES_CONT bool operator()(Device)
349  {
352  return true;
353  }
354 };
355 
356 struct TransformFunctor
357 {
358  template <typename Device, typename... Args>
359  VISKORES_CONT bool operator()(Device, Args&&... args) const
360  {
362  viskores::cont::Token token;
364  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
365  return true;
366  }
367 };
368 
369 struct UniqueFunctor
370 {
371  template <typename Device, typename... Args>
372  VISKORES_CONT bool operator()(Device, Args&&... args) const
373  {
375  viskores::cont::Token token;
377  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
378  return true;
379  }
380 };
381 
382 struct UpperBoundsFunctor
383 {
384  template <typename Device, typename... Args>
385  VISKORES_CONT bool operator()(Device, Args&&... args) const
386  {
388  viskores::cont::Token token;
390  PrepareArgForExec<Device>(std::forward<Args>(args), token)...);
391  return true;
392  }
393 };
394 } // namespace detail
396 
397 struct Algorithm
398 {
399 
400  template <typename IndicesStorage>
403  const viskores::cont::BitField& bits,
405  {
406  detail::BitFieldToUnorderedSetFunctor functor;
407  viskores::cont::TryExecuteOnDevice(devId, functor, bits, indices);
408  return functor.Result;
409  }
410 
411  template <typename IndicesStorage>
413  const viskores::cont::BitField& bits,
415  {
416  detail::BitFieldToUnorderedSetFunctor functor;
417  viskores::cont::TryExecute(functor, bits, indices);
418  return functor.Result;
419  }
420 
421  template <typename T, typename U, class CIn, class COut>
425  {
426  // If we can use any device, prefer to use source's already loaded device.
428  {
429  bool isCopied =
430  viskores::cont::TryExecuteOnDevice(devId, detail::CopyFunctor(), true, input, output);
431  if (isCopied)
432  {
433  return true;
434  }
435  }
436  return viskores::cont::TryExecuteOnDevice(devId, detail::CopyFunctor(), false, input, output);
437  }
438  template <typename T, typename U, class CIn, class COut>
441  {
442  Copy(viskores::cont::DeviceAdapterTagAny(), input, output);
443  }
444 
445 
446  template <typename T, typename U, class CIn, class CStencil, class COut>
451  {
452  viskores::cont::TryExecuteOnDevice(devId, detail::CopyIfFunctor(), input, stencil, output);
453  }
454  template <typename T, typename U, class CIn, class CStencil, class COut>
458  {
459  CopyIf(viskores::cont::DeviceAdapterTagAny(), input, stencil, output);
460  }
461 
462 
463  template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
468  UnaryPredicate unary_predicate)
469  {
471  devId, detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
472  }
473  template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
477  UnaryPredicate unary_predicate)
478  {
479  CopyIf(viskores::cont::DeviceAdapterTagAny(), input, stencil, output, unary_predicate);
480  }
481 
482 
483  template <typename T, typename U, class CIn, class COut>
486  viskores::Id inputStartIndex,
487  viskores::Id numberOfElementsToCopy,
489  viskores::Id outputIndex = 0)
490  {
491  detail::CopySubRangeFunctor functor;
493  devId, functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
494  return functor.valid;
495  }
496  template <typename T, typename U, class CIn, class COut>
498  viskores::Id inputStartIndex,
499  viskores::Id numberOfElementsToCopy,
501  viskores::Id outputIndex = 0)
502  {
504  input,
505  inputStartIndex,
506  numberOfElementsToCopy,
507  output,
508  outputIndex);
509  }
510 
512  const viskores::cont::BitField& bits)
513  {
514  detail::CountSetBitsFunctor functor;
515  viskores::cont::TryExecuteOnDevice(devId, functor, bits);
516  return functor.PopCount;
517  }
518 
520  {
522  }
523 
526  bool value,
527  viskores::Id numBits)
528  {
529  detail::FillFunctor functor;
530  viskores::cont::TryExecuteOnDevice(devId, functor, bits, value, numBits);
531  }
532 
533  VISKORES_CONT static void Fill(viskores::cont::BitField& bits, bool value, viskores::Id numBits)
534  {
535  Fill(viskores::cont::DeviceAdapterTagAny{}, bits, value, numBits);
536  }
537 
540  bool value)
541  {
542  detail::FillFunctor functor;
543  viskores::cont::TryExecuteOnDevice(devId, functor, bits, value);
544  }
545 
546  VISKORES_CONT static void Fill(viskores::cont::BitField& bits, bool value)
547  {
549  }
550 
551  template <typename WordType>
554  WordType word,
555  viskores::Id numBits)
556  {
557  detail::FillFunctor functor;
558  viskores::cont::TryExecuteOnDevice(devId, functor, bits, word, numBits);
559  }
560 
561  template <typename WordType>
563  WordType word,
564  viskores::Id numBits)
565  {
566  Fill(viskores::cont::DeviceAdapterTagAny{}, bits, word, numBits);
567  }
568 
569  template <typename WordType>
572  WordType word)
573  {
574  detail::FillFunctor functor;
575  viskores::cont::TryExecuteOnDevice(devId, functor, bits, word);
576  }
577 
578  template <typename WordType>
579  VISKORES_CONT static void Fill(viskores::cont::BitField& bits, WordType word)
580  {
582  }
583 
584  template <typename T, typename S>
587  const T& value)
588  {
589  detail::FillFunctor functor;
590  viskores::cont::TryExecuteOnDevice(devId, functor, handle, value);
591  }
592 
593  template <typename T, typename S>
594  VISKORES_CONT static void Fill(viskores::cont::ArrayHandle<T, S>& handle, const T& value)
595  {
596  Fill(viskores::cont::DeviceAdapterTagAny{}, handle, value);
597  }
598 
599  template <typename T, typename S>
602  const T& value,
603  const viskores::Id numValues)
604  {
605  detail::FillFunctor functor;
606  viskores::cont::TryExecuteOnDevice(devId, functor, handle, value, numValues);
607  }
608 
609  template <typename T, typename S>
611  const T& value,
612  const viskores::Id numValues)
613  {
614  Fill(viskores::cont::DeviceAdapterTagAny{}, handle, value, numValues);
615  }
616 
617  template <typename T, class CIn, class CVal, class COut>
622  {
623  viskores::cont::TryExecuteOnDevice(devId, detail::LowerBoundsFunctor(), input, values, output);
624  }
625  template <typename T, class CIn, class CVal, class COut>
629  {
630  LowerBounds(viskores::cont::DeviceAdapterTagAny(), input, values, output);
631  }
632 
633 
634  template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
639  BinaryCompare binary_compare)
640  {
642  devId, detail::LowerBoundsFunctor(), input, values, output, binary_compare);
643  }
644  template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
648  BinaryCompare binary_compare)
649  {
650  LowerBounds(viskores::cont::DeviceAdapterTagAny(), input, values, output, binary_compare);
651  }
652 
653 
654  template <class CIn, class COut>
659  {
660  viskores::cont::TryExecuteOnDevice(devId, detail::LowerBoundsFunctor(), input, values_output);
661  }
662  template <class CIn, class COut>
666  {
667  LowerBounds(viskores::cont::DeviceAdapterTagAny(), input, values_output);
668  }
669 
670 
671  template <typename T, typename U, class CIn>
674  U initialValue)
675  {
676  detail::ReduceFunctor<U> functor;
677  viskores::cont::TryExecuteOnDevice(devId, functor, input, initialValue);
678  return functor.result;
679  }
680  template <typename T, typename U, class CIn>
681  VISKORES_CONT static U Reduce(const viskores::cont::ArrayHandle<T, CIn>& input, U initialValue)
682  {
683  return Reduce(viskores::cont::DeviceAdapterTagAny(), input, initialValue);
684  }
685 
686 
687  template <typename T, typename U, class CIn, class BinaryFunctor>
690  U initialValue,
691  BinaryFunctor binary_functor)
692  {
693  detail::ReduceFunctor<U> functor;
694  viskores::cont::TryExecuteOnDevice(devId, functor, input, initialValue, binary_functor);
695  return functor.result;
696  }
697  template <typename T, typename U, class CIn, class BinaryFunctor>
699  U initialValue,
700  BinaryFunctor binary_functor)
701  {
702  return Reduce(viskores::cont::DeviceAdapterTagAny(), input, initialValue, binary_functor);
703  }
704 
705 
706  template <typename T,
707  typename U,
708  class CKeyIn,
709  class CValIn,
710  class CKeyOut,
711  class CValOut,
712  class BinaryFunctor>
718  BinaryFunctor binary_functor)
719  {
721  detail::ReduceByKeyFunctor(),
722  keys,
723  values,
724  keys_output,
725  values_output,
726  binary_functor);
727  }
728  template <typename T,
729  typename U,
730  class CKeyIn,
731  class CValIn,
732  class CKeyOut,
733  class CValOut,
734  class BinaryFunctor>
739  BinaryFunctor binary_functor)
740  {
742  keys,
743  values,
744  keys_output,
745  values_output,
746  binary_functor);
747  }
748 
749 
750  template <typename T, class CIn, class COut>
754  {
755  detail::ScanInclusiveResultFunctor<T> functor;
756  viskores::cont::TryExecuteOnDevice(devId, functor, input, output);
757  return functor.result;
758  }
759  template <typename T, class CIn, class COut>
762  {
763  return ScanInclusive(viskores::cont::DeviceAdapterTagAny(), input, output);
764  }
765 
766 
767  template <typename T, class CIn, class COut, class BinaryFunctor>
771  BinaryFunctor binary_functor)
772  {
773  detail::ScanInclusiveResultFunctor<T> functor;
774  viskores::cont::TryExecuteOnDevice(devId, functor, input, output, binary_functor);
775  return functor.result;
776  }
777  template <typename T, class CIn, class COut, class BinaryFunctor>
780  BinaryFunctor binary_functor)
781  {
782  return ScanInclusive(viskores::cont::DeviceAdapterTagAny(), input, output, binary_functor);
783  }
784 
785 
786  template <typename T,
787  typename U,
788  typename KIn,
789  typename VIn,
790  typename VOut,
791  typename BinaryFunctor>
796  BinaryFunctor binary_functor)
797  {
799  devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
800  }
801  template <typename T,
802  typename U,
803  typename KIn,
804  typename VIn,
805  typename VOut,
806  typename BinaryFunctor>
810  BinaryFunctor binary_functor)
811  {
813  viskores::cont::DeviceAdapterTagAny(), keys, values, values_output, binary_functor);
814  }
815 
816 
817  template <typename T, typename U, typename KIn, typename VIn, typename VOut>
822  {
824  devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
825  }
826  template <typename T, typename U, typename KIn, typename VIn, typename VOut>
830  {
831  ScanInclusiveByKey(viskores::cont::DeviceAdapterTagAny(), keys, values, values_output);
832  }
833 
834 
835  template <typename T, class CIn, class COut>
839  {
840  detail::ScanExclusiveFunctor<T> functor;
841  viskores::cont::TryExecuteOnDevice(devId, functor, input, output);
842  return functor.result;
843  }
844  template <typename T, class CIn, class COut>
847  {
848  return ScanExclusive(viskores::cont::DeviceAdapterTagAny(), input, output);
849  }
850 
851 
852  template <typename T, class CIn, class COut, class BinaryFunctor>
856  BinaryFunctor binaryFunctor,
857  const T& initialValue)
858  {
859  detail::ScanExclusiveFunctor<T> functor;
860  viskores::cont::TryExecuteOnDevice(devId, functor, input, output, binaryFunctor, initialValue);
861  return functor.result;
862  }
863  template <typename T, class CIn, class COut, class BinaryFunctor>
866  BinaryFunctor binaryFunctor,
867  const T& initialValue)
868  {
869  return ScanExclusive(
870  viskores::cont::DeviceAdapterTagAny(), input, output, binaryFunctor, initialValue);
871  }
872 
873 
874  template <typename T, typename U, typename KIn, typename VIn, typename VOut, class BinaryFunctor>
879  const U& initialValue,
880  BinaryFunctor binaryFunctor)
881  {
883  detail::ScanExclusiveByKeyFunctor(),
884  keys,
885  values,
886  output,
887  initialValue,
888  binaryFunctor);
889  }
890  template <typename T, typename U, typename KIn, typename VIn, typename VOut, class BinaryFunctor>
894  const U& initialValue,
895  BinaryFunctor binaryFunctor)
896  {
898  viskores::cont::DeviceAdapterTagAny(), keys, values, output, initialValue, binaryFunctor);
899  }
900 
901 
902  template <typename T, typename U, class KIn, typename VIn, typename VOut>
907  {
909  devId, detail::ScanExclusiveByKeyFunctor(), keys, values, output);
910  }
911  template <typename T, typename U, class KIn, typename VIn, typename VOut>
915  {
917  }
918 
919 
920  template <typename T, class CIn, class COut>
924  {
925  detail::ScanExtendedFunctor<T> functor;
926  viskores::cont::TryExecuteOnDevice(devId, functor, input, output);
927  }
928  template <typename T, class CIn, class COut>
931  {
933  }
934 
935 
936  template <typename T, class CIn, class COut, class BinaryFunctor>
940  BinaryFunctor binaryFunctor,
941  const T& initialValue)
942  {
943  detail::ScanExtendedFunctor<T> functor;
944  viskores::cont::TryExecuteOnDevice(devId, functor, input, output, binaryFunctor, initialValue);
945  }
946  template <typename T, class CIn, class COut, class BinaryFunctor>
949  BinaryFunctor binaryFunctor,
950  const T& initialValue)
951  {
952  ScanExtended(viskores::cont::DeviceAdapterTagAny(), input, output, binaryFunctor, initialValue);
953  }
954 
955  // Should this be deprecated in favor of `RuntimeDeviceTracker`?
956  template <typename Functor>
958  Functor functor,
959  viskores::Id numInstances)
960  {
961  viskores::cont::TryExecuteOnDevice(devId, detail::ScheduleFunctor{}, functor, numInstances);
962  }
963  template <typename... Hints, typename Functor>
964  VISKORES_CONT static void Schedule(viskores::cont::internal::HintList<Hints...> hints,
965  Functor functor,
966  viskores::Id numInstances)
967  {
968  viskores::cont::TryExecute(detail::ScheduleFunctor{}, hints, functor, numInstances);
969  }
970  template <typename Functor>
971  VISKORES_CONT static void Schedule(Functor functor, viskores::Id numInstances)
972  {
973  Schedule(viskores::cont::DeviceAdapterTagAny{}, functor, numInstances);
974  }
975 
976 
977  template <typename Functor>
979  Functor functor,
980  viskores::Id3 rangeMax)
981  {
982  viskores::cont::TryExecuteOnDevice(devId, detail::ScheduleFunctor(), functor, rangeMax);
983  }
984  template <typename... Hints, typename Functor>
985  VISKORES_CONT static void Schedule(viskores::cont::internal::HintList<Hints...> hints,
986  Functor functor,
987  viskores::Id3 rangeMax)
988  {
989  viskores::cont::TryExecute(detail::ScheduleFunctor{}, hints, functor, rangeMax);
990  }
991  template <typename Functor>
992  VISKORES_CONT static void Schedule(Functor functor, viskores::Id3 rangeMax)
993  {
994  Schedule(viskores::cont::DeviceAdapterTagAny(), functor, rangeMax);
995  }
996 
997 
998  template <typename T, class Storage>
1001  {
1002  viskores::cont::TryExecuteOnDevice(devId, detail::SortFunctor(), values);
1003  }
1004  template <typename T, class Storage>
1006  {
1008  }
1009 
1010 
1011  template <typename T, class Storage, class BinaryCompare>
1014  BinaryCompare binary_compare)
1015  {
1016  viskores::cont::TryExecuteOnDevice(devId, detail::SortFunctor(), values, binary_compare);
1017  }
1018  template <typename T, class Storage, class BinaryCompare>
1020  BinaryCompare binary_compare)
1021  {
1022  Sort(viskores::cont::DeviceAdapterTagAny(), values, binary_compare);
1023  }
1024 
1025 
1026  template <typename T, typename U, class StorageT, class StorageU>
1030  {
1031  viskores::cont::TryExecuteOnDevice(devId, detail::SortByKeyFunctor(), keys, values);
1032  }
1033  template <typename T, typename U, class StorageT, class StorageU>
1036  {
1038  }
1039 
1040  template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
1044  BinaryCompare binary_compare)
1045  {
1047  devId, detail::SortByKeyFunctor(), keys, values, binary_compare);
1048  }
1049  template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
1052  BinaryCompare binary_compare)
1053  {
1054  SortByKey(viskores::cont::DeviceAdapterTagAny(), keys, values, binary_compare);
1055  }
1056 
1057 
1059  {
1060  viskores::cont::TryExecuteOnDevice(devId, detail::SynchronizeFunctor());
1061  }
1063 
1064 
1065  template <typename T,
1066  typename U,
1067  typename V,
1068  typename StorageT,
1069  typename StorageU,
1070  typename StorageV,
1071  typename BinaryFunctor>
1076  BinaryFunctor binaryFunctor)
1077  {
1079  devId, detail::TransformFunctor(), input1, input2, output, binaryFunctor);
1080  }
1081  template <typename T,
1082  typename U,
1083  typename V,
1084  typename StorageT,
1085  typename StorageU,
1086  typename StorageV,
1087  typename BinaryFunctor>
1091  BinaryFunctor binaryFunctor)
1092  {
1093  Transform(viskores::cont::DeviceAdapterTagAny(), input1, input2, output, binaryFunctor);
1094  }
1095 
1096 
1097  template <typename T, class Storage>
1100  {
1101  viskores::cont::TryExecuteOnDevice(devId, detail::UniqueFunctor(), values);
1102  }
1103  template <typename T, class Storage>
1105  {
1107  }
1108 
1109 
1110  template <typename T, class Storage, class BinaryCompare>
1113  BinaryCompare binary_compare)
1114  {
1115  viskores::cont::TryExecuteOnDevice(devId, detail::UniqueFunctor(), values, binary_compare);
1116  }
1117  template <typename T, class Storage, class BinaryCompare>
1119  BinaryCompare binary_compare)
1120  {
1121  Unique(viskores::cont::DeviceAdapterTagAny(), values, binary_compare);
1122  }
1123 
1124 
1125  template <typename T, class CIn, class CVal, class COut>
1130  {
1131  viskores::cont::TryExecuteOnDevice(devId, detail::UpperBoundsFunctor(), input, values, output);
1132  }
1133  template <typename T, class CIn, class CVal, class COut>
1137  {
1138  UpperBounds(viskores::cont::DeviceAdapterTagAny(), input, values, output);
1139  }
1140 
1141 
1142  template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
1147  BinaryCompare binary_compare)
1148  {
1150  devId, detail::UpperBoundsFunctor(), input, values, output, binary_compare);
1151  }
1152  template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
1156  BinaryCompare binary_compare)
1157  {
1158  UpperBounds(viskores::cont::DeviceAdapterTagAny(), input, values, output, binary_compare);
1159  }
1160 
1161 
1162  template <class CIn, class COut>
1167  {
1168  viskores::cont::TryExecuteOnDevice(devId, detail::UpperBoundsFunctor(), input, values_output);
1169  }
1170  template <class CIn, class COut>
1174  {
1175  UpperBounds(viskores::cont::DeviceAdapterTagAny(), input, values_output);
1176  }
1177 };
1178 }
1179 } // namespace viskores::cont
1180 
1181 #endif //viskores_cont_Algorithm_h
viskores::cont::Algorithm::BitFieldToUnorderedSet
static viskores::Id BitFieldToUnorderedSet(viskores::cont::DeviceAdapterId devId, const viskores::cont::BitField &bits, viskores::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:401
viskores::cont::DeviceAdapterAlgorithm::CopyIf
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.
viskores::cont::Algorithm::UpperBounds
static void UpperBounds(const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:1171
viskores::cont::Algorithm::ScanInclusiveByKey
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
viskores::cont::DeviceAdapterAlgorithm
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:49
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, WordType word)
Definition: Algorithm.h:570
viskores::cont::Algorithm::Synchronize
static void Synchronize()
Definition: Algorithm.h:1062
viskores::cont::Algorithm::Schedule
static void Schedule(viskores::cont::DeviceAdapterId devId, Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:957
viskores::cont::Algorithm::CountSetBits
static viskores::Id CountSetBits(const viskores::cont::BitField &bits)
Definition: Algorithm.h:519
viskores::cont::Algorithm::Unique
static void Unique(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1098
viskores::cont::DeviceAdapterAlgorithm::UpperBounds
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.
viskores::cont::Algorithm::ScanInclusiveByKey
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
viskores::cont::Algorithm::CopySubRange
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
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, bool value)
Definition: Algorithm.h:538
Types.h
viskores::cont::Algorithm::Synchronize
static void Synchronize(viskores::cont::DeviceAdapterId devId)
Definition: Algorithm.h:1058
viskores::cont::Algorithm::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1019
viskores::cont::Algorithm::Sort
static void Sort(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:999
viskores::cont::Algorithm
Definition: Algorithm.h:397
BitField.h
viskores::cont::Algorithm::Schedule
static void Schedule(viskores::cont::internal::HintList< Hints... > hints, Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:964
viskores::cont::Algorithm::CountSetBits
static viskores::Id CountSetBits(viskores::cont::DeviceAdapterId devId, const viskores::cont::BitField &bits)
Definition: Algorithm.h:511
viskores::cont::Algorithm::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:698
viskores::cont::Algorithm::Transform
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
viskores::cont::Algorithm::ScanExtended
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
viskores::cont::Algorithm::Reduce
static U Reduce(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:672
viskores::cont::Algorithm::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1050
viskores::cont::Algorithm::UpperBounds
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
viskores::cont::Algorithm::ScanExclusive
static T ScanExclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:836
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::cont::Algorithm::Sort
static void Sort(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1012
viskores::cont::Algorithm::ReduceByKey
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
viskores::cont::DeviceAdapterTagAny
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:194
viskores::cont::Algorithm::LowerBounds
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
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Definition: Algorithm.h:524
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::BitField &bits, WordType word, viskores::Id numBits)
Definition: Algorithm.h:552
viskores::cont::Algorithm::CopyIf
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
VISKORES_IS_EXECUTION_OBJECT
#define VISKORES_IS_EXECUTION_OBJECT(execObject)
Checks that the argument is a proper execution object.
Definition: ExecutionObjectBase.h:75
viskores::cont::Algorithm::ScanExtended
static void ScanExtended(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:929
viskores::cont::Algorithm::Unique
static void Unique(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1111
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Definition: Algorithm.h:533
Hints.h
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::BitField &bits, WordType word, viskores::Id numBits)
Definition: Algorithm.h:562
viskores::cont::Algorithm::ScanInclusiveByKey
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
viskores::cont::DeviceAdapterAlgorithm::ScanExclusive
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.
viskores::cont::DeviceAdapterAlgorithm::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
viskores::cont::DeviceAdapterAlgorithm::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
viskores::cont::Algorithm::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:760
viskores::cont::Algorithm::UpperBounds
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
viskores::cont::Algorithm::ScanExclusive
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
viskores::cont::Algorithm::LowerBounds
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
viskores::cont::Algorithm::ScanExtended
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
viskores::cont::Algorithm::CopyIf
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
viskores::cont::DeviceAdapterAlgorithm::ScanInclusiveByKey
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.
DeviceAdapter.h
viskores::cont::Algorithm::ScanExclusiveByKey
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
viskores::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in Viskores...
Definition: TypeTraits.h:69
viskores::cont::Algorithm::Copy
static bool Copy(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:422
viskores::cont::Algorithm::Schedule
static void Schedule(Functor functor, viskores::Id numInstances)
Definition: Algorithm.h:971
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::cont::Algorithm::BitFieldToUnorderedSet
static viskores::Id BitFieldToUnorderedSet(const viskores::cont::BitField &bits, viskores::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: Algorithm.h:412
viskores::cont::DeviceAdapterAlgorithm::CopySubRange
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.
viskores::cont::DeviceAdapterAlgorithm::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::cont::Algorithm::CopyIf
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
viskores::cont::BitField
Definition: BitField.h:507
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::TryExecute
bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:252
viskores::cont::Algorithm::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1104
viskores::cont::DeviceAdapterAlgorithm::ScanExtended
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.
viskores::cont::Algorithm::ScanInclusive
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
TryExecute.h
viskores::cont::DeviceAdapterAlgorithm::Copy
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Copy the contents of one ArrayHandle to another.
viskores::cont::Algorithm::UpperBounds
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
viskores::cont::Algorithm::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1034
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, S > &handle, const T &value, const viskores::Id numValues)
Definition: Algorithm.h:600
viskores::cont::Algorithm::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:1005
viskores::cont::Algorithm::Reduce
static U Reduce(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: Algorithm.h:688
viskores::cont::DeviceAdapterAlgorithm::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
viskores::cont::Algorithm::ScanInclusive
static T ScanInclusive(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:751
viskores::cont::DeviceAdapterAlgorithm::ScanInclusive
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.
viskores::cont::Algorithm::Schedule
static void Schedule(Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:992
viskores::cont::Algorithm::LowerBounds
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
viskores::cont::DeviceAdapterAlgorithm::Transform
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.
viskores::cont::TryExecuteOnDevice
bool TryExecuteOnDevice(viskores::cont::DeviceAdapterId devId, Functor &&functor)
Try to execute a functor on a specific device selected at runtime.
Definition: TryExecute.h:186
viskores::cont::Algorithm::LowerBounds
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
viskores::cont::Algorithm::ScanExtended
static void ScanExtended(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:921
viskores::cont::Algorithm::ScanExclusiveByKey
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
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::BitField &bits, bool value)
Definition: Algorithm.h:546
viskores::cont::Algorithm::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:845
viskores::cont::ArrayHandle::IsOnDevice
bool IsOnDevice(viskores::cont::DeviceAdapterId device) const
Returns true if the ArrayHandle's data is on the given device.
Definition: ArrayHandle.h:665
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::cont::Algorithm::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: Algorithm.h:681
viskores::cont::Algorithm::CopyIf
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
viskores::cont::DeviceAdapterAlgorithm::ReduceByKey
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.
viskores::cont::Algorithm::ScanInclusiveByKey
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
viskores::cont::Algorithm::SortByKey
static void SortByKey(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: Algorithm.h:1027
viskores::cont::Algorithm::ReduceByKey
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
viskores::cont::Algorithm::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: Algorithm.h:778
viskores::cont::DeviceAdapterAlgorithm::BitFieldToUnorderedSet
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.
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::BitField &bits, WordType word)
Definition: Algorithm.h:579
viskores::cont::Algorithm::SortByKey
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
viskores::cont::Algorithm::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: Algorithm.h:1118
viskores::cont::DeviceAdapterAlgorithm::ScanExclusiveByKey
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)
viskores::cont::Algorithm::UpperBounds
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
viskores::cont::Algorithm::ScanExclusiveByKey
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
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::ArrayHandle< T, S > &handle, const T &value, const viskores::Id numValues)
Definition: Algorithm.h:610
viskores::cont::Algorithm::Schedule
static void Schedule(viskores::cont::DeviceAdapterId devId, Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:978
VISKORES_IS_DEVICE_ADAPTER_TAG
#define VISKORES_IS_DEVICE_ADAPTER_TAG(tag)
Checks that the argument is a proper device adapter tag.
Definition: DeviceAdapterTag.h:208
viskores::cont::Algorithm::LowerBounds
static void LowerBounds(const viskores::cont::ArrayHandle< viskores::Id, CIn > &input, viskores::cont::ArrayHandle< viskores::Id, COut > &values_output)
Definition: Algorithm.h:663
viskores::cont::Algorithm::ScanExclusiveByKey
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
viskores::cont::Algorithm::LowerBounds
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
ExecutionObjectBase.h
viskores::cont::DeviceAdapterAlgorithm::Fill
static void Fill(viskores::cont::BitField &bits, bool value, viskores::Id numBits)
Fill the BitField with a specific pattern of bits.
Token.h
viskores::cont::Algorithm::Transform
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
viskores::cont::DeviceAdapterAlgorithm::CountSetBits
static viskores::Id CountSetBits(const viskores::cont::BitField &bits)
Returns the total number of "1" bits in BitField.
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::DeviceAdapterId devId, viskores::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:585
viskores::Vec< viskores::Id, 3 >
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::DeviceAdapterAlgorithm::LowerBounds
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.
viskores::cont::Algorithm::ScanExclusive
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
viskores::cont::Algorithm::Copy
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:439
viskores::cont::Algorithm::CopySubRange
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
viskores::cont::Algorithm::Fill
static void Fill(viskores::cont::ArrayHandle< T, S > &handle, const T &value)
Definition: Algorithm.h:594
viskores::cont::Algorithm::Schedule
static void Schedule(viskores::cont::internal::HintList< Hints... > hints, Functor functor, viskores::Id3 rangeMax)
Definition: Algorithm.h:985
viskores::cont::Algorithm::UpperBounds
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
viskores::cont::DeviceAdapterAlgorithm::Schedule
static void Schedule(Functor functor, viskores::Id numInstances)
Schedule many instances of a function to run on concurrent threads.