Go to the documentation of this file.
18 #ifndef viskores_VecTraits_h
19 #define viskores_VecTraits_h
73 "The base VecTraits should not be used with qualifiers.");
158 template <
typename NewComponentType>
170 template <
typename NewComponentType>
175 template <viskores::IdComponent destSize>
183 template <
typename T>
185 "All types now have VecTraits defined.") = std::true_type;
188 template <
typename T>
192 template <
typename T>
196 template <
typename T>
202 template <
typename T>
225 template <
typename NewComponentType>
226 using ReplaceComponentType =
228 template <
typename NewComponentType>
231 template <viskores::IdComponent destSize>
239 template <
typename T>
244 #if defined(VISKORES_GCC) && (__GNUC__ <= 5)
248 template <
typename NewT, viskores::IdComponent Size>
249 struct VecReplaceComponentTypeGCC4or5
254 template <
typename T, viskores::IdComponent Size,
typename NewT>
255 struct VecReplaceBaseComponentTypeGCC4or5
262 #endif // GCC Version 4.8
267 template <viskores::IdComponent numComponents,
typename ComponentType>
268 struct VecTraitsMultipleComponentChooser
273 template <
typename ComponentType>
274 struct VecTraitsMultipleComponentChooser<1, ComponentType>
281 template <
typename T, viskores::IdComponent Size>
312 using HasMultipleComponents =
328 return vector[component];
333 return vector[component];
342 vector[component] = value;
352 #if defined(VISKORES_GCC) && (__GNUC__ <= 5)
354 template <
typename NewComponentType>
355 using ReplaceComponentType =
356 typename detail::VecReplaceComponentTypeGCC4or5<NewComponentType, Size>::type;
358 template <
typename NewComponentType>
369 #if defined(VISKORES_GCC) && (__GNUC__ <= 5)
371 template <
typename NewComponentType>
373 typename detail::VecReplaceBaseComponentTypeGCC4or5<T, Size, NewComponentType>::type;
375 template <
typename NewComponentType>
385 template <viskores::IdComponent destSize>
393 template <
typename T>
442 return vector[component];
447 return vector[component];
455 vector[component] = value;
465 template <
typename NewComponentType>
474 template <
typename NewComponentType>
480 template <viskores::IdComponent destSize>
488 template <
typename T>
537 return vector[component];
545 vector[component] = value;
555 template <
typename NewComponentType>
564 template <
typename NewComponentType>
570 template <viskores::IdComponent destSize>
583 template <
typename ScalarType>
584 struct VISKORES_DEPRECATED(2.1, "VecTraitsBasic is now the default implementation for VecTraits.")
585 VISKORES_NEVER_EXPORT VecTraitsBasic
587 using ComponentType = ScalarType;
588 using BaseComponentType = ScalarType;
611 template <
typename NewComponentType>
612 using ReplaceComponentType = NewComponentType;
614 template <
typename NewComponentType>
615 using ReplaceBaseComponentType = NewComponentType;
617 template <viskores::IdComponent destSize>
625 template <
typename T>
639 "basic type by default.") VISKORES_BASIC_TYPE_VECTOR_is_deprecated
643 template <
typename T>
644 struct issue_VISKORES_BASIC_TYPE_VECTOR_deprecation_warning;
650 #define VISKORES_BASIC_TYPE_VECTOR(type) \
656 struct issue_VISKORES_BASIC_TYPE_VECTOR_deprecation_warning<type> \
657 : public viskores::detail::VISKORES_BASIC_TYPE_VECTOR_is_deprecated \
663 #endif //viskores_VecTraits_h
static void SetComponent(T &vector, viskores::IdComponent, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:141
static void CopyInto(const T *src, viskores::Vec< typename VecTraits< T >::ComponentType, destSize > &dest)
Definition: VecTraits.h:232
static void CopyInto(const VecType &src, viskores::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard Viskores Tuple.
Definition: VecTraits.h:481
typename viskores::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:409
typename viskores::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:504
static void SetComponent(VecType &vector, viskores::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:543
static void CopyInto(const VecType &src, viskores::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard Viskores Tuple.
Definition: VecTraits.h:386
A const version of VecC.
Definition: Types.h:371
constexpr viskores::IdComponent GetNumberOfComponents() const
Definition: Types.h:1444
static viskores::IdComponent GetNumberOfComponents(const VecType &)
Number of components in the given vector.
Definition: VecTraits.h:306
constexpr viskores::IdComponent GetNumberOfComponents() const
Definition: Types.h:1350
A Vec-like representation for short arrays.
Definition: Types.h:368
std::true_type HasVecTraits
Definition: VecTraits.h:185
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
void CopyInto(Vec< T, Size > &dest) const
Definition: Types.h:837
A tag for vectors that are "true" vectors (i.e.
Definition: VecTraits.h:31
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
static void SetComponent(VecType &vector, viskores::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:453
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
static viskores::IdComponent GetNumberOfComponents(const T *vector)
Definition: VecTraits.h:205
static viskores::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:509
static auto GetComponent(const T *vector, viskores::IdComponent component) -> decltype(VecTraits< T >::GetComponent(*vector, component))
Definition: VecTraits.h:209
static const ComponentType & GetComponent(const T &vector, viskores::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:125
T ComponentType
Definition: Types.h:1298
static constexpr viskores::IdComponent GetNumberOfComponents(const T &)
Returns the number of components in the given vector.
Definition: VecTraits.h:102
Groups connected points that have the same field value.
Definition: Atomic.h:27
NewComponentType ReplaceComponentType
Get a vector of the same type but with a different component.
Definition: VecTraits.h:159
static ComponentType & GetComponent(VecType &vector, viskores::IdComponent component)
Definition: VecTraits.h:445
static ComponentType & GetComponent(T &vector, viskores::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:132
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:69
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:290
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
static void CopyInto(const T &src, viskores::Vec< ComponentType, destSize > &dest)
Copies the components in the given vector into a given Vec object.
Definition: VecTraits.h:176
static auto GetComponent(T *vector, viskores::IdComponent component) -> decltype(VecTraits< T >::GetComponent(*vector, component))
Definition: VecTraits.h:214
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
typename viskores::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:297
static const ComponentType & GetComponent(const VecType &vector, viskores::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:535
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:402
static void CopyInto(const VecType &src, viskores::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard Viskores Tuple.
Definition: VecTraits.h:571
static ComponentType & GetComponent(VecType &vector, viskores::IdComponent component)
Definition: VecTraits.h:331
T ComponentType
Definition: Types.h:1392
NewComponentType ReplaceBaseComponentType
Get a vector of the same type but with a different base component.
Definition: VecTraits.h:171
T ComponentType
Type of the components in the vector.
Definition: VecTraits.h:79
Definition: VecTraits.h:203
static const ComponentType & GetComponent(const VecType &vector, viskores::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:326
T ComponentType
Definition: Types.h:823
T BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:86
static const ComponentType & GetComponent(const VecType &vector, viskores::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:440
static void SetComponent(VecType &vector, viskores::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:338
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:497
static viskores::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:414
A short fixed-length array.
Definition: Types.h:365
static void SetComponent(T *vector, viskores::IdComponent component, typename VecTraits< T >::ComponentType value)
Definition: VecTraits.h:219
#define VISKORES_BASIC_TYPE_VECTOR(type)
Definition: VecTraits.h:650