VTK-m  2.2
ScatterPermutation.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_ScatterPermutation_h
11 #define vtk_m_worklet_ScatterPermutation_h
12 
13 #include <vtkm/cont/ArrayHandle.h>
16 
17 namespace vtkm
18 {
19 namespace worklet
20 {
21 
31 template <typename PermutationStorage = VTKM_DEFAULT_STORAGE_TAG>
32 class ScatterPermutation : public internal::ScatterBase
33 {
34 private:
36 
37 public:
40 
42  : Permutation(permutation)
43  {
44  }
45 
46  VTKM_CONT
47  template <typename RangeType>
48  vtkm::Id GetOutputRange(RangeType) const
49  {
50  return this->Permutation.GetNumberOfValues();
51  }
52 
53  template <typename RangeType>
55  {
56  return this->Permutation;
57  }
58 
60 
61  VTKM_CONT
63  {
64  return VisitArrayType(0, this->GetOutputRange(inputRange));
65  }
66 
67  VTKM_CONT
69  {
70  return this->GetVisitArray(inputRange[0] * inputRange[1] * inputRange[2]);
71  }
72 
73 private:
75 };
76 }
77 } // vtkm::worklet
78 
79 #endif // vtk_m_worklet_ScatterPermutation_h
vtkm::worklet::ScatterPermutation::Permutation
PermutationArrayHandle Permutation
Definition: ScatterPermutation.h:74
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
vtkm::worklet::ScatterPermutation::GetOutputToInputMap
OutputToInputMapType GetOutputToInputMap() const
Definition: ScatterPermutation.h:59
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ScatterBase.h
vtkm::cont::ArrayHandle::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
ArrayHandleConstant.h
vtkm::worklet::ScatterPermutation::GetOutputRange
vtkm::Id GetOutputRange(RangeType) const
Definition: ScatterPermutation.h:48
vtkm::worklet::ScatterPermutation::PermutationArrayHandle
vtkm::cont::ArrayHandle< vtkm::Id, PermutationStorage > PermutationArrayHandle
Definition: ScatterPermutation.h:35
vtkm::worklet::ScatterPermutation::GetVisitArray
VisitArrayType GetVisitArray(vtkm::Id3 inputRange) const
Definition: ScatterPermutation.h:68
vtkm::worklet::ScatterPermutation::ScatterPermutation
ScatterPermutation(const PermutationArrayHandle &permutation)
Definition: ScatterPermutation.h:41
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::worklet::ScatterPermutation
A scatter that maps input to output based on a permutation array.
Definition: ScatterPermutation.h:32
vtkm::cont::ArrayHandleConstant
An array handle with a constant value.
Definition: ArrayHandleConstant.h:70
vtkm::Vec< vtkm::Id, 3 >
vtkm::worklet::ScatterPermutation::GetOutputToInputMap
OutputToInputMapType GetOutputToInputMap(RangeType) const
Definition: ScatterPermutation.h:54
vtkm::worklet::ScatterPermutation::GetVisitArray
VisitArrayType GetVisitArray(vtkm::Id inputRange) const
Definition: ScatterPermutation.h:62
vtkm::worklet::ScatterPermutation::VisitArrayType
vtkm::cont::ArrayHandleConstant< vtkm::IdComponent > VisitArrayType
Definition: ScatterPermutation.h:39