VTK-m  2.2
DispatcherReduceByKey.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_worklet_DispatcherReduceByKey_h
11 #define vtk_m_worklet_DispatcherReduceByKey_h
12 
14 
17 
18 namespace vtkm
19 {
20 namespace worklet
21 {
22 class WorkletReduceByKey;
23 
26 template <typename WorkletType>
28  : public vtkm::worklet::internal::DispatcherBase<DispatcherReduceByKey<WorkletType>,
29  WorkletType,
30  vtkm::worklet::WorkletReduceByKey>
31 {
32  using Superclass = vtkm::worklet::internal::DispatcherBase<DispatcherReduceByKey<WorkletType>,
33  WorkletType,
35  using ScatterType = typename Superclass::ScatterType;
36 
37 public:
38  template <typename... T>
40  : Superclass(std::forward<T>(args)...)
41  {
42  }
43 
44  template <typename Invocation>
45  void DoInvoke(Invocation& invocation) const
46  {
47  using namespace vtkm::worklet::internal;
48 
49  // This is the type for the input domain
50  using InputDomainType = typename Invocation::InputDomainType;
51 
52  // If you get a compile error on this line, then you have tried to use
53  // something other than vtkm::worklet::Keys as the input domain, which
54  // is illegal.
57  "Invalid input domain for WorkletReduceByKey.");
58 
59  // We can pull the input domain parameter (the data specifying the input
60  // domain) from the invocation object.
61  const InputDomainType& inputDomain = invocation.GetInputDomain();
62 
63  // Now that we have the input domain, we can extract the range of the
64  // scheduling and call BasicInvoke.
65  this->BasicInvoke(invocation, SchedulingRange(inputDomain));
66  }
67 };
68 }
69 } // namespace vtkm::worklet
70 
71 #endif //vtk_m_worklet_DispatcherReduceByKey_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
DispatcherBase.h
vtkm::worklet::DispatcherReduceByKey::Superclass
vtkm::worklet::internal::DispatcherBase< DispatcherReduceByKey< WorkletType >, WorkletType, vtkm::worklet::WorkletReduceByKey > Superclass
Definition: DispatcherReduceByKey.h:34
vtkm::worklet::DispatcherReduceByKey::DoInvoke
void DoInvoke(Invocation &invocation) const
Definition: DispatcherReduceByKey.h:45
DeviceAdapter.h
vtkm::worklet::WorkletReduceByKey
Base class for worklets that group elements by keys.
Definition: WorkletReduceByKey.h:54
VTKM_STATIC_ASSERT_MSG
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
vtkm::cont::arg::TypeCheck
Class for checking that a type matches the semantics for an argument.
Definition: TypeCheck.h:34
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::DispatcherReduceByKey::DispatcherReduceByKey
DispatcherReduceByKey(T &&... args)
Definition: DispatcherReduceByKey.h:39
vtkm::worklet::DispatcherReduceByKey
Dispatcher for worklets that inherit from WorkletReduceByKey.
Definition: DispatcherReduceByKey.h:27
TypeCheckTagKeys.h
vtkm::worklet::DispatcherReduceByKey::ScatterType
typename Superclass::ScatterType ScatterType
Definition: DispatcherReduceByKey.h:35