VTK-m  2.1
Public Member Functions | Private Types | 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

 UncertainArrayHandle ()=default
 
template<typename T , typename S >
 UncertainArrayHandle (const vtkm::cont::ArrayHandle< T, S > &array)
 
 UncertainArrayHandle (const vtkm::cont::UnknownArrayHandle &src)
 
template<typename OtherValues , typename OtherStorage >
 UncertainArrayHandle (const UncertainArrayHandle< OtherValues, OtherStorage > &src)
 
Thisclass NewInstance () const
 Create a new array of the same type as this array. More...
 
template<typename NewValueTypeList >
UncertainArrayHandle< NewValueTypeList, StorageTypeList > ResetValueTypes (NewValueTypeList=NewValueTypeList{}) const
 Like ResetTypes except it only resets the value types. More...
 
template<typename NewStorageTypeList >
UncertainArrayHandle< ValueTypeList, NewStorageTypeList > ResetStorageTypes (NewStorageTypeList=NewStorageTypeList{}) const
 Like ResetTypes except it only resets the storage types. More...
 
template<typename Functor , typename... Args>
void CastAndCall (Functor &&functor, Args &&... args) const
 Call a functor using the underlying array type. More...
 
template<typename Functor , typename... Args>
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
 UnknownArrayHandle ()=default
 
template<typename T , typename S >
 UnknownArrayHandle (const vtkm::cont::ArrayHandle< T, S > &array)
 
bool IsValid () const
 Returns whether an array is stored in this UnknownArrayHandle. More...
 
UnknownArrayHandle NewInstance () const
 Create a new array of the same type as this array. More...
 
UnknownArrayHandle NewInstanceBasic () const
 Create a new ArrayHandleBasic with the same ValueType as this array. More...
 
UnknownArrayHandle NewInstanceFloatBasic () const
 Create a new ArrayHandleBasic with the base component of FloatDefault More...
 
std::string GetValueTypeName () const
 Returns the name of the value type stored in the array. More...
 
std::string GetBaseComponentTypeName () const
 Returns the name of the base component of the value type stored in the array. More...
 
std::string GetStorageTypeName () const
 Returns the name of the storage tag for the array. More...
 
std::string GetArrayTypeName () const
 Returns a string representation of the underlying data type. More...
 
template<typename ValueType >
bool IsValueType () const
 Returns true if this array matches the ValueType template argument. More...
 
template<typename StorageType >
bool IsStorageType () const
 Returns true if this array matches the StorageType template argument. More...
 
template<typename BaseComponentType >
bool IsBaseComponentType () const
 Returns true if this array's ValueType has the provided base component type. More...
 
template<typename ArrayHandleType >
bool IsType () const
 Returns true if this array matches the ArrayHandleType template argument. More...
 
template<typename NewValueTypeList , typename NewStorageTypeList >
vtkm::cont::UncertainArrayHandle< NewValueTypeList, NewStorageTypeList > ResetTypes (NewValueTypeList=NewValueTypeList{}, NewStorageTypeList=NewStorageTypeList{}) const
 Assigns potential value and storage types. More...
 
vtkm::Id GetNumberOfValues () const
 Returns the number of values in the array. More...
 
vtkm::IdComponent GetNumberOfComponents () const
 Returns the number of components for each value in the array. More...
 
vtkm::IdComponent GetNumberOfComponentsFlat () const
 Returns the total number of components for each value in the array. More...
 
template<typename ArrayHandleType >
bool CanConvert () const
 Determine if the contained array can be passed to the given array type. More...
 
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::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::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>
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>
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>
void CastAndCallWithExtractedArray (Functor &&functor, Args &&... args) const
 Call a functor on an array extracted from the components. More...
 
void ReleaseResourcesExecution () const
 Releases any resources being used in the execution environment (that are not being shared by the control environment). More...
 
void ReleaseResources () const
 Releases all resources in both the control and execution environments. More...
 
void PrintSummary (std::ostream &out, bool full=false) const
 
void Allocate (vtkm::Id numValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
 Reallocate the data in the array. More...
 
void Allocate (vtkm::Id numValues, vtkm::CopyFlag preserve=vtkm::CopyFlag::Off) const
 Reallocate the data in the array. More...
 
template<typename T , typename S >
void AsArrayHandle (vtkm::cont::ArrayHandle< T, S > &array) const
 
template<typename T >
void AsArrayHandle (vtkm::cont::ArrayHandle< T > &array) const
 
template<typename T , typename... Ss>
void AsArrayHandle (vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagMultiplexer< Ss... >> &array) const
 
template<typename TargetT , typename SourceT , typename SourceS >
void AsArrayHandle (vtkm::cont::ArrayHandle< TargetT, vtkm::cont::StorageTagCast< SourceT, SourceS >> &array) const
 
template<typename T >
void AsArrayHandle (vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagRuntimeVec > &array) const
 
template<typename ArrayType >
ArrayType AsArrayHandle () const
 

Private Types

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

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::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( )
default

◆ UncertainArrayHandle() [2/4]

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

◆ UncertainArrayHandle() [3/4]

template<typename ValueTypeList , typename StorageTypeList >
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::UncertainArrayHandle< ValueTypeList, StorageTypeList >::UncertainArrayHandle ( const UncertainArrayHandle< OtherValues, OtherStorage > &  src)
inline

Member Function Documentation

◆ CastAndCall()

template<typename ValueTypeList , typename StorageTypeList >
template<typename Functor , typename... Args>
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>
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 >
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 >
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 >
UncertainArrayHandle<NewValueTypeList, StorageTypeList> vtkm::cont::UncertainArrayHandle< ValueTypeList, StorageTypeList >::ResetValueTypes ( NewValueTypeList  = NewValueTypeList{}) const
inline

Like ResetTypes except it only resets the value types.


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