Viskores  1.0
DispatcherMapTopology.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_Dispatcher_MapTopology_h
19 #define viskores_worklet_Dispatcher_MapTopology_h
20 
24 
25 namespace viskores
26 {
27 namespace worklet
28 {
29 namespace detail
30 {
31 struct WorkletMapTopologyBase;
32 }
33 class WorkletVisitCellsWithPoints;
34 class WorkletVisitPointsWithCells;
35 
38 template <typename WorkletType>
40  : public viskores::worklet::internal::DispatcherBase<
41  DispatcherMapTopology<WorkletType>,
42  WorkletType,
43  viskores::worklet::detail::WorkletMapTopologyBase>
44 {
45  using Superclass =
46  viskores::worklet::internal::DispatcherBase<DispatcherMapTopology<WorkletType>,
47  WorkletType,
48  viskores::worklet::detail::WorkletMapTopologyBase>;
49  using ScatterType = typename Superclass::ScatterType;
50 
51 public:
52  template <typename... T>
54  : Superclass(std::forward<T>(args)...)
55  {
56  }
57 
58  template <typename Invocation>
59  VISKORES_CONT void DoInvoke(Invocation& invocation) const
60  {
61  using namespace viskores::worklet::internal;
62 
63  // This is the type for the input domain
64  using InputDomainType = typename Invocation::InputDomainType;
65  using SchedulingRangeType = typename WorkletType::VisitTopologyType;
66 
67  // If you get a compile error on this line, then you have tried to use
68  // something that is not a viskores::cont::CellSet as the input domain to a
69  // topology operation (that operates on a cell set connection domain).
70  VISKORES_IS_CELL_SET(InputDomainType);
71 
72  // We can pull the input domain parameter (the data specifying the input
73  // domain) from the invocation object.
74  const auto& inputDomain = invocation.GetInputDomain();
75 
76  // Now that we have the input domain, we can extract the range of the
77  // scheduling and call BadicInvoke.
78  this->BasicInvoke(invocation, SchedulingRange(inputDomain, SchedulingRangeType{}));
79  }
80 };
81 }
82 } // namespace viskores::worklet
83 
84 #endif //viskores_worklet_Dispatcher_MapTopology_h
DispatcherBase.h
viskores::worklet::DispatcherMapTopology::Superclass
viskores::worklet::internal::DispatcherBase< DispatcherMapTopology< WorkletType >, WorkletType, viskores::worklet::detail::WorkletMapTopologyBase > Superclass
Definition: DispatcherMapTopology.h:48
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::DispatcherMapTopology::DispatcherMapTopology
DispatcherMapTopology(T &&... args)
Definition: DispatcherMapTopology.h:53
viskores::worklet::DispatcherMapTopology
Dispatcher for worklets that inherit from WorkletMapTopology.
Definition: DispatcherMapTopology.h:39
viskores::worklet::DispatcherMapTopology::DoInvoke
void DoInvoke(Invocation &invocation) const
Definition: DispatcherMapTopology.h:59
viskores::worklet::DispatcherMapTopology::ScatterType
typename Superclass::ScatterType ScatterType
Definition: DispatcherMapTopology.h:49
VISKORES_IS_CELL_SET
#define VISKORES_IS_CELL_SET(T)
Definition: CellSet.h:97
TopologyElementTag.h