VTK-m  2.0
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
174  CellShapeTag GetCellShape() const { return vtkm::CellShapeTagWedge{}; }
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
331  CellShapeTag GetCellShape() const { return vtkm::CellShapeTagVertex{}; }
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::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
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::exec::ReverseConnectivityExtrude::GetIndices
VTKM_EXEC IndicesType GetIndices(vtkm::Id index) const
Returns a Vec-like object containing the indices for the given index.
Definition: ConnectivityExtrude.h:139
vtkm::exec::ConnectivityExtrude::FlatToLogicalToIndex
VTKM_EXEC vtkm::Id2 FlatToLogicalToIndex(vtkm::Id index) const
Definition: ConnectivityExtrude.h:78
vtkm::exec::arg::ThreadIndicesBasic::ThreadIndex
vtkm::Id ThreadIndex
Definition: ThreadIndicesBasic.h:97
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
VTKM_EXEC vtkm::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:134
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:338
vtkm::exec::ConnectivityExtrude::GetIndices
VTKM_EXEC IndicesType GetIndices(vtkm::Id index) const
Definition: ConnectivityExtrude.h:58
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_EXEC ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:216
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
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::ConnectivityExtrude::CellShapeTag
vtkm::CellShapeTagWedge CellShapeTag
Definition: ConnectivityExtrude.h:38
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::ConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
VTKM_EXEC vtkm::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:100
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetThreadIndex
VTKM_EXEC vtkm::Id GetThreadIndex() const
The index of the thread or work invocation.
Definition: ThreadIndicesExtrude.h:257
vtkm::exec::arg::OutputIndex
The ExecutionSignature tag to use to get the output index.
Definition: OutputIndex.h:42
vtkm::exec::ReverseIndicesExtrude
Definition: IndicesExtrude.h:71
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
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::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id &threadIndex, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:199
ConnectivityExtrude.h
vtkm::exec::arg::ThreadIndicesBasic::VisitIndex
vtkm::IdComponent VisitIndex
Definition: ThreadIndicesBasic.h:100
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex
VTKM_EXEC vtkm::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:274
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC ThreadIndicesTopologyMap(const vtkm::Id3 &threadIndex3D, vtkm::Id threadIndex1D, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:56
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::LogicalIndex
LogicalIndexType LogicalIndex
Definition: ThreadIndicesExtrude.h:181
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
VTKM_EXEC LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:265
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::ReverseConnectivityExtrude::FlatToLogicalToIndex
VTKM_EXEC vtkm::Id2 FlatToLogicalToIndex(vtkm::Id index) const
Definition: ConnectivityExtrude.h:160
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
VTKM_EXEC vtkm::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:142
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC 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::IndicesExtrude
Definition: IndicesExtrude.h:21
vtkm::exec::ConnectivityExtrude
Definition: ConnectivityExtrude.h:26
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetOutputIndex
VTKM_EXEC vtkm::Id GetOutputIndex() const
The index into the output domain.
Definition: ThreadIndicesExtrude.h:291
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:192
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const VTKM_EXEC IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:309
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const VTKM_EXEC 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 >::GetInputIndex
VTKM_EXEC vtkm::Id GetInputIndex() const
The index into the input domain.
Definition: ThreadIndicesExtrude.h:117
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
VTKM_EXEC CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:331
vtkm::Vec< vtkm::Id, 2 >
vtkm::exec::arg::ThreadIndicesBasic::OutputIndex
vtkm::Id OutputIndex
Definition: ThreadIndicesBasic.h:99
vtkm::exec::ReverseConnectivityExtrude::CellShapeTag
vtkm::CellShapeTagVertex CellShapeTag
Definition: ConnectivityExtrude.h:109
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::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id threadIndex, vtkm::Id inputIndex, vtkm::IdComponent visitIndex, vtkm::Id outputIndex, const ConnectivityType &connectivity)
Definition: ThreadIndicesExtrude.h:37
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::VisitIndex
vtkm::IdComponent VisitIndex
Definition: ThreadIndicesExtrude.h:336
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetCellShape
VTKM_EXEC CellShapeTag GetCellShape() const
The shape of the input cell.
Definition: ThreadIndicesExtrude.h:174
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncident
const VTKM_EXEC IndicesIncidentType & GetIndicesIncident() const
The input indices of the "from" elements.
Definition: ThreadIndicesExtrude.h:152
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::InputIndex
vtkm::Id InputIndex
Definition: ThreadIndicesExtrude.h:335
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::GetVisitIndex
VTKM_EXEC vtkm::IdComponent GetVisitIndex() const
The visit index.
Definition: ThreadIndicesExtrude.h:299
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetInputIndex3D
VTKM_EXEC vtkm::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:125
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::ThreadIndex
vtkm::Id ThreadIndex
Definition: ThreadIndicesExtrude.h:177
vtkm::exec::arg::VisitIndex
The ExecutionSignature tag to use to get the visit index.
Definition: VisitIndex.h:43
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ReverseConnectivityExtrude, ScatterAndMaskMode >::ThreadIndicesTopologyMap
VTKM_EXEC 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::InputIndex
The ExecutionSignature tag to use to get the input index.
Definition: InputIndex.h:42
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::ConnectivityExtrude, ScatterAndMaskMode >::GetIndexLogical
VTKM_EXEC LogicalIndexType GetIndexLogical() const
The logical index into the input domain.
Definition: ThreadIndicesExtrude.h:108
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::GetIndicesIncidentPointer
const VTKM_EXEC 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 >::GetInputIndex3D
VTKM_EXEC vtkm::Id3 GetInputIndex3D() const
The 3D index into the input domain.
Definition: ThreadIndicesExtrude.h:282
vtkm::exec::arg::ThreadIndicesTopologyMap< vtkm::exec::ConnectivityExtrude, ScatterAndMaskMode >::CellShapeTag
typename ConnectivityType::CellShapeTag CellShapeTag
Definition: ThreadIndicesExtrude.h:31