VTK-m  1.8
Public Member Functions | Private Types | Private Member Functions | List of all members
vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList > Class Template Reference

An ArrayHandle of an uncertain value type and storage. More...

#include <UncertainArrayHandle.h>

Inheritance diagram for vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >:
vtkm::cont::UnknownArrayHandle

Public Member Functions

VTKM_CONT UncertainArrayHandle ()=default
 
template<typename T , typename S >
VTKM_CONT UncertainArrayHandle (const vtkm::cont::ArrayHandle< T, S > &array)
 
VTKM_CONT UncertainArrayHandle (const vtkm::cont::UnknownArrayHandle &src)
 
template<typename OtherValues , typename OtherStorage >
VTKM_CONT UncertainArrayHandle (const UncertainArrayHandle< OtherValues, OtherStorage > &src)
 
VTKM_CONT Thisclass NewInstance () const
 Create a new array of the same type as this array. More...
 
template<typename NewValueTypeList >
VTKM_CONT UncertainArrayHandle< NewValueTypeList, StorageTypeList > ResetValueTypes (NewValueTypeList=NewValueTypeList{}) const
 Like ResetTypes except it only resets the value types. More...
 
template<typename NewStorageTypeList >
VTKM_CONT UncertainArrayHandle< ValueTypeList, NewStorageTypeList > ResetStorageTypes (NewStorageTypeList=NewStorageTypeList{}) const
 Like ResetTypes except it only resets the storage types. More...
 
template<typename Functor , typename... Args>
VTKM_CONT void CastAndCall (Functor &&functor, Args &&... args) const
 Call a functor using the underlying array type. More...
 
template<typename Functor , typename... Args>
VTKM_CONT void CastAndCallWithFloatFallback (Functor &&functor, Args &&... args) const
 Call a functor using the underlying array type with a float cast fallback. More...
 
- Public Member Functions inherited from vtkm::cont::UnknownArrayHandle
VTKM_CONT UnknownArrayHandle ()=default
 
template<typename T , typename S >
VTKM_CONT UnknownArrayHandle (const vtkm::cont::ArrayHandle< T, S > &array)
 
VTKM_CONT bool IsValid () const
 Returns whether an array is stored in this UnknownArrayHandle. More...
 
VTKM_CONT UnknownArrayHandle NewInstance () const
 Create a new array of the same type as this array. More...
 
VTKM_CONT UnknownArrayHandle NewInstanceBasic () const
 Create a new ArrayHandleBasic with the same ValueType as this array. More...
 
VTKM_CONT UnknownArrayHandle NewInstanceFloatBasic () const
 Create a new ArrayHandleBasic with the base component of FloatDefault More...
 
VTKM_CONT std::string GetValueTypeName () const
 Returns the name of the value type stored in the array. More...
 
VTKM_CONT std::string GetBaseComponentTypeName () const
 Returns the name of the base component of the value type stored in the array. More...
 
VTKM_CONT std::string GetStorageTypeName () const
 Returns the name of the storage tag for the array. More...
 
VTKM_CONT std::string GetArrayTypeName () const
 Returns a string representation of the underlying data type. More...
 
template<typename ValueType >
VTKM_CONT bool IsValueType () const
 Returns true if this array matches the ValueType template argument. More...
 
template<typename StorageType >
VTKM_CONT bool IsStorageType () const
 Returns true if this array matches the StorageType template argument. More...
 
template<typename BaseComponentType >
VTKM_CONT bool IsBaseComponentType () const
 Returns true if this array's ValueType has the provided base component type. More...
 
template<typename ArrayHandleType >
VTKM_CONT bool IsType () const
 Returns true if this array matches the ArrayHandleType template argument. More...
 
template<typename NewValueTypeList , typename NewStorageTypeList >
VTKM_CONT vtkm::cont::UncertainArrayHandle< NewValueTypeList, NewStorageTypeList > ResetTypes (NewValueTypeList=NewValueTypeList{}, NewStorageTypeList=NewStorageTypeList{}) const
 Assigns potential value and storage types. More...
 
template<typename NewValueTypeList >
VTKM_CONT vtkm::cont::UncertainArrayHandle< NewValueTypeList, vtkm::cont::StorageListCommonResetTypes (NewValueTypeList=NewValueTypeList{}) const
 
VTKM_CONT vtkm::Id GetNumberOfValues () const
 Returns the number of values in the array. More...
 
VTKM_CONT vtkm::IdComponent GetNumberOfComponents () const
 Returns the number of components for each value in the array. More...
 
VTKM_CONT vtkm::IdComponent GetNumberOfComponentsFlat () const
 Returns the total number of components for each value in the array. More...
 
template<typename ArrayHandleType >
VTKM_CONT bool CanConvert () const
 Determine if the contained array can be passed to the given array type. More...
 
template<typename ArrayHandleType >
VTKM_CONT ArrayHandleType Cast () const
 
template<typename ArrayHandleType >
VTKM_CONT void CopyTo (ArrayHandleType &array) const
 
template<typename MultiplexerType >
VTKM_CONT MultiplexerType AsMultiplexer () const
 
template<typename MultiplexerType >
VTKM_CONT void AsMultiplexer (MultiplexerType &result) const
 
void DeepCopyFrom (const vtkm::cont::UnknownArrayHandle &source)
 Deep copies data from another UnknownArrayHandle. More...
 
void DeepCopyFrom (const vtkm::cont::UnknownArrayHandle &source) const
 Deep copies data from another UnknownArrayHandle. More...
 
void CopyShallowIfPossible (const vtkm::cont::UnknownArrayHandle &source)
 Attempts a shallow copy of an array or a deep copy if that is not possible. More...
 
void CopyShallowIfPossible (const vtkm::cont::UnknownArrayHandle &source) const
 Attempts a shallow copy of an array or a deep copy if that is not possible. More...
 
template<typename BaseComponentType >
VTKM_CONT vtkm::cont::ArrayHandleStride< BaseComponentType > ExtractComponent (vtkm::IdComponent componentIndex, vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
 Extract a component of the array. More...
 
template<typename BaseComponentType >
VTKM_CONT vtkm::cont::ArrayHandleRecombineVec< BaseComponentType > ExtractArrayFromComponents (vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
 Extract the array knowing only the component type of the array. More...
 
template<typename TypeList , typename StorageList , typename Functor , typename... Args>
VTKM_CONT void CastAndCallForTypes (Functor &&functor, Args &&... args) const
 Call a functor using the underlying array type. More...
 
template<typename TypeList , typename StorageList , typename Functor , typename... Args>
VTKM_CONT void CastAndCallForTypesWithFloatFallback (Functor &&functor, Args &&... args) const
 Call a functor using the underlying array type with a float cast fallback. More...
 
template<typename Functor , typename... Args>
VTKM_CONT void CastAndCallWithExtractedArray (Functor &&functor, Args &&... args) const
 Call a functor on an array extracted from the components. More...
 
template<typename FunctorOrStorageList , typename... Args>
VTKM_CONT VTKM_DEPRECATED (1.6, "Use CastAndCallForTypes.") void CastAndCall(FunctorOrStorageList &&functorOrStorageList
 
VTKM_CONT void ReleaseResourcesExecution () const
 Releases any resources being used in the execution environment (that are not being shared by the control environment). More...
 
VTKM_CONT void ReleaseResources () const
 Releases all resources in both the control and execution environments. More...
 
VTKM_CONT void PrintSummary (std::ostream &out, bool full=false) const
 
template<typename T , typename... Ss>
void AsArrayHandle (vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagMultiplexer< Ss... >> &array) const
 
template<typename TypeList , typename StorageTagList , typename Functor , typename... Args>
void CastAndCallForTypes (Functor &&f, Args &&... args) const
 
template<typename Functor , typename... Args>
void CastAndCallWithExtractedArray (Functor &&functor, Args &&... args) const
 
VTKM_CONT void Allocate (vtkm::Id numValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
 Reallocate the data in the array. More...
 
VTKM_CONT void Allocate (vtkm::Id numValues, vtkm::CopyFlag preserve=vtkm::CopyFlag::Off) const
 Reallocate the data in the array. More...
 
template<typename T , typename S >
VTKM_CONT void AsArrayHandle (vtkm::cont::ArrayHandle< T, S > &array) const
 
template<typename T , typename... Ss>
VTKM_CONT void AsArrayHandle (vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagMultiplexer< Ss... >> &array) const
 
template<typename TargetT , typename SourceT , typename SourceS >
VTKM_CONT void AsArrayHandle (vtkm::cont::ArrayHandle< TargetT, vtkm::cont::StorageTagCast< SourceT, SourceS >> &array) const
 
template<typename ArrayType >
VTKM_CONT ArrayType AsArrayHandle () const
 

Private Types

using Superclass = UnknownArrayHandle
 
using Thisclass = UncertainArrayHandle< ValueTypeList, StorageTypeList >
 

Private Member Functions

 VTKM_IS_LIST (ValueTypeList)
 
 VTKM_IS_LIST (StorageTypeList)
 
 VTKM_STATIC_ASSERT_MSG ((!std::is_same< ValueTypeList, vtkm::ListUniversal >::value), "Cannot use vtkm::ListUniversal with UncertainArrayHandle.")
 
 VTKM_STATIC_ASSERT_MSG ((!std::is_same< StorageTypeList, vtkm::ListUniversal >::value), "Cannot use vtkm::ListUniversal with UncertainArrayHandle.")
 

Additional Inherited Members

- Public Attributes inherited from vtkm::cont::UnknownArrayHandle
VTKM_CONT Args &&const args
 

Detailed Description

template<typename ValueTypeList, typename StorageTypeList>
class vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >

An ArrayHandle of an uncertain value type and storage.

UncertainArrayHandle holds an ArrayHandle object using runtime polymorphism to manage different value and storage types. It behaves like its superclass, UnknownArrayHandle, except that it also contains two template parameters that provide vtkm::Lists of potential value and storage types, respectively.

These potential value and storage types come into play when the CastAndCall method is called (or the UncertainArrayHandle is used in the vtkm::cont::CastAndCall function). In this case, the CastAndCall will search for ArrayHandles of types that match these two lists.

Both UncertainArrayHandle and UnknownArrayHandle have a method named ResetTypes that redefine the lists of potential value and storage types by returning a new UncertainArrayHandle containing the same ArrayHandle but with the new value and storage type lists.

Member Typedef Documentation

◆ Superclass

template<typename ValueTypeList , typename StorageTypeList >
using vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::Superclass = UnknownArrayHandle
private

◆ Thisclass

template<typename ValueTypeList , typename StorageTypeList >
using vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::Thisclass = UncertainArrayHandle<ValueTypeList, StorageTypeList>
private

Constructor & Destructor Documentation

◆ UncertainArrayHandle() [1/4]

template<typename ValueTypeList , typename StorageTypeList >
VTKM_CONT vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( )
default

◆ UncertainArrayHandle() [2/4]

template<typename ValueTypeList , typename StorageTypeList >
template<typename T , typename S >
VTKM_CONT vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( const vtkm::cont::ArrayHandle< T, S > &  array)
inline

◆ UncertainArrayHandle() [3/4]

template<typename ValueTypeList , typename StorageTypeList >
VTKM_CONT vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( const vtkm::cont::UnknownArrayHandle src)
inlineexplicit

◆ UncertainArrayHandle() [4/4]

template<typename ValueTypeList , typename StorageTypeList >
template<typename OtherValues , typename OtherStorage >
VTKM_CONT vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( const UncertainArrayHandle< OtherValues, OtherStorage > &  src)
inline

Member Function Documentation

◆ CastAndCall()

template<typename ValueTypeList , typename StorageTypeList >
template<typename Functor , typename... Args>
VTKM_CONT void vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::CastAndCall ( Functor &&  functor,
Args &&...  args 
) const
inline

Call a functor using the underlying array type.

CastAndCall attempts to cast the held array to a specific value type, and then calls the given functor with the cast array.

◆ CastAndCallWithFloatFallback()

template<typename ValueTypeList , typename StorageTypeList >
template<typename Functor , typename... Args>
VTKM_CONT void vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::CastAndCallWithFloatFallback ( Functor &&  functor,
Args &&...  args 
) const
inline

Call a functor using the underlying array type with a float cast fallback.

CastAndCallWithFloatFallback attempts to cast the held array to a specific value type, and then calls the given functor with the cast array. If the underlying array does not match any of the requested array types, the array is copied to a new ArrayHandleBasic with FloatDefault components in its value and attempts to cast to those types.

◆ NewInstance()

template<typename ValueTypeList , typename StorageTypeList >
VTKM_CONT Thisclass vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::NewInstance ( ) const
inline

Create a new array of the same type as this array.

This method creates a new array that is the same type as this one and returns a new UncertainArrayHandle for it. This method is convenient when creating output arrays that should be the same type as some input array.

◆ ResetStorageTypes()

template<typename ValueTypeList , typename StorageTypeList >
template<typename NewStorageTypeList >
VTKM_CONT UncertainArrayHandle<ValueTypeList, NewStorageTypeList> vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::ResetStorageTypes ( NewStorageTypeList  = NewStorageTypeList{}) const
inline

Like ResetTypes except it only resets the storage types.

◆ ResetValueTypes()

template<typename ValueTypeList , typename StorageTypeList >
template<typename NewValueTypeList >
VTKM_CONT UncertainArrayHandle<NewValueTypeList, StorageTypeList> vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::ResetValueTypes ( NewValueTypeList  = NewValueTypeList{}) const
inline

Like ResetTypes except it only resets the value types.

◆ VTKM_IS_LIST() [1/2]

template<typename ValueTypeList , typename StorageTypeList >
vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::VTKM_IS_LIST ( StorageTypeList  )
private

◆ VTKM_IS_LIST() [2/2]

template<typename ValueTypeList , typename StorageTypeList >
vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::VTKM_IS_LIST ( ValueTypeList  )
private

◆ VTKM_STATIC_ASSERT_MSG() [1/2]

template<typename ValueTypeList , typename StorageTypeList >
vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::VTKM_STATIC_ASSERT_MSG ( (!std::is_same< StorageTypeList, vtkm::ListUniversal >::value)  ,
"Cannot use vtkm::ListUniversal with UncertainArrayHandle< ValueTypeList, StorageTypeList >."   
)
private

◆ VTKM_STATIC_ASSERT_MSG() [2/2]

template<typename ValueTypeList , typename StorageTypeList >
vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::VTKM_STATIC_ASSERT_MSG ( (!std::is_same< ValueTypeList, vtkm::ListUniversal >::value)  ,
"Cannot use vtkm::ListUniversal with UncertainArrayHandle< ValueTypeList, StorageTypeList >."   
)
private

The documentation for this class was generated from the following file: