Viskores  1.0
DispatcherCellNeighborhood.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_DispatcherCellNeighborhood_h
19 #define viskores_worklet_DispatcherCellNeighborhood_h
20 
22 
24 
25 namespace viskores
26 {
27 namespace worklet
28 {
29 class WorkletNeighborhood;
30 class WorkletCellNeighborhood;
31 
34 template <typename WorkletType>
36  : public viskores::worklet::internal::DispatcherBase<DispatcherCellNeighborhood<WorkletType>,
37  WorkletType,
38  viskores::worklet::WorkletNeighborhood>
39 {
40  using Superclass =
41  viskores::worklet::internal::DispatcherBase<DispatcherCellNeighborhood<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 that is not a viskores::cont::CellSet as the input domain to a
63  // topology operation (that operates on a cell set connection domain).
64  VISKORES_IS_CELL_SET(InputDomainType);
65 
66  // We can pull the input domain parameter (the data specifying the input
67  // domain) from the invocation object.
68  const InputDomainType& inputDomain = invocation.GetInputDomain();
69  auto inputRange = SchedulingRange(inputDomain, viskores::TopologyElementTagCell{});
70 
71  // This is pretty straightforward dispatch. Once we know the number
72  // of invocations, the superclass can take care of the rest.
73  this->BasicInvoke(invocation, inputRange);
74  }
75 };
76 }
77 } // namespace viskores::worklet
78 
79 #endif //viskores_worklet_DispatcherCellNeighborhood_h
viskores::worklet::WorkletNeighborhood
Definition: WorkletNeighborhood.h:50
viskores::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:32
DispatcherBase.h
viskores::worklet::DispatcherCellNeighborhood::ScatterType
typename Superclass::ScatterType ScatterType
Definition: DispatcherCellNeighborhood.h:44
viskores::worklet::DispatcherCellNeighborhood::DoInvoke
void DoInvoke(Invocation &invocation) const
Definition: DispatcherCellNeighborhood.h:54
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::worklet::DispatcherCellNeighborhood::DispatcherCellNeighborhood
DispatcherCellNeighborhood(T &&... args)
Definition: DispatcherCellNeighborhood.h:48
viskores::worklet::DispatcherCellNeighborhood
Dispatcher for worklets that inherit from WorkletCellNeighborhood.
Definition: DispatcherCellNeighborhood.h:35
viskores::worklet::DispatcherCellNeighborhood::Superclass
viskores::worklet::internal::DispatcherBase< DispatcherCellNeighborhood< WorkletType >, WorkletType, viskores::worklet::WorkletNeighborhood > Superclass
Definition: DispatcherCellNeighborhood.h:43
VISKORES_IS_CELL_SET
#define VISKORES_IS_CELL_SET(T)
Definition: CellSet.h:97