VTK-m  2.0
WorkletBase.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_internal_WorkletBase_h
11 #define vtk_m_worklet_internal_WorkletBase_h
12 
14 
15 #include <vtkm/exec/FunctorBase.h>
16 #include <vtkm/exec/arg/BasicArg.h>
26 
42 
43 #include <vtkm/worklet/MaskNone.h>
46 
47 namespace vtkm
48 {
49 namespace worklet
50 {
51 namespace internal
52 {
53 
58 class VTKM_ALWAYS_EXPORT WorkletBase : public vtkm::exec::FunctorBase
59 {
60 public:
61  using _1 = vtkm::placeholders::Arg<1>;
62  using _2 = vtkm::placeholders::Arg<2>;
63  using _3 = vtkm::placeholders::Arg<3>;
64  using _4 = vtkm::placeholders::Arg<4>;
65  using _5 = vtkm::placeholders::Arg<5>;
66  using _6 = vtkm::placeholders::Arg<6>;
67  using _7 = vtkm::placeholders::Arg<7>;
68  using _8 = vtkm::placeholders::Arg<8>;
69  using _9 = vtkm::placeholders::Arg<9>;
70  using _10 = vtkm::placeholders::Arg<10>;
71  using _11 = vtkm::placeholders::Arg<11>;
72  using _12 = vtkm::placeholders::Arg<12>;
73  using _13 = vtkm::placeholders::Arg<13>;
74  using _14 = vtkm::placeholders::Arg<14>;
75  using _15 = vtkm::placeholders::Arg<15>;
76  using _16 = vtkm::placeholders::Arg<16>;
77  using _17 = vtkm::placeholders::Arg<17>;
78  using _18 = vtkm::placeholders::Arg<18>;
79  using _19 = vtkm::placeholders::Arg<19>;
80  using _20 = vtkm::placeholders::Arg<20>;
81 
84  using WorkIndex = vtkm::exec::arg::WorkIndex;
85 
88  using InputIndex = vtkm::exec::arg::InputIndex;
89 
92  using OutputIndex = vtkm::exec::arg::OutputIndex;
93 
96  using ThreadIndices = vtkm::exec::arg::ThreadIndices;
97 
100  using VisitIndex = vtkm::exec::arg::VisitIndex;
101 
105  {
106  // INDEX 0 (which is an invalid parameter index) is reserved to mean the device adapter tag.
107  static constexpr vtkm::IdComponent INDEX = 0;
108  using AspectTag = vtkm::exec::arg::AspectTagDefault;
109  };
110 
112  struct ExecObject : vtkm::cont::arg::ControlSignatureTagBase
113  {
114  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagExecObject;
115  using TransportTag = vtkm::cont::arg::TransportTagExecObject;
116  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
117  };
118 
121  using InputDomain = _1;
122 
126  using ScatterType = vtkm::worklet::ScatterIdentity;
127 
131  using MaskType = vtkm::worklet::MaskNone;
132 
143  struct WholeArrayIn : vtkm::cont::arg::ControlSignatureTagBase
144  {
145  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn;
146  using TransportTag = vtkm::cont::arg::TransportTagWholeArrayIn;
147  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
148  };
149 
161  struct WholeArrayOut : vtkm::cont::arg::ControlSignatureTagBase
162  {
163  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut;
164  using TransportTag = vtkm::cont::arg::TransportTagWholeArrayOut;
165  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
166  };
167 
180  struct WholeArrayInOut : vtkm::cont::arg::ControlSignatureTagBase
181  {
182  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut;
184  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
185  };
186 
199  struct AtomicArrayInOut : vtkm::cont::arg::ControlSignatureTagBase
200  {
201  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagAtomicArray;
202  using TransportTag = vtkm::cont::arg::TransportTagAtomicArray;
203  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
204  };
205 
216  struct BitFieldIn : vtkm::cont::arg::ControlSignatureTagBase
217  {
218  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
219  using TransportTag = vtkm::cont::arg::TransportTagBitFieldIn;
220  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
221  };
222  struct BitFieldOut : vtkm::cont::arg::ControlSignatureTagBase
223  {
224  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
225  using TransportTag = vtkm::cont::arg::TransportTagBitFieldOut;
226  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
227  };
228  struct BitFieldInOut : vtkm::cont::arg::ControlSignatureTagBase
229  {
230  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
231  using TransportTag = vtkm::cont::arg::TransportTagBitFieldInOut;
232  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
233  };
235 
243 
244  using Point = vtkm::TopologyElementTagPoint;
245  using Cell = vtkm::TopologyElementTagCell;
246  using Edge = vtkm::TopologyElementTagEdge;
247  using Face = vtkm::TopologyElementTagFace;
248  template <typename VisitTopology = Cell, typename IncidentTopology = Point>
249  struct WholeCellSetIn : vtkm::cont::arg::ControlSignatureTagBase
250  {
251  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagCellSet;
254  };
255 
262  template <typename OutToInArrayType,
263  typename VisitArrayType,
264  typename ThreadToOutArrayType,
265  typename InputDomainType>
267  const vtkm::Id& threadIndex,
268  const OutToInArrayType& outToIn,
269  const VisitArrayType& visit,
270  const ThreadToOutArrayType& threadToOut,
271  const InputDomainType&) const
272  {
273  vtkm::Id outIndex = threadToOut.Get(threadIndex);
275  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
276  }
277 
284  template <typename OutToInArrayType,
285  typename VisitArrayType,
286  typename ThreadToOutArrayType,
287  typename InputDomainType>
289  vtkm::Id threadIndex1D,
290  const vtkm::Id3& threadIndex3D,
291  const OutToInArrayType& outToIn,
292  const VisitArrayType& visit,
293  const ThreadToOutArrayType& threadToOut,
294  const InputDomainType&) const
295  {
296  vtkm::Id outIndex = threadToOut.Get(threadIndex1D);
298  threadIndex3D, threadIndex1D, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
299  }
300 };
301 }
302 }
303 } // namespace vtkm::worklet::internal
304 
305 #endif //vtk_m_worklet_internal_WorkletBase_h
vtkm::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:34
vtkm::TopologyElementTagFace
A tag used to identify the face elements in a topology.
Definition: TopologyElementTag.h:54
ThreadIndices.h
vtkm::exec::arg::FetchTagExecObject
Fetch tag for execution objects.
Definition: FetchTagExecObject.h:32
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
TransportTagWholeArrayOut.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ThreadIndicesBasic.h
vtkm::exec::arg::ThreadIndicesBasic
Basic container for thread indices in a worklet invocation.
Definition: ThreadIndicesBasic.h:35
TransportTagCellSetIn.h
vtkm::exec::arg::ExecutionSignatureTagBase
The base class for all tags used in an ExecutionSignature.
Definition: ExecutionSignatureTagBase.h:37
TypeCheckTagArrayOut.h
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
ControlSignatureTagBase.h
VisitIndex.h
Placeholders.h
vtkm::TopologyElementTagEdge
A tag used to identify the edge elements in a topology.
Definition: TopologyElementTag.h:44
vtkm::cont::arg::TypeCheckTagArrayOut
The Array type check passes for any object that behaves like an ArrayHandle class and can be passed t...
Definition: TypeCheckTagArrayOut.h:31
vtkm::cont::arg::TransportTagWholeArrayInOut
Transport tag for in-place arrays with random access.
Definition: TransportTagWholeArrayInOut.h:37
vtkm::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:42
vtkm::cont::arg::TransportTagCellSetIn
Transport tag for input arrays.
Definition: TransportTagCellSetIn.h:32
TransportTagExecObject.h
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::cont::arg::TypeCheckTagArrayInOut
The Array type check passes for any object that behaves like an ArrayHandle class and can be passed t...
Definition: TypeCheckTagArrayInOut.h:31
vtkm::cont::arg::TransportTagWholeArrayIn
Transport tag for in-place arrays with random access.
Definition: TransportTagWholeArrayIn.h:35
TypeCheckTagArrayInOut.h
vtkm::cont::arg::TransportTagBitFieldOut
Definition: TransportTagBitField.h:27
vtkm::cont::arg::TransportTagBitFieldInOut
Definition: TransportTagBitField.h:30
vtkm::cont::arg::TransportTagBitFieldIn
Definition: TransportTagBitField.h:24
vtkm::cont::arg::TypeCheckTagArrayIn
The Array type check passes for any object that behaves like an ArrayHandle class and can be passed t...
Definition: TypeCheckTagArrayIn.h:31
FetchTagExecObject.h
vtkm::cont::arg::TypeCheckTagExecObject
The ExecObject type check passes for any object that inherits from ExecutionObjectBase.
Definition: TypeCheckTagExecObject.h:32
InputIndex.h
TransportTagBitField.h
vtkm::cont::arg::TypeCheckTagBitField
Definition: TypeCheckTagBitField.h:26
TypeCheckTagAtomicArray.h
vtkm::cont::arg::TransportTagAtomicArray
Transport tag for in-place arrays with atomic operations.
Definition: TransportTagAtomicArray.h:36
vtkm::cont::arg::TransportTagWholeArrayOut
Transport tag for in-place arrays with random access.
Definition: TransportTagWholeArrayOut.h:37
vtkm::exec::arg::FetchTagWholeCellSetIn
Fetch tag for whole cell sets.
Definition: FetchTagWholeCellSetIn.h:28
vtkm::exec::arg::ThreadIndicesBasic3D
Container for 3D thread indices in a worklet invocation.
Definition: ThreadIndicesBasic3D.h:31
FunctorBase.h
TypeCheckTagArrayIn.h
MaskNone.h
ScatterIdentity.h
ThreadIndicesBasic3D.h
TypeCheckTagExecObject.h
vtkm::exec::arg::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: ThreadIndices.h:41
TransportTagWholeArrayIn.h
vtkm::cont::arg::TransportTagExecObject
Transport tag for execution objects.
Definition: TransportTagExecObject.h:32
TransportTagWholeArrayInOut.h
TransportTagAtomicArray.h
WorkIndex.h
vtkm::exec::FunctorBase
Base class for all user worklets invoked in the execution environment from a call to vtkm::cont::Devi...
Definition: FunctorBase.h:30
BasicArg.h
vtkm::cont::arg::ControlSignatureTagBase
The base class for all tags used in a ControlSignature.
Definition: ControlSignatureTagBase.h:36
vtkm::Vec< vtkm::Id, 3 >
TypeCheckTagBitField.h
vtkm::worklet::MaskNone
Default mask object that does not suppress anything.
Definition: MaskNone.h:27
vtkm::exec::arg::AspectTagDefault
Aspect tag to use for default load/store of data.
Definition: AspectTagDefault.h:22
OutputIndex.h
vtkm::worklet::ScatterIdentity
A scatter that maps input directly to output.
Definition: ScatterIdentity.h:30
vtkm::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:24
FetchTagWholeCellSetIn.h
TypeCheckTagCellSet.h
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
vtkm::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:43
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:42
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
vtkm::cont::arg::TypeCheckTagCellSet
Check for a CellSet-like object.
Definition: TypeCheckTagCellSet.h:26
vtkm::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39
TopologyElementTag.h