Go to the documentation of this file.
10 #ifndef vtk_m_VecTraits_h
11 #define vtk_m_VecTraits_h
48 template <vtkm::IdComponent numComponents>
49 struct VecTraitsMultipleComponentChooser
55 struct VecTraitsMultipleComponentChooser<1>
65 template <
class VecType>
68 #ifdef VTKM_DOXYGEN_ONLY
111 const typename std::remove_const<VecType>::type& vector,
114 typename std::remove_const<VecType>::type& vector,
130 template <
typename NewComponentType>
139 template <
typename NewComponentType>
146 template <vktm::IdComponent destSize>
148 #endif // VTKM_DOXYGEN_ONLY
154 template <
typename T>
155 struct HasVecTraitsImpl
157 template <typename A, typename S = typename vtkm::VecTraits<A>::ComponentType>
158 static std::true_type Test(A*);
160 static std::false_type Test(...);
162 using Type = decltype(Test(std::declval<T*>()));
175 template <
typename T>
181 template <
typename T>
186 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
190 template <
typename NewT, vtkm::IdComponent Size>
191 struct VecReplaceComponentTypeGCC4or5
196 template <
typename T, vtkm::IdComponent Size,
typename NewT>
197 struct VecReplaceBaseComponentTypeGCC4or5
204 #endif // GCC Version 4.8
206 template <
typename T, vtkm::IdComponent Size>
237 using HasMultipleComponents =
253 return vector[component];
258 return vector[component];
267 vector[component] = value;
277 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
279 template <
typename NewComponentType>
280 using ReplaceComponentType =
281 typename detail::VecReplaceComponentTypeGCC4or5<NewComponentType, Size>::type;
283 template <
typename NewComponentType>
294 #if defined(VTKM_GCC) && (__GNUC__ <= 5)
296 template <
typename NewComponentType>
298 typename detail::VecReplaceBaseComponentTypeGCC4or5<T, Size, NewComponentType>::type;
300 template <
typename NewComponentType>
309 template <vtkm::IdComponent destSize>
316 template <
typename T>
365 return vector[component];
370 return vector[component];
378 vector[component] = value;
388 template <
typename NewComponentType>
397 template <
typename NewComponentType>
403 template <vtkm::IdComponent destSize>
410 template <
typename T>
459 return vector[component];
467 vector[component] = value;
477 template <
typename NewComponentType>
486 template <
typename NewComponentType>
492 template <vtkm::IdComponent destSize>
504 template <
typename ScalarType>
507 using ComponentType = ScalarType;
508 using BaseComponentType = ScalarType;
517 static const ComponentType& GetComponent(
const ScalarType& vector,
vtkm::IdComponent)
522 static ComponentType& GetComponent(ScalarType& vector,
vtkm::IdComponent) {
return vector; }
531 template <
typename NewComponentType>
532 using ReplaceComponentType = NewComponentType;
534 template <
typename NewComponentType>
535 using ReplaceBaseComponentType = NewComponentType;
537 template <vtkm::IdComponent destSize>
547 template <
typename T,
typename = vtkm::HasVecTraits<T>>
550 template <
typename T>
555 template <
typename T>
556 struct VTKM_NEVER_EXPORT SafeVecTraitsImpl<T, std::false_type> : vtkm::internal::VecTraitsBasic<T>
576 template <
typename T>
590 template <
typename T,
typename U>
592 :
public vtkm::internal::VecTraitsBasic<vtkm::Pair<T, U>>
598 #define VTKM_BASIC_TYPE_VECTOR(type) \
602 struct VTKM_NEVER_EXPORT VecTraits<type> : public vtkm::internal::VecTraitsBasic<type> \
627 #endif //vtk_m_VecTraits_h
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:426
A tag for vectors that are "true" vectors (i.e.
Definition: VecTraits.h:21
VTKM_EXEC_CONT void CopyInto(Vec< T, Size > &dest) const
Definition: Types.h:787
Groups connected points that have the same field value.
Definition: Atomic.h:19
static VTKM_EXEC_CONT void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:404
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
static VTKM_EXEC_CONT void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:376
static VTKM_EXEC_CONT void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:310
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:419
static const VTKM_EXEC_CONT ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:363
typename detail::HasVecTraitsImpl< T >::Type HasVecTraits
Determines whether the given type has VecTraits defined.
Definition: VecTraits.h:176
T ComponentType
Definition: Types.h:773
static VTKM_EXEC_CONT ComponentType & GetComponent(VecType &vector, vtkm::IdComponent component)
Definition: VecTraits.h:256
VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1299
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:80
T ComponentType
Definition: Types.h:1247
static const VTKM_EXEC_CONT ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:457
static VTKM_EXEC_CONT void CopyInto(const VecType &src, vtkm::Vec< ComponentType, destSize > &dest)
Converts whatever type this vector is into the standard VTKm Tuple.
Definition: VecTraits.h:493
VecTemplate< NewComponentType, N > ReplaceComponentType
Get a vector of the same type but with a different component.
Definition: VecTraits.h:131
static VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:337
static const VTKM_EXEC_CONT ComponentType & GetComponent(const VecType &vector, vtkm::IdComponent component)
Returns the value in a given component of the vector.
Definition: VecTraits.h:251
static VTKM_EXEC_CONT ComponentType & GetComponent(VecType &vector, vtkm::IdComponent component)
Definition: VecTraits.h:368
typename internal::VecTraitsMultipleComponentChooser< NUM_COMPONENTS >::Type HasMultipleComponents
A tag specifying whether this vector has multiple components (i.e.
Definition: VecTraits.h:98
static VTKM_EXEC_CONT void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:263
A const version of VecC.
Definition: Types.h:1331
static VTKM_EXEC_CONT void SetComponent(VecType &vector, vtkm::IdComponent component, ComponentType value)
Changes the value in a given component of the vector.
Definition: VecTraits.h:465
VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1393
VecTemplate< typename VecTraits< ComponentType >::template ReplaceBaseComponentType< NewComponentType >, N > ReplaceBaseComponentType
Get a vector of the same type but with a different base component.
Definition: VecTraits.h:142
T ComponentType
Definition: Types.h:1341
A short fixed-length array.
Definition: Types.h:767
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:332
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:325
static VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents(const VecType &)
Number of components in the given vector.
Definition: VecTraits.h:231
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:73
typename vtkm::VecTraits< ComponentType >::BaseComponentType BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:222
#define VTKM_NEVER_EXPORT
Definition: ExportMacros.h:93
The VecTraits class gives several static members that define how to use a given type as a vector.
Definition: VecTraits.h:66
A Vec-like representation for short arrays.
Definition: Types.h:1237
typename VecType::ComponentType ComponentType
Type of the components in the vector.
Definition: VecTraits.h:215
A vtkm::Pair is essentially the same as an STL pair object except that the methods (constructors and ...
Definition: Pair.h:29
static VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents(const VecType &vector)
Number of components in the given vector.
Definition: VecTraits.h:431
#define VTKM_BASIC_TYPE_VECTOR(type)
Definition: VecTraits.h:598