Go to the documentation of this file.
10 #ifndef vtk_m_cont_ArrayHandleCounting_h
11 #define vtk_m_cont_ArrayHandleCounting_h
35 template <
class CountingValueType>
41 using ValueType = CountingValueType;
52 ArrayPortalCounting(ValueType start, ValueType step,
vtkm::Id numValues)
55 , NumberOfValues(numValues)
60 ValueType GetStart()
const {
return this->Start; }
63 ValueType GetStep()
const {
return this->Step; }
66 vtkm::Id GetNumberOfValues()
const {
return this->NumberOfValues; }
71 return ValueType(this->Start + this->Step * ValueType(
static_cast<ComponentType
>(index)));
89 static constexpr
bool IsNumeric =
90 !std::is_same<typename TTraits::NumericTag, vtkm::TypeTraitsUnknownTag>::value;
91 static constexpr
bool IsBool = std::is_same<BaseType, bool>::value;
93 static constexpr
bool value = IsNumeric && !IsBool;
102 static constexpr
bool value = detail::CanCountImpl<T>::value;
105 template <
typename T>
106 using StorageTagCountingSuperclass =
109 template <
typename T>
110 struct Storage<T, typename std::enable_if<CanCount<T>::value, vtkm::cont::StorageTagCounting>::type>
111 : Storage<T, StorageTagCountingSuperclass<T>>
120 template <
typename CountingValueType>
131 :
Superclass(internal::PortalToArrayHandleImplicitBuffers(
132 internal::ArrayPortalCounting<CountingValueType>(start, step, length)))
143 template <
typename CountingValueType>
153 template <
typename S>
154 struct ArrayRangeComputeImpl;
159 template <
typename T>
168 result.
Allocate(Traits::NUM_COMPONENTS);
179 firstAndLast = GetFirstAndLastUnmaskedIndices(maskArray, device);
182 if (firstAndLast[1] < firstAndLast[0])
194 auto firstComponent = Traits::GetComponent(first, cIndex);
195 auto lastComponent = Traits::GetComponent(last, cIndex);
197 vtkm::Range(vtkm::Min(firstComponent, lastComponent),
198 vtkm::Max(firstComponent, lastComponent)));
218 template <
typename T>
219 struct SerializableTypeString<
vtkm::cont::ArrayHandleCounting<T>>
228 template <
typename T>
229 struct SerializableTypeString<
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagCounting>>
230 : SerializableTypeString<vtkm::cont::ArrayHandleCounting<T>>
239 template <
typename T>
240 struct Serialization<
vtkm::cont::ArrayHandleCounting<T>>
247 static VTKM_CONT void save(BinaryBuffer& bb,
const BaseType& obj)
249 auto portal = obj.ReadPortal();
250 vtkmdiy::save(bb, portal.GetStart());
251 vtkmdiy::save(bb, portal.GetStep());
252 vtkmdiy::save(bb, portal.GetNumberOfValues());
268 template <
typename T>
269 struct Serialization<
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagCounting>>
270 : Serialization<vtkm::cont::ArrayHandleCounting<T>>
276 #endif //vtk_m_cont_ArrayHandleCounting_h
vtkm::VecFlat< T > make_VecFlat(const T &vec)
Converts a Vec-like object to a VecFlat.
Definition: VecFlat.h:281
Manages an array-worth of data.
Definition: ArrayHandle.h:300
T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
Groups connected points that have the same field value.
Definition: Atomic.h:19
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
auto Get(const vtkm::Tuple< Ts... > &tuple)
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:81
#define VTKM_ARRAY_HANDLE_SUBCLASS(classname, fullclasstype, superclass)
Macro to make default methods in ArrayHandle subclasses.
Definition: ArrayHandle.h:243
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
An implementation for read-only implicit arrays.
Definition: ArrayHandleImplicit.h:86
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
void Fill(const ValueType &fillValue, vtkm::Id startIndex, vtkm::Id endIndex, vtkm::cont::Token &token) const
Fills the array with a given value.
Definition: ArrayHandle.h:552
CountingValueType GetStart() const
Definition: ArrayHandleCounting.h:136
T ComponentType
Type of the components in the vector.
Definition: VecTraits.h:71
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:466
vtkm::cont::ArrayHandleCounting< CountingValueType > make_ArrayHandleCounting(CountingValueType start, CountingValueType step, vtkm::Id length)
A convenience function for creating an ArrayHandleCounting.
Definition: ArrayHandleCounting.h:145
Definition: Particle.h:351
ArrayHandleCounting(CountingValueType start, CountingValueType step, vtkm::Id length)
Definition: ArrayHandleCounting.h:130
T BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:78
Definition: ArrayHandleCounting.h:27
ArrayHandleCounting is a specialization of ArrayHandle.
Definition: ArrayHandleCounting.h:121
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
CountingValueType GetStep() const
Definition: ArrayHandleCounting.h:138
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:431
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
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:488
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:61
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:89
WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:452
typename vtkm::cont::detail::GetTypeInParentheses< void(vtkm::cont::ArrayHandle< CountingValueType, StorageTagCounting >) >::type Superclass
Definition: ArrayHandleCounting.h:127
Represent a continuous scalar range of values.
Definition: Range.h:31