VTK-m  2.2
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 
44 
45 #include <vtkm/worklet/MaskNone.h>
48 
49 namespace vtkm
50 {
51 namespace worklet
52 {
53 namespace internal
54 {
55 
60 class VTKM_ALWAYS_EXPORT WorkletBase : public vtkm::exec::FunctorBase
61 {
62 public:
63  using _1 = vtkm::placeholders::Arg<1>;
64  using _2 = vtkm::placeholders::Arg<2>;
65  using _3 = vtkm::placeholders::Arg<3>;
66  using _4 = vtkm::placeholders::Arg<4>;
67  using _5 = vtkm::placeholders::Arg<5>;
68  using _6 = vtkm::placeholders::Arg<6>;
69  using _7 = vtkm::placeholders::Arg<7>;
70  using _8 = vtkm::placeholders::Arg<8>;
71  using _9 = vtkm::placeholders::Arg<9>;
72  using _10 = vtkm::placeholders::Arg<10>;
73  using _11 = vtkm::placeholders::Arg<11>;
74  using _12 = vtkm::placeholders::Arg<12>;
75  using _13 = vtkm::placeholders::Arg<13>;
76  using _14 = vtkm::placeholders::Arg<14>;
77  using _15 = vtkm::placeholders::Arg<15>;
78  using _16 = vtkm::placeholders::Arg<16>;
79  using _17 = vtkm::placeholders::Arg<17>;
80  using _18 = vtkm::placeholders::Arg<18>;
81  using _19 = vtkm::placeholders::Arg<19>;
82  using _20 = vtkm::placeholders::Arg<20>;
83 
85  using WorkIndex = vtkm::exec::arg::WorkIndex;
86 
88  using InputIndex = vtkm::exec::arg::InputIndex;
89 
91  using OutputIndex = vtkm::exec::arg::OutputIndex;
92 
94  using ThreadIndices = vtkm::exec::arg::ThreadIndices;
95 
97  using VisitIndex = vtkm::exec::arg::VisitIndex;
98 
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 
120  struct ExecObject : vtkm::cont::arg::ControlSignatureTagBase
121  {
122  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagExecObject;
123  using TransportTag = vtkm::cont::arg::TransportTagExecObject;
124  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
125  };
126 
129  using InputDomain = _1;
130 
134  using ScatterType = vtkm::worklet::ScatterIdentity;
135 
139  using MaskType = vtkm::worklet::MaskNone;
140 
144  using Hints = vtkm::cont::internal::HintList<>;
145 
152  struct WholeArrayIn : vtkm::cont::arg::ControlSignatureTagBase
153  {
154  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn;
155  using TransportTag = vtkm::cont::arg::TransportTagWholeArrayIn;
156  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
157  };
158 
166  struct WholeArrayOut : vtkm::cont::arg::ControlSignatureTagBase
167  {
168  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut;
169  using TransportTag = vtkm::cont::arg::TransportTagWholeArrayOut;
170  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
171  };
172 
181  struct WholeArrayInOut : vtkm::cont::arg::ControlSignatureTagBase
182  {
183  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut;
185  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
186  };
187 
196  struct AtomicArrayInOut : vtkm::cont::arg::ControlSignatureTagBase
197  {
198  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagAtomicArray;
199  using TransportTag = vtkm::cont::arg::TransportTagAtomicArray;
200  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
201  };
202 
213  struct BitFieldIn : vtkm::cont::arg::ControlSignatureTagBase
214  {
215  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
216  using TransportTag = vtkm::cont::arg::TransportTagBitFieldIn;
217  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
218  };
219  struct BitFieldOut : vtkm::cont::arg::ControlSignatureTagBase
220  {
221  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
222  using TransportTag = vtkm::cont::arg::TransportTagBitFieldOut;
223  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
224  };
225  struct BitFieldInOut : vtkm::cont::arg::ControlSignatureTagBase
226  {
227  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagBitField;
228  using TransportTag = vtkm::cont::arg::TransportTagBitFieldInOut;
229  using FetchTag = vtkm::exec::arg::FetchTagExecObject;
230  };
232 
233  using Point = vtkm::TopologyElementTagPoint;
234  using Cell = vtkm::TopologyElementTagCell;
235  using Edge = vtkm::TopologyElementTagEdge;
236  using Face = vtkm::TopologyElementTagFace;
237 
244  template <typename VisitTopology = Cell, typename IncidentTopology = Point>
245  struct WholeCellSetIn : vtkm::cont::arg::ControlSignatureTagBase
246  {
247  using TypeCheckTag = vtkm::cont::arg::TypeCheckTagCellSet;
250  };
251 
258  template <typename OutToInArrayType,
259  typename VisitArrayType,
260  typename ThreadToOutArrayType,
261  typename InputDomainType>
263  const vtkm::Id& threadIndex,
264  const OutToInArrayType& outToIn,
265  const VisitArrayType& visit,
266  const ThreadToOutArrayType& threadToOut,
267  const InputDomainType&) const
268  {
269  vtkm::Id outIndex = threadToOut.Get(threadIndex);
271  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
272  }
273 
280  template <typename OutToInArrayType,
281  typename VisitArrayType,
282  typename ThreadToOutArrayType,
283  typename InputDomainType>
285  vtkm::Id threadIndex1D,
286  const vtkm::Id3& threadIndex3D,
287  const OutToInArrayType& outToIn,
288  const VisitArrayType& visit,
289  const ThreadToOutArrayType& threadToOut,
290  const InputDomainType&) const
291  {
292  vtkm::Id outIndex = threadToOut.Get(threadIndex1D);
294  threadIndex3D, threadIndex1D, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
295  }
296 };
297 }
298 }
299 } // namespace vtkm::worklet::internal
300 
301 #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
Base type to use to index small lists.
Definition: Types.h:194
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:44
Hints.h
vtkm::cont::arg::TransportTagCellSetIn
Transport tag for input arrays.
Definition: TransportTagCellSetIn.h:32
TransportTagExecObject.h
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:44
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
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:89
vtkm::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:46
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:43
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