VTK-m  2.0
WorkletPointNeighborhood.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_WorkletPointNeighborhood_h
11 #define vtk_m_worklet_WorkletPointNeighborhood_h
12 
21 
22 namespace vtkm
23 {
24 namespace worklet
25 {
26 
28 {
29 public:
30  template <typename Worklet>
32 
36  template <typename OutToInArrayType,
37  typename VisitArrayType,
38  typename ThreadToOutArrayType,
39  vtkm::IdComponent Dimension>
41  vtkm::Id threadIndex,
42  const OutToInArrayType& outToIn,
43  const VisitArrayType& visit,
44  const ThreadToOutArrayType& threadToOut,
47  Dimension>& inputDomain //this should be explicit
48  ) const
49  {
50  const vtkm::Id outIndex = threadToOut.Get(threadIndex);
52  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, inputDomain);
53  }
54 
55 
62 private:
63  static constexpr bool IsScatterIdentity =
64  std::is_same<ScatterType, vtkm::worklet::ScatterIdentity>::value;
65  static constexpr bool IsMaskNone = std::is_same<MaskType, vtkm::worklet::MaskNone>::value;
66 
67 public:
68  template <bool Cond, typename ReturnType>
69  using EnableFnWhen = typename std::enable_if<Cond, ReturnType>::type;
70 
72  template <typename OutToInArrayType,
73  typename VisitArrayType,
74  typename ThreadToOutArrayType,
75  typename InputDomainType,
76  bool S = IsScatterIdentity,
77  bool M = IsMaskNone>
79  vtkm::Id threadIndex1D,
80  const vtkm::Id3& threadIndex3D,
81  const OutToInArrayType& vtkmNotUsed(outToIn),
82  const VisitArrayType& vtkmNotUsed(visit),
83  const ThreadToOutArrayType& vtkmNotUsed(threadToOut),
84  const InputDomainType& connectivity) const
85  {
87  threadIndex3D, threadIndex1D, connectivity);
88  }
89 
91  template <typename OutToInArrayType,
92  typename VisitArrayType,
93  typename ThreadToOutArrayType,
94  typename InputDomainType,
95  bool S = IsScatterIdentity,
96  bool M = IsMaskNone>
98  GetThreadIndices(vtkm::Id threadIndex1D,
99  const vtkm::Id3& threadIndex3D,
100  const OutToInArrayType& outToIn,
101  const VisitArrayType& visit,
102  const ThreadToOutArrayType& threadToOut,
103  const InputDomainType& connectivity) const
104  {
105  const vtkm::Id outIndex = threadToOut.Get(threadIndex1D);
107  threadIndex1D,
108  outToIn.Get(outIndex),
109  visit.Get(outIndex),
110  outIndex,
111  connectivity);
112  }
113 };
114 }
115 }
116 
117 #endif
vtkm::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:34
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ThreadIndicesPointNeighborhood.h
vtkm::worklet::WorkletPointNeighborhood::GetThreadIndices
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC EnableFnWhen< S &&M, vtkm::exec::arg::ThreadIndicesPointNeighborhood > GetThreadIndices(vtkm::Id threadIndex1D, const vtkm::Id3 &threadIndex3D, const OutToInArrayType &vtkmNotUsed(outToIn), const VisitArrayType &vtkmNotUsed(visit), const ThreadToOutArrayType &vtkmNotUsed(threadToOut), const InputDomainType &connectivity) const
Definition: WorkletPointNeighborhood.h:78
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
DispatcherPointNeighborhood.h
vtkm::exec::arg::ThreadIndicesPointNeighborhood
Container for thread information in a WorkletPointNeighborhood.
Definition: ThreadIndicesPointNeighborhood.h:24
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::WorkletPointNeighborhood::EnableFnWhen
typename std::enable_if< Cond, ReturnType >::type EnableFnWhen
Definition: WorkletPointNeighborhood.h:69
vtkm::worklet::WorkletPointNeighborhood::GetThreadIndices
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC EnableFnWhen<!(S &&M), vtkm::exec::arg::ThreadIndicesPointNeighborhood > GetThreadIndices(vtkm::Id threadIndex1D, const vtkm::Id3 &threadIndex3D, const OutToInArrayType &outToIn, const VisitArrayType &visit, const ThreadToOutArrayType &threadToOut, const InputDomainType &connectivity) const
Definition: WorkletPointNeighborhood.h:98
WorkletNeighborhood.h
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::worklet::WorkletPointNeighborhood::IsScatterIdentity
static constexpr bool IsScatterIdentity
In the remaining methods and constexpr we determine at compilation time which method definition will ...
Definition: WorkletPointNeighborhood.h:63
vtkm::worklet::WorkletPointNeighborhood::IsMaskNone
static constexpr bool IsMaskNone
Definition: WorkletPointNeighborhood.h:65
vtkm::exec::ConnectivityStructured
Definition: ConnectivityStructured.h:24
vtkm::Vec< vtkm::Id, 3 >
vtkm::worklet::DispatcherPointNeighborhood
Dispatcher for worklets that inherit from WorkletPointNeighborhood.
Definition: DispatcherPointNeighborhood.h:26
vtkm::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:24
vtkm::worklet::WorkletPointNeighborhood
Definition: WorkletPointNeighborhood.h:27
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
vtkm::worklet::WorkletNeighborhood
Definition: WorkletNeighborhood.h:42
vtkm::worklet::WorkletPointNeighborhood::GetThreadIndices
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC vtkm::exec::arg::ThreadIndicesPointNeighborhood GetThreadIndices(vtkm::Id threadIndex, const OutToInArrayType &outToIn, const VisitArrayType &visit, const ThreadToOutArrayType &threadToOut, const vtkm::exec::ConnectivityStructured< vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, Dimension > &inputDomain) const
Point neighborhood worklets use the related thread indices class.
Definition: WorkletPointNeighborhood.h:40