Viskores  1.0
ScatterPermutation.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_ScatterPermutation_h
19 #define viskores_worklet_ScatterPermutation_h
20 
24 
25 namespace viskores
26 {
27 namespace worklet
28 {
29 
39 template <typename PermutationStorage = VISKORES_DEFAULT_STORAGE_TAG>
40 class ScatterPermutation : public internal::ScatterBase
41 {
42 private:
44 
45 public:
48 
50  : Permutation(permutation)
51  {
52  }
53 
55  template <typename RangeType>
56  viskores::Id GetOutputRange(RangeType) const
57  {
58  return this->Permutation.GetNumberOfValues();
59  }
60 
61  template <typename RangeType>
63  {
64  return this->Permutation;
65  }
66 
68 
71  {
72  return VisitArrayType(0, this->GetOutputRange(inputRange));
73  }
74 
77  {
78  return this->GetVisitArray(inputRange[0] * inputRange[1] * inputRange[2]);
79  }
80 
81 private:
83 };
84 }
85 } // viskores::worklet
86 
87 #endif // viskores_worklet_ScatterPermutation_h
ArrayHandle.h
viskores::worklet::ScatterPermutation::Permutation
PermutationArrayHandle Permutation
Definition: ScatterPermutation.h:82
ScatterBase.h
viskores::worklet::ScatterPermutation::GetVisitArray
VisitArrayType GetVisitArray(viskores::Id inputRange) const
Definition: ScatterPermutation.h:70
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::worklet::ScatterPermutation
A scatter that maps input to output based on a permutation array.
Definition: ScatterPermutation.h:40
ArrayHandleConstant.h
viskores::worklet::ScatterPermutation::GetOutputRange
viskores::Id GetOutputRange(RangeType) const
Definition: ScatterPermutation.h:56
viskores::worklet::ScatterPermutation::VisitArrayType
viskores::cont::ArrayHandleConstant< viskores::IdComponent > VisitArrayType
Definition: ScatterPermutation.h:47
viskores::worklet::ScatterPermutation::GetOutputToInputMap
OutputToInputMapType GetOutputToInputMap(RangeType) const
Definition: ScatterPermutation.h:62
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::worklet::ScatterPermutation::PermutationArrayHandle
viskores::cont::ArrayHandle< viskores::Id, PermutationStorage > PermutationArrayHandle
Definition: ScatterPermutation.h:43
viskores::cont::ArrayHandleConstant
An array handle with a constant value.
Definition: ArrayHandleConstant.h:78
viskores::cont::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
viskores::worklet::ScatterPermutation::GetVisitArray
VisitArrayType GetVisitArray(viskores::Id3 inputRange) const
Definition: ScatterPermutation.h:76
viskores::worklet::ScatterPermutation::GetOutputToInputMap
OutputToInputMapType GetOutputToInputMap() const
Definition: ScatterPermutation.h:67
viskores::worklet::ScatterPermutation::ScatterPermutation
ScatterPermutation(const PermutationArrayHandle &permutation)
Definition: ScatterPermutation.h:49
viskores::Vec< viskores::Id, 3 >