Viskores  1.0
WorkletCellNeighborhood.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_WorkletCellNeighborhood_h
19 #define viskores_worklet_WorkletCellNeighborhood_h
20 
26 
30 
31 namespace viskores
32 {
33 namespace worklet
34 {
35 
36 template <typename WorkletType>
37 class DispatcherCellNeighborhood;
38 
45 {
46 public:
47  template <typename Worklet>
49 
53 #ifdef VISKORES_DOXYGEN_ONLY
54  // These redeclarations of superclass features are for documentation purposes only.
55 
58  {
59  };
60 
63  {
64  };
65 
68  {
69  };
70 
73  {
74  };
75 
78  {
79  };
80 
82  struct WholeArrayIn : viskores::worklet::internal::WorkletBase::WholeArrayIn
83  {
84  };
85 
87  struct WholeArrayOut : viskores::worklet::internal::WorkletBase::WholeArrayOut
88  {
89  };
90 
92  struct WholeArrayInOut : viskores::worklet::internal::WorkletBase::WholeArrayInOut
93  {
94  };
95 
97  struct AtomicArrayInOut : viskores::worklet::internal::WorkletBase::AtomicArrayInOut
98  {
99  };
100 
102  template <typename VisitTopology = Cell, typename IncidentTopology = Point>
104  : viskores::worklet::internal::WorkletBase::WholeCellSetIn<VisitTopology, IncidentTopology>
105  {
106  };
107 
109  struct ExecObject : viskores::worklet::internal::WorkletBase::ExecObject
110  {
111  };
112 #endif // VISKORES_DOXYGEN_ONLY
113 
118 #ifdef VISKORES_DOXYGEN_ONLY
119  // These redeclarations of superclass features are for documentation purposes only.
120 
122  struct _1 : viskores::worklet::internal::WorkletBase::_1
123  {
124  };
125 
128  {
129  };
130 
133  {
134  };
135 
138  {
139  };
140 
143  {
144  };
145 
148  {
149  };
150 
153  {
154  };
155 
157  struct Device : viskores::worklet::internal::WorkletBase::Device
158  {
159  };
160 #endif // VISKORES_DOXYGEN_ONLY
161 
166  template <typename OutToInArrayType,
167  typename VisitArrayType,
168  typename ThreadToOutArrayType,
169  viskores::IdComponent Dimension>
171  viskores::Id threadIndex,
172  const OutToInArrayType& outToIn,
173  const VisitArrayType& visit,
174  const ThreadToOutArrayType& threadToOut,
177  Dimension>& inputDomain //this should be explicit
178  ) const
179  {
180  const viskores::Id outIndex = threadToOut.Get(threadIndex);
182  threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, inputDomain);
183  }
184 
185 
192 private:
193  static constexpr bool IsScatterIdentity =
194  std::is_same<ScatterType, viskores::worklet::ScatterIdentity>::value;
195  static constexpr bool IsMaskNone = std::is_same<MaskType, viskores::worklet::MaskNone>::value;
196 
197 public:
198  template <bool Cond, typename ReturnType>
199  using EnableFnWhen = typename std::enable_if<Cond, ReturnType>::type;
200 
202  template <typename OutToInArrayType,
203  typename VisitArrayType,
204  typename ThreadToOutArrayType,
205  typename InputDomainType,
206  bool S = IsScatterIdentity,
207  bool M = IsMaskNone>
210  const viskores::Id3& threadIndex3D,
211  const OutToInArrayType& viskoresNotUsed(outToIn),
212  const VisitArrayType& viskoresNotUsed(visit),
213  const ThreadToOutArrayType& viskoresNotUsed(threadToOut),
214  const InputDomainType& connectivity) const
215  {
217  threadIndex3D, threadIndex1D, connectivity);
218  }
219 
221  template <typename OutToInArrayType,
222  typename VisitArrayType,
223  typename ThreadToOutArrayType,
224  typename InputDomainType,
225  bool S = IsScatterIdentity,
226  bool M = IsMaskNone>
229  const viskores::Id3& threadIndex3D,
230  const OutToInArrayType& outToIn,
231  const VisitArrayType& visit,
232  const ThreadToOutArrayType& threadToOut,
233  const InputDomainType& connectivity) const
234  {
235  const viskores::Id outIndex = threadToOut.Get(threadIndex1D);
237  threadIndex1D,
238  outToIn.Get(outIndex),
239  visit.Get(outIndex),
240  outIndex,
241  connectivity);
242  }
243 };
244 }
245 }
246 
247 #endif
viskores::worklet::WorkletNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletNeighborhood.h:122
viskores::worklet::WorkletNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletNeighborhood.h:106
viskores::worklet::WorkletCellNeighborhood::Device
ExecutionSignature tag for getting the device adapter tag.
Definition: WorkletCellNeighborhood.h:157
viskores::worklet::WorkletNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletNeighborhood.h:91
viskores::worklet::WorkletNeighborhood
Definition: WorkletNeighborhood.h:50
viskores::worklet::WorkletCellNeighborhood
Base class for worklets that map over the cells in a structured grid with neighborhood information.
Definition: WorkletCellNeighborhood.h:44
DispatcherCellNeighborhood.h
viskores::worklet::WorkletCellNeighborhood::WholeCellSetIn
ControlSignature tag for whole input topology.
Definition: WorkletCellNeighborhood.h:103
viskores::TopologyElementTagCell
A tag used to identify the cell elements in a topology.
Definition: TopologyElementTag.h:32
viskores::worklet::WorkletCellNeighborhood::Boundary
The ExecutionSignature tag to query if the current iteration is inside the boundary.
Definition: WorkletCellNeighborhood.h:127
viskores::exec::arg::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: ThreadIndices.h:52
viskores::worklet::WorkletCellNeighborhood::WholeArrayOut
ControlSignature tag for whole output arrays.
Definition: WorkletCellNeighborhood.h:87
ThreadIndicesCellNeighborhood.h
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
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::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::worklet::WorkletCellNeighborhood::WholeArrayIn
ControlSignature tag for whole input arrays.
Definition: WorkletCellNeighborhood.h:82
viskores::worklet::WorkletCellNeighborhood::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: WorkletCellNeighborhood.h:142
viskores::TopologyElementTagPoint
A tag used to identify the point elements in a topology.
Definition: TopologyElementTag.h:42
viskores::worklet::WorkletCellNeighborhood::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: WorkletCellNeighborhood.h:147
viskores::worklet::WorkletCellNeighborhood::GetThreadIndices
EnableFnWhen<!(S &&M), viskores::exec::arg::ThreadIndicesCellNeighborhood > GetThreadIndices(viskores::Id threadIndex1D, const viskores::Id3 &threadIndex3D, const OutToInArrayType &outToIn, const VisitArrayType &visit, const ThreadToOutArrayType &threadToOut, const InputDomainType &connectivity) const
Definition: WorkletCellNeighborhood.h:228
viskores::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:54
viskores::worklet::WorkletCellNeighborhood::EnableFnWhen
typename std::enable_if< Cond, ReturnType >::type EnableFnWhen
Definition: WorkletCellNeighborhood.h:199
viskores::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:193
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::worklet::WorkletCellNeighborhood::IsMaskNone
static constexpr bool IsMaskNone
Definition: WorkletCellNeighborhood.h:195
viskores::worklet::WorkletCellNeighborhood::FieldInOut
A control signature tag for input-output (in-place) fields.
Definition: WorkletCellNeighborhood.h:77
viskores::worklet::WorkletCellNeighborhood::_1
Argument placeholders for an ExecutionSignature.
Definition: WorkletCellNeighborhood.h:122
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:52
viskores::worklet::DispatcherCellNeighborhood
Dispatcher for worklets that inherit from WorkletCellNeighborhood.
Definition: DispatcherCellNeighborhood.h:35
viskores::worklet::WorkletCellNeighborhood::FieldOut
A control signature tag for output fields.
Definition: WorkletCellNeighborhood.h:72
WorkletNeighborhood.h
viskores::worklet::WorkletCellNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletCellNeighborhood.h:57
viskores::worklet::WorkletCellNeighborhood::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: WorkletCellNeighborhood.h:137
viskores::worklet::WorkletCellNeighborhood::AtomicArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletCellNeighborhood.h:97
viskores::worklet::WorkletCellNeighborhood::ExecObject
ControlSignature tag for execution object inputs.
Definition: WorkletCellNeighborhood.h:109
viskores::worklet::WorkletNeighborhood::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletNeighborhood.h:165
viskores::worklet::WorkletCellNeighborhood::GetThreadIndices
EnableFnWhen< S &&M, viskores::exec::arg::ThreadIndicesCellNeighborhood > GetThreadIndices(viskores::Id threadIndex1D, const viskores::Id3 &threadIndex3D, const OutToInArrayType &, const VisitArrayType &, const ThreadToOutArrayType &, const InputDomainType &connectivity) const
Definition: WorkletCellNeighborhood.h:209
viskores::worklet::WorkletCellNeighborhood::ThreadIndices
The ExecutionSignature tag to use to get the thread indices.
Definition: WorkletCellNeighborhood.h:152
viskores::worklet::WorkletCellNeighborhood::FieldInNeighborhood
A control signature tag for neighborhood input values.
Definition: WorkletCellNeighborhood.h:67
viskores::worklet::WorkletCellNeighborhood::FieldIn
A control signature tag for input fields.
Definition: WorkletCellNeighborhood.h:62
viskores::worklet::WorkletCellNeighborhood::WholeArrayInOut
ControlSignature tag for whole input/output arrays.
Definition: WorkletCellNeighborhood.h:92
viskores::worklet::WorkletCellNeighborhood::WorkIndex
The ExecutionSignature tag to use to get the work index.
Definition: WorkletCellNeighborhood.h:132
viskores::exec::arg::ThreadIndicesCellNeighborhood
Container for thread information in a WorkletCellNeighborhood.
Definition: ThreadIndicesCellNeighborhood.h:38
viskores::worklet::WorkletCellNeighborhood::GetThreadIndices
viskores::exec::arg::ThreadIndicesCellNeighborhood 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: WorkletCellNeighborhood.h:170
viskores::worklet::WorkletNeighborhood::CellSetIn
A control signature tag for input connectivity.
Definition: WorkletNeighborhood.h:137
viskores::Vec< viskores::Id, 3 >
viskores::exec::ConnectivityStructured
A class holding information about topology connections.
Definition: ConnectivityStructured.h:38
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