VTK-m  2.0
MaskIndices.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_worklet_MaskIndices_h
11 #define vtk_m_worklet_MaskIndices_h
12 
13 #include <vtkm/cont/Algorithm.h>
15 
16 namespace vtkm
17 {
18 namespace worklet
19 {
20 
30 class MaskIndices : public internal::MaskBase
31 {
32 public:
34 
47  explicit MaskIndices(
48  const vtkm::cont::ArrayHandle<vtkm::Id>& indexArray,
49  vtkm::cont::DeviceAdapterId vtkmNotUsed(device) = vtkm::cont::DeviceAdapterTagAny())
50  {
51  this->ThreadToOutputMap = indexArray;
52  }
53 
54  template <typename T, typename S>
55  explicit MaskIndices(const vtkm::cont::ArrayHandle<T, S>& indexArray,
56  vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
57  {
58  vtkm::cont::Algorithm::Copy(device, indexArray, this->ThreadToOutputMap);
59  }
61 
62  // TODO? Create a version that accepts an UnknownArrayHandle. Is this needed?
63 
64  template <typename RangeType>
65  vtkm::Id GetThreadRange(RangeType vtkmNotUsed(outputRange)) const
66  {
67  return this->ThreadToOutputMap.GetNumberOfValues();
68  }
69 
70  template <typename RangeType>
72  {
73  return this->ThreadToOutputMap;
74  }
75 
76 private:
78 };
79 }
80 } // namespace vtkm::worklet
81 
82 #endif //vtk_m_worklet_MaskIndices_h
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::worklet::MaskIndices::ThreadToOutputMap
ThreadToOutputMapType ThreadToOutputMap
Definition: MaskIndices.h:77
MaskBase.h
vtkm::cont::ArrayHandle< vtkm::Id >
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::MaskIndices::MaskIndices
MaskIndices(const vtkm::cont::ArrayHandle< vtkm::Id > &indexArray, vtkm::cont::DeviceAdapterId vtkmNotUsed(device)=vtkm::cont::DeviceAdapterTagAny())
Construct using an index array.
Definition: MaskIndices.h:47
vtkm::cont::Algorithm::Copy
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Algorithm.h
vtkm::worklet::MaskIndices::GetThreadRange
vtkm::Id GetThreadRange(RangeType vtkmNotUsed(outputRange)) const
Definition: MaskIndices.h:65
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::cont::DeviceAdapterId
Definition: DeviceAdapterTag.h:52
vtkm::worklet::MaskIndices::MaskIndices
MaskIndices(const vtkm::cont::ArrayHandle< T, S > &indexArray, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny())
Construct using an index array.
Definition: MaskIndices.h:55
vtkm::worklet::MaskIndices
Mask using a given array of indices to include in the output.
Definition: MaskIndices.h:30
vtkm::worklet::MaskIndices::GetThreadToOutputMap
ThreadToOutputMapType GetThreadToOutputMap(RangeType vtkmNotUsed(outputRange)) const
Definition: MaskIndices.h:71