VTK-m  2.2
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,
50  {
51  this->ThreadToOutputMap = indexArray;
52  }
53 
54  template <typename T, typename S>
55  explicit MaskIndices(const vtkm::cont::ArrayHandle<T, S>& indexArray,
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::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::cont::ArrayHandle::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
vtkm::worklet::MaskIndices::GetThreadRange
vtkm::Id GetThreadRange(RangeType) const
Definition: MaskIndices.h:65
Algorithm.h
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::cont::DeviceAdapterTagAny
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:180
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::cont::Algorithm::Copy
static bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:411
vtkm::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
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::GetThreadToOutputMap
ThreadToOutputMapType GetThreadToOutputMap(RangeType) const
Definition: MaskIndices.h:71
vtkm::worklet::MaskIndices
Mask using a given array of indices to include in the output.
Definition: MaskIndices.h:30
vtkm::worklet::MaskIndices::MaskIndices
MaskIndices(const vtkm::cont::ArrayHandle< vtkm::Id > &indexArray, vtkm::cont::DeviceAdapterId=vtkm::cont::DeviceAdapterTagAny())
Construct using an index array.
Definition: MaskIndices.h:47