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;
57 ArrayPortalCounting(ValueType start, ValueType step,
vtkm::Id numValues)
60 , NumberOfValues(numValues)
66 ValueType GetStart()
const {
return this->Start; }
70 ValueType GetStep()
const {
return this->Step; }
74 vtkm::Id GetNumberOfValues()
const {
return this->NumberOfValues; }
80 return ValueType(this->Start + this->Step * ValueType(
static_cast<ComponentType
>(index)));
98 static constexpr
bool IsNumeric =
99 !std::is_same<typename TTraits::NumericTag, vtkm::TypeTraitsUnknownTag>::value;
100 static constexpr
bool IsBool = std::is_same<BaseType, bool>::value;
102 static constexpr
bool value = IsNumeric && !IsBool;
108 template <
typename T>
111 static constexpr
bool value = detail::CanCountImpl<T>::value;
114 template <
typename T>
115 using StorageTagCountingSuperclass =
118 template <
typename T>
119 struct Storage<T, typename std::enable_if<CanCount<T>::value, vtkm::cont::StorageTagCounting>::type>
120 : Storage<T, StorageTagCountingSuperclass<T>>
129 template <
typename CountingValueType>
140 :
Superclass(internal::PortalToArrayHandleImplicitBuffers(
141 internal::ArrayPortalCounting<CountingValueType>(start, step, length)))
152 template <
typename CountingValueType>
162 template <
typename S>
163 struct ArrayRangeComputeImpl;
168 template <
typename T>
177 result.
Allocate(Traits::NUM_COMPONENTS);
188 firstAndLast = GetFirstAndLastUnmaskedIndices(maskArray, device);
191 if (firstAndLast[1] < firstAndLast[0])
203 auto firstComponent = Traits::GetComponent(first, cIndex);
204 auto lastComponent = Traits::GetComponent(last, cIndex);
206 vtkm::Range(vtkm::Min(firstComponent, lastComponent),
207 vtkm::Max(firstComponent, lastComponent)));
227 template <
typename T>
228 struct SerializableTypeString<
vtkm::cont::ArrayHandleCounting<T>>
237 template <
typename T>
238 struct SerializableTypeString<
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagCounting>>
239 : SerializableTypeString<vtkm::cont::ArrayHandleCounting<T>>
248 template <
typename T>
249 struct Serialization<
vtkm::cont::ArrayHandleCounting<T>>
256 static VTKM_CONT void save(BinaryBuffer& bb,
const BaseType& obj)
258 auto portal = obj.ReadPortal();
259 vtkmdiy::save(bb, portal.GetStart());
260 vtkmdiy::save(bb, portal.GetStep());
261 vtkmdiy::save(bb, portal.GetNumberOfValues());
277 template <
typename T>
278 struct Serialization<
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagCounting>>
279 : Serialization<vtkm::cont::ArrayHandleCounting<T>>
285 #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:554
CountingValueType GetStart() const
Definition: ArrayHandleCounting.h:145
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:468
vtkm::cont::ArrayHandleCounting< CountingValueType > make_ArrayHandleCounting(CountingValueType start, CountingValueType step, vtkm::Id length)
A convenience function for creating an ArrayHandleCounting.
Definition: ArrayHandleCounting.h:154
Definition: Particle.h:351
ArrayHandleCounting(CountingValueType start, CountingValueType step, vtkm::Id length)
Definition: ArrayHandleCounting.h:139
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:130
#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:147
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:433
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:490
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:454
typename vtkm::cont::detail::GetTypeInParentheses< void(vtkm::cont::ArrayHandle< CountingValueType, StorageTagCounting >) >::type Superclass
Definition: ArrayHandleCounting.h:136
Represent a continuous scalar range of values.
Definition: Range.h:31