Viskores  1.0
WorkletPointNeighborhood.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_worklet_WorkletPointNeighborhood_h
19 #define viskores_worklet_WorkletPointNeighborhood_h
20 
29 
30 namespace viskores
31 {
32 namespace worklet
33 {
34 
41 {
42 public:
43  template <typename Worklet>
45 
49 #ifdef VISKORES_DOXYGEN_ONLY
50  // These redeclarations of superclass features are for documentation purposes only.
51 
54  {
55  };
56 
59  {
60  };
61 
64  {
65  };
66 
69  {
70  };
71 
74  {
75  };
76 
78  struct WholeArrayIn : viskores::worklet::internal::WorkletBase::WholeArrayIn
79  {
80  };
81 
83  struct WholeArrayOut : viskores::worklet::internal::WorkletBase::WholeArrayOut
84  {
85  };
86 
88  struct WholeArrayInOut : viskores::worklet::internal::WorkletBase::WholeArrayInOut
89  {
90  };
91 
93  struct AtomicArrayInOut : viskores::worklet::internal::WorkletBase::AtomicArrayInOut
94  {
95  };
96 
98  template <typename VisitTopology = Cell, typename IncidentTopology = Point>
100  : viskores::worklet::internal::WorkletBase::WholeCellSetIn<VisitTopology, IncidentTopology>
101  {
102  };
103 
105  struct ExecObject : viskores::worklet::internal::WorkletBase::ExecObject
106  {
107  };
108 #endif // VISKORES_DOXYGEN_ONLY
109 
114 #ifdef VISKORES_DOXYGEN_ONLY
115  // These redeclarations of superclass features are for documentation purposes only.
116 
118  struct _1 : viskores::worklet::internal::WorkletBase::_1
119  {
120  };
121 
124  {
125  };
126 
129  {
130  };
131 
134  {
135  };
136 
139  {
140  };
141 
144  {
145  };
146 
149  {
150  };
151 
153  struct Device : viskores::worklet::internal::WorkletBase::Device
154  {
155  };
156 #endif // VISKORES_DOXYGEN_ONLY
157 
162  template <typename OutToInArrayType,
163  typename VisitArrayType,
164  typename ThreadToOutArrayType,
165  viskores::IdComponent Dimension>
167  viskores::Id threadIndex,
168  const OutToInArrayType& outToIn,
169  const VisitArrayType& visit,
170  const ThreadToOutArrayType& threadToOut,
173  Dimension>& inputDomain //this should be explicit
174  ) const
175  {
176  const viskores::Id outIndex = threadToOut.Get(threadIndex);
178  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, inputDomain);
179  }
180 
181 
188 private:
189  static constexpr bool IsScatterIdentity =
190  std::is_same<ScatterType, viskores::worklet::ScatterIdentity>::value;
191  static constexpr bool IsMaskNone = std::is_same<MaskType, viskores::worklet::MaskNone>::value;
192 
193 public:
194  template <bool Cond, typename ReturnType>
195  using EnableFnWhen = typename std::enable_if<Cond, ReturnType>::type;
196 
198  template <typename OutToInArrayType,
199  typename VisitArrayType,
200  typename ThreadToOutArrayType,
201  typename InputDomainType,
202  bool S = IsScatterIdentity,
203  bool M = IsMaskNone>
206  const viskores::Id3& threadIndex3D,
207  const OutToInArrayType& viskoresNotUsed(outToIn),
208  const VisitArrayType& viskoresNotUsed(visit),
209  const ThreadToOutArrayType& viskoresNotUsed(threadToOut),
210  const InputDomainType& connectivity) const
211  {
213  threadIndex3D, threadIndex1D, connectivity);
214  }
215 
217  template <typename OutToInArrayType,
218  typename VisitArrayType,
219  typename ThreadToOutArrayType,
220  typename InputDomainType,
221  bool S = IsScatterIdentity,
222  bool M = IsMaskNone>
225  const viskores::Id3& threadIndex3D,
226  const OutToInArrayType& outToIn,
227  const VisitArrayType& visit,
228  const ThreadToOutArrayType& threadToOut,
229  const InputDomainType& connectivity) const
230  {
231  const viskores::Id outIndex = threadToOut.Get(threadIndex1D);
233  threadIndex1D,
234  outToIn.Get(outIndex),
235  visit.Get(outIndex),
236  outIndex,
237  connectivity);
238  }
239 };
240 }
241 }
242 
243 #endif
viskores::worklet::WorkletPointNeighborhood::ExecObject
ControlSignature tag for execution object inputs.
Definition: WorkletPointNeighborhood.h:105
viskores::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:189
viskores::worklet::WorkletNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletNeighborhood.h:122
viskores::worklet::DispatcherPointNeighborhood
Dispatcher for worklets that inherit from WorkletPointNeighborhood.
Definition: DispatcherPointNeighborhood.h:34
viskores::worklet::WorkletNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletNeighborhood.h:106
viskores::worklet::WorkletPointNeighborhood::WholeArrayOut
ControlSignature tag for whole output arrays.
Definition: WorkletPointNeighborhood.h:83
viskores::worklet::WorkletNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletNeighborhood.h:91
viskores::worklet::WorkletNeighborhood
Definition: WorkletNeighborhood.h:50
viskores::worklet::WorkletPointNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletPointNeighborhood.h:58
viskores::worklet::WorkletPointNeighborhood
Base class for worklets that map over the points in a structured grid with neighborhood information.
Definition: WorkletPointNeighborhood.h:40
viskores::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:32
viskores::exec::arg::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: ThreadIndices.h:52
ThreadIndicesPointNeighborhood.h
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::worklet::WorkletPointNeighborhood::EnableFnWhen
typename std::enable_if< Cond, ReturnType >::type EnableFnWhen
Definition: WorkletPointNeighborhood.h:195
viskores::worklet::WorkletPointNeighborhood::GetThreadIndices
EnableFnWhen<!(S &&M), viskores::exec::arg::ThreadIndicesPointNeighborhood > GetThreadIndices(viskores::Id threadIndex1D, const viskores::Id3 &threadIndex3D, const OutToInArrayType &outToIn, const VisitArrayType &visit, const ThreadToOutArrayType &threadToOut, const InputDomainType &connectivity) const
Definition: WorkletPointNeighborhood.h:224
DispatcherPointNeighborhood.h
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
viskores::worklet::WorkletNeighborhood::Boundary
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletNeighborhood.h:62
viskores::worklet::WorkletPointNeighborhood::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkletPointNeighborhood.h:128
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::worklet::WorkletPointNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletPointNeighborhood.h:73
viskores::worklet::WorkletPointNeighborhood::GetThreadIndices
EnableFnWhen< S &&M, viskores::exec::arg::ThreadIndicesPointNeighborhood > GetThreadIndices(viskores::Id threadIndex1D, const viskores::Id3 &threadIndex3D, const OutToInArrayType &, const VisitArrayType &, const ThreadToOutArrayType &, const InputDomainType &connectivity) const
Definition: WorkletPointNeighborhood.h:205
viskores::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:42
viskores::worklet::WorkletPointNeighborhood::WholeCellSetIn
ControlSignature tag for whole input topology.
Definition: WorkletPointNeighborhood.h:99
viskores::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:54
viskores::worklet::WorkletPointNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletPointNeighborhood.h:68
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::worklet::WorkletPointNeighborhood::Boundary
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletPointNeighborhood.h:123
viskores::worklet::WorkletPointNeighborhood::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: WorkletPointNeighborhood.h:133
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::worklet::WorkletPointNeighborhood::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: WorkletPointNeighborhood.h:143
viskores::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:52
viskores::worklet::WorkletPointNeighborhood::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: WorkletPointNeighborhood.h:138
viskores::worklet::WorkletPointNeighborhood::AtomicArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletPointNeighborhood.h:93
WorkletNeighborhood.h
viskores::worklet::WorkletPointNeighborhood::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: WorkletPointNeighborhood.h:148
viskores::worklet::WorkletPointNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletPointNeighborhood.h:53
viskores::worklet::WorkletPointNeighborhood::_1
Argument placeholders for an ExecutionSignature.
Definition: WorkletPointNeighborhood.h:118
viskores::worklet::WorkletPointNeighborhood::IsMaskNone
static constexpr bool IsMaskNone
Definition: WorkletPointNeighborhood.h:191
viskores::worklet::WorkletNeighborhood::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletNeighborhood.h:165
viskores::worklet::WorkletPointNeighborhood::Device
ExecutionSignature tag for getting the device adapter tag.
Definition: WorkletPointNeighborhood.h:153
viskores::worklet::WorkletPointNeighborhood::WholeArrayIn
ControlSignature tag for whole input arrays.
Definition: WorkletPointNeighborhood.h:78
viskores::exec::arg::ThreadIndicesPointNeighborhood
Container for thread information in a WorkletPointNeighborhood.
Definition: ThreadIndicesPointNeighborhood.h:32
viskores::worklet::WorkletPointNeighborhood::GetThreadIndices
viskores::exec::arg::ThreadIndicesPointNeighborhood GetThreadIndices(viskores::Id threadIndex, const OutToInArrayType &outToIn, const VisitArrayType &visit, const ThreadToOutArrayType &threadToOut, const viskores::exec::ConnectivityStructured< viskores::TopologyElementTagPoint, viskores::TopologyElementTagCell, Dimension > &inputDomain) const
Point neighborhood worklets use the related thread indices class.
Definition: WorkletPointNeighborhood.h:166
viskores::worklet::WorkletNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletNeighborhood.h:137
viskores::worklet::WorkletPointNeighborhood::WholeArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletPointNeighborhood.h:88
viskores::Vec< viskores::Id, 3 >
viskores::exec::ConnectivityStructured
A class holding information about topology connections.
Definition: ConnectivityStructured.h:38
viskores::worklet::WorkletPointNeighborhood::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletPointNeighborhood.h:63
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59
viskores::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:51
viskores::exec::arg::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkIndex.h:47