VTK-m  2.0
WorkIndex.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_exec_arg_WorkIndex_h
11 #define vtk_m_exec_arg_WorkIndex_h
12 
14 #include <vtkm/exec/arg/Fetch.h>
15 
16 namespace vtkm
17 {
18 namespace exec
19 {
20 namespace arg
21 {
22 
29 {
30 };
31 
40 {
41  // The index does not really matter because the fetch is going to ignore it.
42  // However, it still has to point to a valid parameter in the
43  // ControlSignature because the templating is going to grab a fetch tag
44  // whether we use it or not. 1 should be guaranteed to be valid since you
45  // need at least one argument for the input domain.
46  static constexpr vtkm::IdComponent INDEX = 1;
48 };
49 
50 template <typename FetchTag, typename ExecObjectType>
51 struct Fetch<FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ExecObjectType>
52 {
54 
55  template <typename ThreadIndicesType>
56  VTKM_EXEC vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
57  {
58  return indices.GetThreadIndex();
59  }
60 
61  template <typename ThreadIndicesType>
62  VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
63  {
64  // Store is a no-op.
65  }
66 };
67 }
68 }
69 } // namespace vtkm::exec::arg
70 
71 #endif //vtk_m_exec_arg_WorkIndex_h
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::arg::ExecutionSignatureTagBase
The base class for all tags used in an ExecutionSignature.
Definition: ExecutionSignatureTagBase.h:37
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::exec::arg::Fetch
Class for loading and storing values in thread instance.
Definition: Fetch.h:49
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::exec::arg::Fetch< FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ExecObjectType >::Store
VTKM_EXEC void Store(const ThreadIndicesType &, const ExecObjectType &, const ValueType &) const
Definition: WorkIndex.h:62
ExecutionSignatureTagBase.h
Fetch.h
vtkm::exec::arg::AspectTagWorkIndex
Aspect tag to use for getting the work index.
Definition: WorkIndex.h:28
vtkm::exec::arg::WorkIndex::INDEX
static constexpr vtkm::IdComponent INDEX
Definition: WorkIndex.h:46
vtkm::exec::arg::Fetch< FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ExecObjectType >::ValueType
vtkm::Id ValueType
Definition: WorkIndex.h:53
vtkm::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39
vtkm::exec::arg::Fetch< FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ExecObjectType >::Load
VTKM_EXEC vtkm::Id Load(const ThreadIndicesType &indices, const ExecObjectType &) const
Definition: WorkIndex.h:56