VTK-m  2.2
ThreadIndicesExtrude.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_exec_arg_ThreadIndicesExtrude_h
11 #define vtk_m_exec_arg_ThreadIndicesExtrude_h
12 
15 
16 namespace vtkm
17 {
18 namespace exec
19 {
20 namespace arg
21 {
22 
23 // Specialization for extrude types.
24 template <typename ScatterAndMaskMode>
26 {
27 
29 
30 public:
35 
38  vtkm::Id inputIndex,
39  vtkm::IdComponent visitIndex,
40  vtkm::Id outputIndex,
41  const ConnectivityType& connectivity)
42  {
43  const LogicalIndexType logicalIndex = connectivity.FlatToLogicalToIndex(inputIndex);
44 
45  this->ThreadIndex = threadIndex;
46  this->InputIndex = inputIndex;
47  this->OutputIndex = outputIndex;
48  this->VisitIndex = visitIndex;
49  this->LogicalIndex = logicalIndex;
50  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
51  //this->CellShape = connectivity.GetCellShape(index);
52  }
53 
55  VTKM_EXEC
56  ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
57  vtkm::Id threadIndex1D,
58  const ConnectivityType& connectivity)
59  {
60  // This constructor handles multidimensional indices on one-to-one input-to-output
61  auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
62 
63  this->ThreadIndex = threadIndex1D;
64  this->InputIndex = threadIndex1D;
65  this->OutputIndex = threadIndex1D;
66  this->VisitIndex = 0;
67  this->LogicalIndex = logicalIndex;
68  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
69  //this->CellShape = connectivity.GetCellShape(index);
70  }
71 
73  VTKM_EXEC
74  ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
75  vtkm::Id threadIndex1D,
76  vtkm::Id inputIndex,
77  vtkm::IdComponent visitIndex,
78  vtkm::Id outputIndex,
79  const ConnectivityType& connectivity)
80  {
81  // This constructor handles multidimensional indices on many-to-many input-to-output
82  auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
83 
84  this->ThreadIndex = threadIndex1D;
85  this->InputIndex = inputIndex;
86  this->OutputIndex = outputIndex;
87  this->VisitIndex = visitIndex;
88  this->LogicalIndex = logicalIndex;
89  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
90  //this->CellShape = connectivity.GetCellShape(index);
91  }
92 
99  VTKM_EXEC
100  vtkm::Id GetThreadIndex() const { return this->ThreadIndex; }
101 
107  VTKM_EXEC
108  LogicalIndexType GetIndexLogical() const { return this->LogicalIndex; }
109 
116  VTKM_EXEC
117  vtkm::Id GetInputIndex() const { return this->InputIndex; }
118 
124  VTKM_EXEC
125  vtkm::Id3 GetInputIndex3D() const { return detail::InflateTo3D(this->GetIndexLogical()); }
126 
133  VTKM_EXEC
134  vtkm::Id GetOutputIndex() const { return this->OutputIndex; }
135 
141  VTKM_EXEC
142  vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
143 
151  VTKM_EXEC
152  const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
153 
163  VTKM_EXEC
165 
173  VTKM_EXEC
175 
176 private:
183 };
184 
185 // Specialization for extrude types.
186 template <typename ScatterAndMaskMode>
188 {
190 
191 public:
196 
198  VTKM_EXEC
200  vtkm::Id inputIndex,
201  vtkm::IdComponent visitIndex,
202  vtkm::Id outputIndex,
203  const ConnectivityType& connectivity)
204  {
205  const LogicalIndexType logicalIndex = connectivity.FlatToLogicalToIndex(inputIndex);
206 
207  this->ThreadIndex = threadIndex;
208  this->InputIndex = inputIndex;
209  this->OutputIndex = outputIndex;
210  this->VisitIndex = visitIndex;
211  this->LogicalIndex = logicalIndex;
212  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
213  }
214 
215  VTKM_EXEC
216  ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
217  vtkm::Id threadIndex1D,
218  const ConnectivityType& connectivity)
219  {
220 
221  const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
222 
223  this->ThreadIndex = threadIndex1D;
224  this->InputIndex = threadIndex1D;
225  this->OutputIndex = threadIndex1D;
226  this->VisitIndex = 0;
227  this->LogicalIndex = logicalIndex;
228  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
229  }
230 
231  VTKM_EXEC
232  ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
233  vtkm::Id threadIndex1D,
234  vtkm::Id inputIndex,
235  vtkm::IdComponent visitIndex,
236  vtkm::Id outputIndex,
237  const ConnectivityType& connectivity)
238  {
239 
240  const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
241 
242  this->ThreadIndex = threadIndex1D;
243  this->InputIndex = inputIndex;
244  this->OutputIndex = outputIndex;
245  this->VisitIndex = visitIndex;
246  this->LogicalIndex = logicalIndex;
247  this->IndicesIncident = connectivity.GetIndices(logicalIndex);
248  }
249 
256  VTKM_EXEC
257  vtkm::Id GetThreadIndex() const { return this->ThreadIndex; }
258 
264  VTKM_EXEC
265  LogicalIndexType GetIndexLogical() const { return this->LogicalIndex; }
266 
273  VTKM_EXEC
274  vtkm::Id GetInputIndex() const { return this->InputIndex; }
275 
281  VTKM_EXEC
282  vtkm::Id3 GetInputIndex3D() const { return detail::InflateTo3D(this->GetIndexLogical()); }
283 
290  VTKM_EXEC
291  vtkm::Id GetOutputIndex() const { return this->OutputIndex; }
292 
298  VTKM_EXEC
299  vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
300 
308  VTKM_EXEC
309  const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
310 
320  VTKM_EXEC
322 
330  VTKM_EXEC
332 
333 private:
340 };
341 
342 } //namespace arg
343 }
344 } // namespace vtkm::exec
345 
347 
348 #endif
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::OutputIndex
vtkm::Id OutputIndex
Definition: ThreadIndicesExtrude.h:337
vtkm::exec::ReverseConnectivityExtrude::FlatToLogicalToIndex
vtkm::Id2 FlatToLogicalToIndex(vtkm::Id index) const
Definition: ConnectivityExtrude.h:160
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::OutputIndex
vtkm::Id OutputIndex
Definition: ThreadIndicesExtrude.h:180
vtkm::exec::ReverseConnectivityExtrude
Definition: ConnectivityExtrude.h:95
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesExtrude.h:339
FetchExtrude.h
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
vtkm::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:257
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:331
vtkm::exec::arg::ThreadIndicesBasic::ThreadIndex
vtkm::Id ThreadIndex
Definition: ThreadIndicesBasic.h:97
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:338
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::LogicalIndexType
typename ConnectivityType::SchedulingRangeType LogicalIndexType
Definition: ThreadIndicesExtrude.h:33
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::InputIndex
vtkm::Id InputIndex
Definition: ThreadIndicesExtrude.h:178
vtkm::exec::arg::ThreadIndicesTopologyMap::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesTopologyMap.h:154
ThreadIndicesTopologyMap.h
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::IndicesIncidentType
typename ConnectivityType::IndicesType IndicesIncidentType
Definition: ThreadIndicesExtrude.h:32
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex3D
vtkm::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:282
vtkm::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:44
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:74
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(vtkm::Id threadIndex, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:37
vtkm::exec::ReverseIndicesExtrude
Definition: IndicesExtrude.h:71
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
vtkm::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:100
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::IndicesIncidentType
typename ConnectivityType::IndicesType IndicesIncidentType
Definition: ThreadIndicesExtrude.h:193
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::LogicalIndexType
typename ConnectivityType::SchedulingRangeType LogicalIndexType
Definition: ThreadIndicesExtrude.h:194
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:152
ConnectivityExtrude.h
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:309
vtkm::exec::arg::ThreadIndicesBasic::VisitIndex
vtkm::IdComponent VisitIndex
Definition: ThreadIndicesBasic.h:100
vtkm::exec::ConnectivityExtrude::FlatToLogicalToIndex
vtkm::Id2 FlatToLogicalToIndex(vtkm::Id index) const
Definition: ConnectivityExtrude.h:78
vtkm::CellShapeTagVertex
Definition: CellShape.h:148
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:181
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:232
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndex
vtkm::Id ThreadIndex
Definition: ThreadIndicesExtrude.h:334
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::VisitIndex
vtkm::IdComponent VisitIndex
Definition: ThreadIndicesExtrude.h:179
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:216
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
vtkm::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:299
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::exec::IndicesExtrude
Definition: IndicesExtrude.h:21
vtkm::exec::ConnectivityExtrude
Definition: ConnectivityExtrude.h:26
vtkm::exec::ConnectivityExtrude::GetIndices
IndicesType GetIndices(vtkm::Id index) const
Definition: ConnectivityExtrude.h:58
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const IndicesIncidentType * GetIndicesIncidentPointer() const
The input indices of the "from" elements in pointer form.
Definition: ThreadIndicesExtrude.h:164
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:192
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:174
vtkm::Vec< vtkm::Id, 2 >
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:108
vtkm::exec::arg::ThreadIndicesBasic::OutputIndex
vtkm::Id OutputIndex
Definition: ThreadIndicesBasic.h:99
vtkm::exec::ReverseConnectivityExtrude::GetIndices
IndicesType GetIndices(vtkm::Id index) const
Returns a Vec-like object containing the indices for the given index.
Definition: ConnectivityExtrude.h:139
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::IndicesIncident
IndicesIncidentType IndicesIncident
Definition: ThreadIndicesExtrude.h:182
vtkm::exec::arg::ThreadIndicesBasic::InputIndex
vtkm::Id InputIndex
Definition: ThreadIndicesBasic.h:98
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:265
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(vtkm::Id &threadIndex, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:199
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::VisitIndex
vtkm::IdComponent VisitIndex
Definition: ThreadIndicesExtrude.h:336
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::InputIndex
vtkm::Id InputIndex
Definition: ThreadIndicesExtrude.h:335
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex
vtkm::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:274
vtkm::CellShapeTagWedge
Definition: CellShape.h:160
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:56
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndex
vtkm::Id ThreadIndex
Definition: ThreadIndicesExtrude.h:177
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
vtkm::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:142
vtkm::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:46
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex
vtkm::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:117
vtkm::exec::arg::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:43
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
vtkm::exec::arg::ThreadIndicesTopologyMap
Container for thread indices in a topology map.
Definition: ThreadIndicesTopologyMap.h:95
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
vtkm::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:291
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex3D
vtkm::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:125
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const IndicesIncidentType * GetIndicesIncidentPointer() const
The input indices of the "from" elements in pointer form.
Definition: ThreadIndicesExtrude.h:321
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
vtkm::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:134
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:31