Viskores  1.0
MaskIndices.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_worklet_MaskIndices_h
19 #define viskores_worklet_MaskIndices_h
20 
23 
24 namespace viskores
25 {
26 namespace worklet
27 {
28 
38 class MaskIndices : public internal::MaskBase
39 {
40 public:
42 
55  explicit MaskIndices(
58  {
59  this->ThreadToOutputMap = indexArray;
60  }
61 
62  template <typename T, typename S>
63  explicit MaskIndices(
64  const viskores::cont::ArrayHandle<T, S>& indexArray,
66  {
67  viskores::cont::Algorithm::Copy(device, indexArray, this->ThreadToOutputMap);
68  }
70 
71  // TODO? Create a version that accepts an UnknownArrayHandle. Is this needed?
72 
73  template <typename RangeType>
74  viskores::Id GetThreadRange(RangeType viskoresNotUsed(outputRange)) const
75  {
76  return this->ThreadToOutputMap.GetNumberOfValues();
77  }
78 
79  template <typename RangeType>
81  {
82  return this->ThreadToOutputMap;
83  }
84 
85 private:
87 };
88 }
89 } // namespace viskores::worklet
90 
91 #endif //viskores_worklet_MaskIndices_h
MaskBase.h
viskores::worklet::MaskIndices
Mask using a given array of indices to include in the output.
Definition: MaskIndices.h:38
viskores::worklet::MaskIndices::MaskIndices
MaskIndices(const viskores::cont::ArrayHandle< T, S > &indexArray, viskores::cont::DeviceAdapterId device=viskores::cont::DeviceAdapterTagAny())
Construct using an index array.
Definition: MaskIndices.h:63
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::worklet::MaskIndices::ThreadToOutputMap
ThreadToOutputMapType ThreadToOutputMap
Definition: MaskIndices.h:86
viskores::cont::ArrayHandle< viskores::Id >
viskores::cont::DeviceAdapterTagAny
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:194
viskores::cont::Algorithm::Copy
static bool Copy(viskores::cont::DeviceAdapterId devId, const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:422
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Algorithm.h
viskores::worklet::MaskIndices::GetThreadRange
viskores::Id GetThreadRange(RangeType) const
Definition: MaskIndices.h:74
viskores::cont::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
viskores::worklet::MaskIndices::MaskIndices
MaskIndices(const viskores::cont::ArrayHandle< viskores::Id > &indexArray, viskores::cont::DeviceAdapterId=viskores::cont::DeviceAdapterTagAny())
Construct using an index array.
Definition: MaskIndices.h:55
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::worklet::MaskIndices::GetThreadToOutputMap
ThreadToOutputMapType GetThreadToOutputMap(RangeType) const
Definition: MaskIndices.h:80