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