VTK-m  2.0
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
vtkm::VecTraits< vtkm::Vec< T, Size > > Struct Template Reference

#include <VecTraits.h>

Public Types

using VecType = vtkm::Vec< T, Size >
 
using ComponentType = typename VecType::ComponentType
 Type of the components in the vector. More...
 
using BaseComponentType = typename vtkm::VecTraits< ComponentType >::BaseComponentType
 Base component type in the vector. More...
 
using HasMultipleComponents = typename internal::VecTraitsMultipleComponentChooser< NUM_COMPONENTS >::Type
 A tag specifying whether this vector has multiple components (i.e. More...
 
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic
 A tag specifying whether the size of this vector is known at compile time. More...
 
template<typename NewComponentType >
using ReplaceComponentType = vtkm::Vec< NewComponentType, Size >
 Get a vector of the same type but with a different component. More...
 
template<typename NewComponentType >
using ReplaceBaseComponentType = vtkm::Vec< typename vtkm::VecTraits< ComponentType >::template ReplaceBaseComponentType< NewComponentType >, Size >
 Get a vector of the same type but with a different base component. More...
 

Static Public Member Functions

static VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents (const VecType &)
 Number of components in the given vector. More...
 
static const VTKM_EXEC_CONT ComponentTypeGetComponent (const VecType &vector, vtkm::IdComponent component)
 Returns the value in a given component of the vector. More...
 
static VTKM_EXEC_CONT ComponentTypeGetComponent (VecType &vector, vtkm::IdComponent component)
 
static VTKM_EXEC_CONT void SetComponent (VecType &vector, vtkm::IdComponent component, ComponentType value)
 Changes the value in a given component of the vector. More...
 
template<vtkm::IdComponent destSize>
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. More...
 

Static Public Attributes

static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS
 Number of components in the vector. More...
 

Member Typedef Documentation

◆ BaseComponentType

template<typename T , vtkm::IdComponent Size>
using vtkm::VecTraits< vtkm::Vec< T, Size > >::BaseComponentType = typename vtkm::VecTraits<ComponentType>::BaseComponentType

Base component type in the vector.

Similar to ComponentType except that for nested vectors (e.g. Vec<Vec<T, M>, N>), it returns the base scalar type at the end of the composition (T in this example).

◆ ComponentType

template<typename T , vtkm::IdComponent Size>
using vtkm::VecTraits< vtkm::Vec< T, Size > >::ComponentType = typename VecType::ComponentType

Type of the components in the vector.

If the type is really a scalar, then the component type is the same as the scalar type.

◆ HasMultipleComponents

template<typename T , vtkm::IdComponent Size>
using vtkm::VecTraits< vtkm::Vec< T, Size > >::HasMultipleComponents = typename internal::VecTraitsMultipleComponentChooser<NUM_COMPONENTS>::Type

A tag specifying whether this vector has multiple components (i.e.

is a "real" vector). This tag can be useful for creating specialized functions when a vector is really just a scalar.

◆ IsSizeStatic

template<typename T , vtkm::IdComponent Size>
using vtkm::VecTraits< vtkm::Vec< T, Size > >::IsSizeStatic = vtkm::VecTraitsTagSizeStatic

A tag specifying whether the size of this vector is known at compile time.

If set to VecTraitsTagSizeStatic, then NUM_COMPONENTS is set. If set to VecTraitsTagSizeVariable, then the number of components is not known at compile time and must be queried with GetNumberOfComponents.

◆ ReplaceBaseComponentType

template<typename T , vtkm::IdComponent Size>
template<typename NewComponentType >
using vtkm::VecTraits< vtkm::Vec< T, Size > >::ReplaceBaseComponentType = vtkm::Vec< typename vtkm::VecTraits<ComponentType>::template ReplaceBaseComponentType<NewComponentType>, Size>

Get a vector of the same type but with a different base component.

This type resolves to another vector with a different base component type. The replacement is recursive for nested types. For example,

VecTraits<Vec<Vec<T, M>, N>::ReplaceComponentType<T2>

is Vec<Vec<T2, M>, N>.

◆ ReplaceComponentType

template<typename T , vtkm::IdComponent Size>
template<typename NewComponentType >
using vtkm::VecTraits< vtkm::Vec< T, Size > >::ReplaceComponentType = vtkm::Vec<NewComponentType, Size>

Get a vector of the same type but with a different component.

This type resolves to another vector with a different component type. For example,

vtkm::VecTraits<vtkm::Vec<T, N>>::ReplaceComponentType<T2>

is vtkm::Vec<T2, N>. This replacement is not recursive. So

VecTraits<Vec<Vec<T, M>, N>::ReplaceComponentType<T2>

is vtkm::Vec<T2, N>.

◆ VecType

template<typename T , vtkm::IdComponent Size>
using vtkm::VecTraits< vtkm::Vec< T, Size > >::VecType = vtkm::Vec<T, Size>

Member Function Documentation

◆ CopyInto()

template<typename T , vtkm::IdComponent Size>
template<vtkm::IdComponent destSize>
static VTKM_EXEC_CONT void vtkm::VecTraits< vtkm::Vec< T, Size > >::CopyInto ( const VecType src,
vtkm::Vec< ComponentType, destSize > &  dest 
)
inlinestatic

Converts whatever type this vector is into the standard VTKm Tuple.

◆ GetComponent() [1/2]

template<typename T , vtkm::IdComponent Size>
static const VTKM_EXEC_CONT ComponentType& vtkm::VecTraits< vtkm::Vec< T, Size > >::GetComponent ( const VecType vector,
vtkm::IdComponent  component 
)
inlinestatic

Returns the value in a given component of the vector.

◆ GetComponent() [2/2]

template<typename T , vtkm::IdComponent Size>
static VTKM_EXEC_CONT ComponentType& vtkm::VecTraits< vtkm::Vec< T, Size > >::GetComponent ( VecType vector,
vtkm::IdComponent  component 
)
inlinestatic

◆ GetNumberOfComponents()

template<typename T , vtkm::IdComponent Size>
static VTKM_EXEC_CONT vtkm::IdComponent vtkm::VecTraits< vtkm::Vec< T, Size > >::GetNumberOfComponents ( const VecType )
inlinestatic

Number of components in the given vector.

◆ SetComponent()

template<typename T , vtkm::IdComponent Size>
static VTKM_EXEC_CONT void vtkm::VecTraits< vtkm::Vec< T, Size > >::SetComponent ( VecType vector,
vtkm::IdComponent  component,
ComponentType  value 
)
inlinestatic

Changes the value in a given component of the vector.

Member Data Documentation

◆ NUM_COMPONENTS

template<typename T , vtkm::IdComponent Size>
constexpr vtkm::IdComponent vtkm::VecTraits< vtkm::Vec< T, Size > >::NUM_COMPONENTS = VecType::NUM_COMPONENTS
staticconstexpr

Number of components in the vector.


The documentation for this struct was generated from the following file:
vtkm::VecTraits
The VecTraits class gives several static members that define how to use a given type as a vector.
Definition: VecTraits.h:66