Go to the documentation of this file.
10 #ifndef vtk_m_VecTraits_h
11 #define vtk_m_VecTraits_h
65 "The base VecTraits should not be used with qualifiers.");
148 template <
typename NewComponentType>
160 template <
typename NewComponentType>
165 template <vtkm::IdComponent destSize>
172 template <
typename T>
176 template <
typename T>
180 template <
typename T>
184 template <
typename T>
190 template <
typename T>
213 template <
typename NewComponentType>
214 using ReplaceComponentType =
216 template <
typename NewComponentType>
219 template <vtkm::IdComponent destSize>
227 template <
typename T>
232 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
236 template <
typename NewT, vtkm::IdComponent Size>
237 struct VecReplaceComponentTypeGCC4or5
242 template <
typename T, vtkm::IdComponent Size,
typename NewT>
243 struct VecReplaceBaseComponentTypeGCC4or5
250 #endif // GCC Version 4.8
255 template <vtkm::IdComponent numComponents,
typename ComponentType>
256 struct VecTraitsMultipleComponentChooser
261 template <
typename ComponentType>
262 struct VecTraitsMultipleComponentChooser<1, ComponentType>
269 template <
typename T, vtkm::IdComponent Size>
300 using HasMultipleComponents =
316 return vector[component];
321 return vector[component];
330 vector[component] = value;
340 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
342 template <
typename NewComponentType>
343 using ReplaceComponentType =
344 typename detail::VecReplaceComponentTypeGCC4or5<NewComponentType, Size>::type;
346 template <
typename NewComponentType>
357 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
359 template <
typename NewComponentType>
361 typename detail::VecReplaceBaseComponentTypeGCC4or5<T, Size, NewComponentType>::type;
363 template <
typename NewComponentType>
372 template <vtkm::IdComponent destSize>
379 template <
typename T>
428 return vector[component];
433 return vector[component];
441 vector[component] = value;
451 template <
typename NewComponentType>
460 template <
typename NewComponentType>
466 template <vtkm::IdComponent destSize>
473 template <
typename T>
522 return vector[component];
530 vector[component] = value;
540 template <
typename NewComponentType>
549 template <
typename NewComponentType>
555 template <vtkm::IdComponent destSize>
567 template <
typename ScalarType>
568 struct VTKM_DEPRECATED(2.1, "VecTraitsBasic is now the default implementation for VecTraits.")
571 using ComponentType = ScalarType;
572 using BaseComponentType = ScalarType;
581 static const ComponentType& GetComponent(
const ScalarType& vector,
vtkm::IdComponent)
586 static ComponentType& GetComponent(ScalarType& vector,
vtkm::IdComponent) {
return vector; }
595 template <
typename NewComponentType>
596 using ReplaceComponentType = NewComponentType;
598 template <
typename NewComponentType>
599 using ReplaceBaseComponentType = NewComponentType;
601 template <vtkm::IdComponent destSize>
608 template <
typename T>
621 "basic type by default.") VTKM_BASIC_TYPE_VECTOR_is_deprecated
625 template <
typename T>
626 struct issue_VTKM_BASIC_TYPE_VECTOR_deprecation_warning;
632 #define VTKM_BASIC_TYPE_VECTOR(type) \
638 struct issue_VTKM_BASIC_TYPE_VECTOR_deprecation_warning<type> \
639 : public vtkm::detail::VTKM_BASIC_TYPE_VECTOR_is_deprecated \
645 #endif //vtk_m_VecTraits_h
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:489
static vtkm::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:494
static void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:326
static void SetComponent(T *vector, vtkm::IdComponent component, typename VecTraits< T >::ComponentType value)
Definition: VecTraits.h:207
static vtkm::IdComponent GetNumberOfComponents(const VecType &)
Number of components in the given vector.
Definition: VecTraits.h:294
A tag for vectors that are "true" vectors (i.e.
Definition: VecTraits.h:23
Groups connected points that have the same field value.
Definition: Atomic.h:19
static void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:373
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
static void CopyInto(const T &src, vtkm::Vec< ComponentType, destSize > &dest)
Copies the components in the given vector into a given Vec object.
Definition: VecTraits.h:166
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:482
T ComponentType
Type of the components in the vector.
Definition: VecTraits.h:71
T ComponentType
Definition: Types.h:814
T ComponentType
Definition: Types.h:1288
static ComponentType & GetComponent(VecType &vector, vtkm::IdComponent component)
Definition: VecTraits.h:431
T BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:78
NewComponentType ReplaceComponentType
Get a vector of the same type but with a different component.
Definition: VecTraits.h:149
static constexpr vtkm::IdComponent GetNumberOfComponents(const T &)
Returns the number of components in the given vector.
Definition: VecTraits.h:94
static void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:528
static vtkm::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:400
A const version of VecC.
Definition: Types.h:363
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
static void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:467
static ComponentType & GetComponent(T &vector, vtkm::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:123
static void SetComponent(T &vector, vtkm::IdComponent, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:131
static const ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:426
static void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:556
constexpr vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1434
static ComponentType & GetComponent(VecType &vector, vtkm::IdComponent component)
Definition: VecTraits.h:319
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
static const ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:520
T ComponentType
Definition: Types.h:1382
static auto GetComponent(const T *vector, vtkm::IdComponent component) -> decltype(VecTraits< T >::GetComponent(*vector, component))
Definition: VecTraits.h:197
static auto GetComponent(T *vector, vtkm::IdComponent component) -> decltype(VecTraits< T >::GetComponent(*vector, component))
Definition: VecTraits.h:202
A short fixed-length array.
Definition: Types.h:357
static void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:439
static const ComponentType & GetComponent(const T &vector, vtkm::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:117
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:395
static const ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:314
static vtkm::IdComponent GetNumberOfComponents(const T *vector)
Definition: VecTraits.h:193
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:388
void CopyInto(Vec< T, Size > &dest) const
Definition: Types.h:828
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:285
static void CopyInto(const T *src, vtkm::Vec< typename VecTraits< T >::ComponentType, destSize > &dest)
Definition: VecTraits.h:220
#define VTKM_NEVER_EXPORT
Definition: ExportMacros.h:90
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:61
A Vec-like representation for short arrays.
Definition: Types.h:360
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:278
constexpr vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1340
NewComponentType ReplaceBaseComponentType
Get a vector of the same type but with a different base component.
Definition: VecTraits.h:161
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
std::true_type HasVecTraits
Definition: VecTraits.h:173
Definition: VecTraits.h:191
#define VTKM_BASIC_TYPE_VECTOR(type)
Definition: VecTraits.h:632