Viskores  1.0
ThreadIndicesExtrude.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_exec_arg_ThreadIndicesExtrude_h
19 #define viskores_exec_arg_ThreadIndicesExtrude_h
20 
23 
24 namespace viskores
25 {
26 namespace exec
27 {
28 namespace arg
29 {
30 
31 // Specialization for extrude types.
32 template <typename ScatterAndMaskMode>
34 {
35 
37 
38 public:
43 
46  viskores::Id inputIndex,
47  viskores::IdComponent visitIndex,
48  viskores::Id outputIndex,
49  const ConnectivityType& connectivity)
50  {
51  const LogicalIndexType logicalIndex = connectivity.FlatToLogicalToIndex(inputIndex);
52 
53  this->ThreadIndex = threadIndex;
54  this->InputIndex = inputIndex;
55  this->OutputIndex = outputIndex;
56  this->VisitIndex = visitIndex;
57  this->LogicalIndex = logicalIndex;
58  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
59  //this->CellShape = connectivity.GetCellShape(index);
60  }
61 
65  viskores::Id threadIndex1D,
66  const ConnectivityType& connectivity)
67  {
68  // This constructor handles multidimensional indices on one-to-one input-to-output
69  auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
70 
71  this->ThreadIndex = threadIndex1D;
72  this->InputIndex = threadIndex1D;
73  this->OutputIndex = threadIndex1D;
74  this->VisitIndex = 0;
75  this->LogicalIndex = logicalIndex;
76  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
77  //this->CellShape = connectivity.GetCellShape(index);
78  }
79 
83  viskores::Id threadIndex1D,
84  viskores::Id inputIndex,
85  viskores::IdComponent visitIndex,
86  viskores::Id outputIndex,
87  const ConnectivityType& connectivity)
88  {
89  // This constructor handles multidimensional indices on many-to-many input-to-output
90  auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
91 
92  this->ThreadIndex = threadIndex1D;
93  this->InputIndex = inputIndex;
94  this->OutputIndex = outputIndex;
95  this->VisitIndex = visitIndex;
96  this->LogicalIndex = logicalIndex;
97  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
98  //this->CellShape = connectivity.GetCellShape(index);
99  }
100 
108  viskores::Id GetThreadIndex() const { return this->ThreadIndex; }
109 
116  LogicalIndexType GetIndexLogical() const { return this->LogicalIndex; }
117 
125  viskores::Id GetInputIndex() const { return this->InputIndex; }
126 
133  viskores::Id3 GetInputIndex3D() const { return detail::InflateTo3D(this->GetIndexLogical()); }
134 
142  viskores::Id GetOutputIndex() const { return this->OutputIndex; }
143 
151 
160  const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
161 
173 
183 
184 private:
191 };
192 
193 // Specialization for extrude types.
194 template <typename ScatterAndMaskMode>
196 {
198 
199 public:
204 
208  viskores::Id inputIndex,
209  viskores::IdComponent visitIndex,
210  viskores::Id outputIndex,
211  const ConnectivityType& connectivity)
212  {
213  const LogicalIndexType logicalIndex = connectivity.FlatToLogicalToIndex(inputIndex);
214 
215  this->ThreadIndex = threadIndex;
216  this->InputIndex = inputIndex;
217  this->OutputIndex = outputIndex;
218  this->VisitIndex = visitIndex;
219  this->LogicalIndex = logicalIndex;
220  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
221  }
222 
225  viskores::Id threadIndex1D,
226  const ConnectivityType& connectivity)
227  {
228 
229  const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
230 
231  this->ThreadIndex = threadIndex1D;
232  this->InputIndex = threadIndex1D;
233  this->OutputIndex = threadIndex1D;
234  this->VisitIndex = 0;
235  this->LogicalIndex = logicalIndex;
236  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
237  }
238 
241  viskores::Id threadIndex1D,
242  viskores::Id inputIndex,
243  viskores::IdComponent visitIndex,
244  viskores::Id outputIndex,
245  const ConnectivityType& connectivity)
246  {
247 
248  const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
249 
250  this->ThreadIndex = threadIndex1D;
251  this->InputIndex = inputIndex;
252  this->OutputIndex = outputIndex;
253  this->VisitIndex = visitIndex;
254  this->LogicalIndex = logicalIndex;
255  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
256  }
257 
265  viskores::Id GetThreadIndex() const { return this->ThreadIndex; }
266 
273  LogicalIndexType GetIndexLogical() const { return this->LogicalIndex; }
274 
282  viskores::Id GetInputIndex() const { return this->InputIndex; }
283 
290  viskores::Id3 GetInputIndex3D() const { return detail::InflateTo3D(this->GetIndexLogical()); }
291 
299  viskores::Id GetOutputIndex() const { return this->OutputIndex; }
300 
308 
317  const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
318 
330 
340 
341 private:
348 };
349 
350 } //namespace arg
351 }
352 } // namespace viskores::exec
353 
355 
356 #endif
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndex
viskores::Id ThreadIndex
Definition: ThreadIndicesExtrude.h:185
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex
viskores::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:282
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex3D
viskores::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:290
FetchExtrude.h
viskores::exec::ConnectivityExtrude
Definition: ConnectivityExtrude.h:34
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::LogicalIndexType
typename ConnectivityType::SchedulingRangeType LogicalIndexType
Definition: ThreadIndicesExtrude.h:41
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
viskores::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:299
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::InputIndex
viskores::Id InputIndex
Definition: ThreadIndicesExtrude.h:343
viskores::exec::ConnectivityExtrude::GetIndices
IndicesType GetIndices(viskores::Id index) const
Definition: ConnectivityExtrude.h:66
viskores::exec::ReverseConnectivityExtrude::GetIndices
IndicesType GetIndices(viskores::Id index) const
Returns a Vec-like object containing the indices for the given index.
Definition: ConnectivityExtrude.h:148
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const viskores::Id3 &threadIndex3D, viskores::Id threadIndex1D, viskores::Id inputIndex, viskores::IdComponent visitIndex, viskores::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:240
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const viskores::Id3 &threadIndex3D, viskores::Id threadIndex1D, viskores::Id inputIndex, viskores::IdComponent visitIndex, viskores::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:82
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:39
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex
viskores::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:125
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const IndicesIncidentType * GetIndicesIncidentPointer() const
The input indices of the "from" elements in pointer form.
Definition: ThreadIndicesExtrude.h:329
ThreadIndicesTopologyMap.h
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const IndicesIncidentType * GetIndicesIncidentPointer() const
The input indices of the "from" elements in pointer form.
Definition: ThreadIndicesExtrude.h:172
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:182
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesExtrude.h:190
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::exec::arg::ThreadIndicesTopologyMap::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesTopologyMap.h:162
viskores::exec::arg::ThreadIndicesBasic::InputIndex
viskores::Id InputIndex
Definition: ThreadIndicesBasic.h:106
viskores::exec::arg::ThreadIndicesTopologyMap
Container for thread indices in a topology map.
Definition: ThreadIndicesTopologyMap.h:103
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:346
ConnectivityExtrude.h
viskores::exec::IndicesExtrude
Definition: IndicesExtrude.h:29
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::OutputIndex
viskores::Id OutputIndex
Definition: ThreadIndicesExtrude.h:188
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::VisitIndex
viskores::IdComponent VisitIndex
Definition: ThreadIndicesExtrude.h:344
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:116
viskores::exec::ReverseConnectivityExtrude
Definition: ConnectivityExtrude.h:104
viskores::exec::arg::ThreadIndicesBasic::ThreadIndex
viskores::Id ThreadIndex
Definition: ThreadIndicesBasic.h:105
viskores::CellShapeTagWedge
Definition: CellShape.h:168
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::OutputIndex
viskores::Id OutputIndex
Definition: ThreadIndicesExtrude.h:345
viskores::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:54
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
viskores::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:142
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::exec::ReverseIndicesExtrude
Definition: IndicesExtrude.h:79
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::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
viskores::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:150
viskores::exec::ReverseConnectivityExtrude::FlatToLogicalToIndex
viskores::Id2 FlatToLogicalToIndex(viskores::Id index) const
Definition: ConnectivityExtrude.h:170
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:200
viskores::CellShapeTagVertex
Definition: CellShape.h:156
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesExtrude.h:347
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex3D
viskores::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:133
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:160
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:339
viskores::exec::ConnectivityExtrude::FlatToLogicalToIndex
viskores::Id2 FlatToLogicalToIndex(viskores::Id index) const
Definition: ConnectivityExtrude.h:87
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const viskores::Id3 &threadIndex3D, viskores::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:224
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::InputIndex
viskores::Id InputIndex
Definition: ThreadIndicesExtrude.h:186
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(viskores::Id &threadIndex, viskores::Id inputIndex, viskores::IdComponent visitIndex, viskores::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:207
viskores::exec::arg::ThreadIndicesBasic::VisitIndex
viskores::IdComponent VisitIndex
Definition: ThreadIndicesBasic.h:108
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::LogicalIndexType
typename ConnectivityType::SchedulingRangeType LogicalIndexType
Definition: ThreadIndicesExtrude.h:202
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::IndicesIncidentType
typename ConnectivityType::IndicesType IndicesIncidentType
Definition: ThreadIndicesExtrude.h:201
viskores::exec::arg::ThreadIndicesBasic::OutputIndex
viskores::Id OutputIndex
Definition: ThreadIndicesBasic.h:107
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:317
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::VisitIndex
viskores::IdComponent VisitIndex
Definition: ThreadIndicesExtrude.h:187
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
viskores::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:265
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:189
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const viskores::Id3 &threadIndex3D, viskores::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:64
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndex
viskores::Id ThreadIndex
Definition: ThreadIndicesExtrude.h:342
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
viskores::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:307
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::IndicesIncidentType
typename ConnectivityType::IndicesType IndicesIncidentType
Definition: ThreadIndicesExtrude.h:40
viskores::Vec< viskores::Id, 2 >
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::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(viskores::Id threadIndex, viskores::Id inputIndex, viskores::IdComponent visitIndex, viskores::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:45
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
viskores::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:108
viskores::exec::arg::ThreadIndicesTopologyMap< viskores::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:273