Viskores  1.0
DispatcherReduceByKey.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_worklet_DispatcherReduceByKey_h
19 #define viskores_worklet_DispatcherReduceByKey_h
20 
22 
25 
26 namespace viskores
27 {
28 namespace worklet
29 {
30 class WorkletReduceByKey;
31 
34 template <typename WorkletType>
36  : public viskores::worklet::internal::DispatcherBase<DispatcherReduceByKey<WorkletType>,
37  WorkletType,
38  viskores::worklet::WorkletReduceByKey>
39 {
40  using Superclass =
41  viskores::worklet::internal::DispatcherBase<DispatcherReduceByKey<WorkletType>,
42  WorkletType,
44  using ScatterType = typename Superclass::ScatterType;
45 
46 public:
47  template <typename... T>
49  : Superclass(std::forward<T>(args)...)
50  {
51  }
52 
53  template <typename Invocation>
54  void DoInvoke(Invocation& invocation) const
55  {
56  using namespace viskores::worklet::internal;
57 
58  // This is the type for the input domain
59  using InputDomainType = typename Invocation::InputDomainType;
60 
61  // If you get a compile error on this line, then you have tried to use
62  // something other than viskores::worklet::Keys as the input domain, which
63  // is illegal.
66  InputDomainType>::value),
67  "Invalid input domain for WorkletReduceByKey.");
68 
69  // We can pull the input domain parameter (the data specifying the input
70  // domain) from the invocation object.
71  const InputDomainType& inputDomain = invocation.GetInputDomain();
72 
73  // Now that we have the input domain, we can extract the range of the
74  // scheduling and call BasicInvoke.
75  this->BasicInvoke(invocation, SchedulingRange(inputDomain));
76  }
77 };
78 }
79 } // namespace viskores::worklet
80 
81 #endif //viskores_worklet_DispatcherReduceByKey_h
viskores::worklet::DispatcherReduceByKey::Superclass
viskores::worklet::internal::DispatcherBase< DispatcherReduceByKey< WorkletType >, WorkletType, viskores::worklet::WorkletReduceByKey > Superclass
Definition: DispatcherReduceByKey.h:43
viskores::worklet::DispatcherReduceByKey::DoInvoke
void DoInvoke(Invocation &invocation) const
Definition: DispatcherReduceByKey.h:54
DispatcherBase.h
viskores::worklet::DispatcherReduceByKey::ScatterType
typename Superclass::ScatterType ScatterType
Definition: DispatcherReduceByKey.h:44
viskores::worklet::DispatcherReduceByKey
Dispatcher for worklets that inherit from WorkletReduceByKey.
Definition: DispatcherReduceByKey.h:35
DeviceAdapter.h
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_STATIC_ASSERT_MSG
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
viskores::worklet::DispatcherReduceByKey::DispatcherReduceByKey
DispatcherReduceByKey(T &&... args)
Definition: DispatcherReduceByKey.h:48
viskores::cont::arg::TypeCheckTagKeys
Check for a Keys object.
Definition: TypeCheckTagKeys.h:32
TypeCheckTagKeys.h
viskores::worklet::WorkletReduceByKey
Base class for worklets that group elements by keys.
Definition: WorkletReduceByKey.h:62
viskores::cont::arg::TypeCheck
Class for checking that a type matches the semantics for an argument.
Definition: TypeCheck.h:42