Go to the documentation of this file.
10 #ifndef vtk_m_cont_ArrayRangeCompute_h
11 #define vtk_m_cont_ArrayRangeCompute_h
60 #define VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(T, Storage) \
63 vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute( \
64 const vtkm::cont::ArrayHandle<T, Storage>& input, \
65 vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
66 #define VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(T, N, Storage) \
69 vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeCompute( \
70 const vtkm::cont::ArrayHandle<vtkm::Vec<T, N>, Storage>& input, \
71 vtkm::cont::DeviceAdapterId device = vtkm::cont::DeviceAdapterTagAny())
73 #define VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_SCALAR_T(Storage) \
74 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Int8, Storage); \
75 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::UInt8, Storage); \
76 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Int16, Storage); \
77 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::UInt16, Storage); \
78 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Int32, Storage); \
79 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::UInt32, Storage); \
80 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Int64, Storage); \
81 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::UInt64, Storage); \
82 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Float32, Storage); \
83 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(vtkm::Float64, Storage); \
84 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(char, Storage); \
85 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(signed VTKM_UNUSED_INT_TYPE, Storage); \
86 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T(unsigned VTKM_UNUSED_INT_TYPE, Storage)
88 #define VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_VEC(N, Storage) \
89 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Int8, N, Storage); \
90 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::UInt8, N, Storage); \
91 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Int16, N, Storage); \
92 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::UInt16, N, Storage); \
93 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Int32, N, Storage); \
94 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::UInt32, N, Storage); \
95 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Int64, N, Storage); \
96 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::UInt64, N, Storage); \
97 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Float32, N, Storage); \
98 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Float64, N, Storage); \
99 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(char, N, Storage); \
100 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(signed VTKM_UNUSED_INT_TYPE, N, Storage); \
101 VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(unsigned VTKM_UNUSED_INT_TYPE, N, Storage)
118 #undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T
119 #undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC
120 #undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_SCALAR_T
121 #undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_VEC
129 template <
typename T,
typename ST1,
typename ST2,
typename ST3>
147 componentRange = componentRangeArray.
ReadPortal().Get(0);
152 componentRange = componentRangeArray.
ReadPortal().Get(0);
157 componentRange = componentRangeArray.
ReadPortal().Get(0);
164 template <
typename T>
177 auto component = Traits::GetComponent(value, cIndex);
178 portal.Set(cIndex,
vtkm::Range(component, component));
184 template <
typename T>
191 result.
Allocate(Traits::NUM_COMPONENTS);
193 if (portal.GetNumberOfValues() > 0)
199 auto firstComponent = Traits::GetComponent(first, cIndex);
200 auto lastComponent = Traits::GetComponent(last, cIndex);
202 vtkm::Range(vtkm::Min(firstComponent, lastComponent),
203 vtkm::Max(firstComponent, lastComponent)));
227 #endif //vtk_m_cont_ArrayRangeCompute_h
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_CONT ThirdHandleType GetThirdArray() const
Definition: ArrayHandleCartesianProduct.h:372
VTKM_CONT void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:465
VTKM_CONT T GetValue() const
Returns the constant value stored in this array.
Definition: ArrayHandleConstant.h:81
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:406
ArrayHandleCartesianProduct is a specialization of ArrayHandle.
Definition: ArrayHandleCartesianProduct.h:326
Definition: ArrayHandleCartesianProduct.h:159
VTKM_CONT_EXPORT void ThrowArrayRangeComputeFailed()
VTKM_CONT SecondHandleType GetSecondArray() const
Definition: ArrayHandleCartesianProduct.h:368
#define VTKM_CONT
Definition: ExportMacros.h:57
Definition: ArrayHandleXGCCoordinates.h:136
VTKM_CONT WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:435
An array handle with a constant value.
Definition: ArrayHandleConstant.h:63
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
VTKM_CONT FirstHandleType GetFirstArray() const
Definition: ArrayHandleCartesianProduct.h:364
Definition: DeviceAdapterTag.h:52
VTKM_CONT ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:414
float Float32
Definition: Types.h:154
A tag for the basic implementation of a Storage object.
Definition: ArrayHandle.h:45
double Float64
Definition: Types.h:155
VTKM_CONT_EXPORT vtkm::cont::ArrayHandle< vtkm::Range > ArrayRangeCompute(const vtkm::cont::UnknownArrayHandle &array, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny{})
Compute the range of the data in an array handle.
Represent a continuous scalar range of values.
Definition: Range.h:31