VTK-m  2.2
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 
37 {
38 public:
39  template <typename Worklet>
41 
45 #ifdef VTKM_DOXYGEN_ONLY
46  // These redeclarations of superclass features are for documentation purposes only.
47 
50  {
51  };
52 
55  {
56  };
57 
60  {
61  };
62 
65  {
66  };
67 
70  {
71  };
72 
74  struct WholeArrayIn : vtkm::worklet::internal::WorkletBase::WholeArrayIn
75  {
76  };
77 
79  struct WholeArrayOut : vtkm::worklet::internal::WorkletBase::WholeArrayOut
80  {
81  };
82 
84  struct WholeArrayInOut : vtkm::worklet::internal::WorkletBase::WholeArrayInOut
85  {
86  };
87 
89  struct AtomicArrayInOut : vtkm::worklet::internal::WorkletBase::AtomicArrayInOut
90  {
91  };
92 
94  template <typename VisitTopology = Cell, typename IncidentTopology = Point>
96  : vtkm::worklet::internal::WorkletBase::WholeCellSetIn<VisitTopology, IncidentTopology>
97  {
98  };
99 
101  struct ExecObject : vtkm::worklet::internal::WorkletBase::ExecObject
102  {
103  };
104 #endif // VTKM_DOXYGEN_ONLY
105 
110 #ifdef VTKM_DOXYGEN_ONLY
111  // These redeclarations of superclass features are for documentation purposes only.
112 
114  struct _1 : vtkm::worklet::internal::WorkletBase::_1
115  {
116  };
117 
120  {
121  };
122 
125  {
126  };
127 
130  {
131  };
132 
135  {
136  };
137 
140  {
141  };
142 
145  {
146  };
147 
149  struct Device : vtkm::worklet::internal::WorkletBase::Device
150  {
151  };
152 #endif // VTKM_DOXYGEN_ONLY
153 
158  template <typename OutToInArrayType,
159  typename VisitArrayType,
160  typename ThreadToOutArrayType,
161  vtkm::IdComponent Dimension>
163  vtkm::Id threadIndex,
164  const OutToInArrayType& outToIn,
165  const VisitArrayType& visit,
166  const ThreadToOutArrayType& threadToOut,
169  Dimension>& inputDomain //this should be explicit
170  ) const
171  {
172  const vtkm::Id outIndex = threadToOut.Get(threadIndex);
174  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, inputDomain);
175  }
176 
177 
184 private:
185  static constexpr bool IsScatterIdentity =
186  std::is_same<ScatterType, vtkm::worklet::ScatterIdentity>::value;
187  static constexpr bool IsMaskNone = std::is_same<MaskType, vtkm::worklet::MaskNone>::value;
188 
189 public:
190  template <bool Cond, typename ReturnType>
191  using EnableFnWhen = typename std::enable_if<Cond, ReturnType>::type;
192 
194  template <typename OutToInArrayType,
195  typename VisitArrayType,
196  typename ThreadToOutArrayType,
197  typename InputDomainType,
198  bool S = IsScatterIdentity,
199  bool M = IsMaskNone>
201  vtkm::Id threadIndex1D,
202  const vtkm::Id3& threadIndex3D,
203  const OutToInArrayType& vtkmNotUsed(outToIn),
204  const VisitArrayType& vtkmNotUsed(visit),
205  const ThreadToOutArrayType& vtkmNotUsed(threadToOut),
206  const InputDomainType& connectivity) const
207  {
209  threadIndex3D, threadIndex1D, connectivity);
210  }
211 
213  template <typename OutToInArrayType,
214  typename VisitArrayType,
215  typename ThreadToOutArrayType,
216  typename InputDomainType,
217  bool S = IsScatterIdentity,
218  bool M = IsMaskNone>
220  GetThreadIndices(vtkm::Id threadIndex1D,
221  const vtkm::Id3& threadIndex3D,
222  const OutToInArrayType& outToIn,
223  const VisitArrayType& visit,
224  const ThreadToOutArrayType& threadToOut,
225  const InputDomainType& connectivity) const
226  {
227  const vtkm::Id outIndex = threadToOut.Get(threadIndex1D);
229  threadIndex1D,
230  outToIn.Get(outIndex),
231  visit.Get(outIndex),
232  outIndex,
233  connectivity);
234  }
235 };
236 }
237 }
238 
239 #endif
vtkm::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:34
vtkm::worklet::WorkletCellNeighborhood::WholeArrayIn
ControlSignature tag for whole input arrays.
Definition: WorkletCellNeighborhood.h:74
DispatcherCellNeighborhood.h
vtkm::worklet::WorkletCellNeighborhood::IsMaskNone
static constexpr bool IsMaskNone
Definition: WorkletCellNeighborhood.h:187
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm::worklet::WorkletCellNeighborhood::WholeArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletCellNeighborhood.h:84
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ThreadIndicesCellNeighborhood.h
vtkm::worklet::WorkletCellNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletCellNeighborhood.h:54
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::worklet::WorkletCellNeighborhood::WholeCellSetIn
ControlSignature tag for whole input topology.
Definition: WorkletCellNeighborhood.h:95
vtkm::worklet::WorkletNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletNeighborhood.h:129
vtkm::worklet::WorkletCellNeighborhood::Device
ExecutionSignature tag for getting the device adapter tag.
Definition: WorkletCellNeighborhood.h:149
vtkm::worklet::WorkletNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletNeighborhood.h:98
vtkm::worklet::WorkletCellNeighborhood::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkletCellNeighborhood.h:124
vtkm::worklet::DispatcherCellNeighborhood
Dispatcher for worklets that inherit from WorkletCellNeighborhood.
Definition: DispatcherCellNeighborhood.h:27
vtkm::worklet::WorkletCellNeighborhood::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: WorkletCellNeighborhood.h:139
vtkm::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:44
vtkm::worklet::WorkletCellNeighborhood::WholeArrayOut
ControlSignature tag for whole output arrays.
Definition: WorkletCellNeighborhood.h:79
vtkm::worklet::WorkletCellNeighborhood::GetThreadIndices
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:162
vtkm::worklet::WorkletCellNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletCellNeighborhood.h:49
vtkm::worklet::WorkletNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletNeighborhood.h:114
vtkm::worklet::WorkletCellNeighborhood::Boundary
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletCellNeighborhood.h:119
vtkm::worklet::WorkletCellNeighborhood::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: WorkletCellNeighborhood.h:129
vtkm::worklet::WorkletCellNeighborhood
Base class for worklets that map over the cells in a structured grid with neighborhood information.
Definition: WorkletCellNeighborhood.h:36
vtkm::worklet::WorkletCellNeighborhood::EnableFnWhen
typename std::enable_if< Cond, ReturnType >::type EnableFnWhen
Definition: WorkletCellNeighborhood.h:191
vtkm::worklet::WorkletCellNeighborhood::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: WorkletCellNeighborhood.h:134
vtkm::worklet::WorkletNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletNeighborhood.h:83
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
WorkletNeighborhood.h
vtkm::worklet::WorkletCellNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletCellNeighborhood.h:64
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:185
vtkm::exec::ConnectivityStructured
A class holding information about topology connections.
Definition: ConnectivityStructured.h:30
vtkm::worklet::WorkletNeighborhood::Boundary
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletNeighborhood.h:54
vtkm::Vec< vtkm::Id, 3 >
vtkm::worklet::WorkletCellNeighborhood::GetThreadIndices
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:220
vtkm::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:24
vtkm::worklet::WorkletCellNeighborhood::AtomicArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletCellNeighborhood.h:89
vtkm::worklet::WorkletNeighborhood::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletNeighborhood.h:156
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::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::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletCellNeighborhood.h:59
vtkm::worklet::WorkletCellNeighborhood::_1
Argument placeholders for an ExecutionSignature.
Definition: WorkletCellNeighborhood.h:114
vtkm::worklet::WorkletCellNeighborhood::ExecObject
ControlSignature tag for execution object inputs.
Definition: WorkletCellNeighborhood.h:101
vtkm::worklet::WorkletNeighborhood
Definition: WorkletNeighborhood.h:42
vtkm::worklet::WorkletCellNeighborhood::GetThreadIndices
EnableFnWhen< S &&M, vtkm::exec::arg::ThreadIndicesCellNeighborhood > GetThreadIndices(vtkm::Id threadIndex1D, const vtkm::Id3 &threadIndex3D, const OutToInArrayType &, const VisitArrayType &, const ThreadToOutArrayType &, const InputDomainType &connectivity) const
Definition: WorkletCellNeighborhood.h:200
vtkm::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:39
vtkm::worklet::WorkletCellNeighborhood::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: WorkletCellNeighborhood.h:144
vtkm::worklet::WorkletCellNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletCellNeighborhood.h:69