VTK-m  2.0
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
62  VisitArrayType GetVisitArray(vtkm::Id inputRange) const { return VisitArrayType(0, inputRange); }
63 
64  VTKM_CONT
66  {
67  return this->GetVisitArray(inputRange[0] * inputRange[1] * inputRange[2]);
68  }
69 
70 private:
72 };
73 }
74 } // vtkm::worklet
75 
76 #endif // vtk_m_worklet_ScatterPermutation_h
vtkm::worklet::ScatterPermutation::Permutation
PermutationArrayHandle Permutation
Definition: ScatterPermutation.h:71
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
ArrayHandle.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::ScatterPermutation::GetVisitArray
VTKM_CONT VisitArrayType GetVisitArray(vtkm::Id3 inputRange) const
Definition: ScatterPermutation.h:65
ScatterBase.h
vtkm::worklet::ScatterPermutation::GetOutputRange
VTKM_CONT vtkm::Id GetOutputRange(RangeType) const
Definition: ScatterPermutation.h:48
ArrayHandleConstant.h
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::ScatterPermutation::PermutationArrayHandle
vtkm::cont::ArrayHandle< vtkm::Id, PermutationStorage > PermutationArrayHandle
Definition: ScatterPermutation.h:35
vtkm::worklet::ScatterPermutation::ScatterPermutation
ScatterPermutation(const PermutationArrayHandle &permutation)
Definition: ScatterPermutation.h:41
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
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:63
vtkm::worklet::ScatterPermutation::GetVisitArray
VTKM_CONT VisitArrayType GetVisitArray(vtkm::Id inputRange) const
Definition: ScatterPermutation.h:62
vtkm::Vec< vtkm::Id, 3 >
vtkm::worklet::ScatterPermutation::GetOutputToInputMap
VTKM_CONT OutputToInputMapType GetOutputToInputMap() const
Definition: ScatterPermutation.h:59
vtkm::worklet::ScatterPermutation::GetOutputToInputMap
VTKM_CONT OutputToInputMapType GetOutputToInputMap(RangeType) const
Definition: ScatterPermutation.h:54
vtkm::worklet::ScatterPermutation::VisitArrayType
vtkm::cont::ArrayHandleConstant< vtkm::IdComponent > VisitArrayType
Definition: ScatterPermutation.h:39