VTK-m  2.0
Public Types | Public Member Functions | List of all members
vtkm::worklet::Keys< T > Class Template Reference

Manage keys for a WorkletReduceByKey. More...

#include <Keys.h>

Inheritance diagram for vtkm::worklet::Keys< T >:

Public Types

using KeyType = T
 
using KeyArrayHandleType = vtkm::cont::ArrayHandle< KeyType >
 
using ExecLookup = vtkm::exec::internal::ReduceByKeyLookup< typename KeyArrayHandleType::ReadPortalType, typename vtkm::cont::ArrayHandle< vtkm::Id >::ReadPortalType, typename vtkm::cont::ArrayHandle< vtkm::IdComponent >::ReadPortalType >
 

Public Member Functions

VTKM_CONT Keys ()
 
template<typename KeyStorage >
VTKM_CONT Keys (const vtkm::cont::ArrayHandle< KeyType, KeyStorage > &keys, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny())
 Construct a Keys class from an array of keys. More...
 
template<typename KeyArrayType >
VTKM_CONT void BuildArrays (const KeyArrayType &keys, KeysSortType sort, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny())
 Build the internal arrays without modifying the input. More...
 
template<typename KeyArrayType >
VTKM_CONT void BuildArraysInPlace (KeyArrayType &keys, KeysSortType sort, vtkm::cont::DeviceAdapterId device=vtkm::cont::DeviceAdapterTagAny())
 Build the internal arrays and also sort the input keys. More...
 
VTKM_CONT KeyArrayHandleType GetUniqueKeys () const
 
VTKM_CONT ExecLookup PrepareForInput (vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
 
VTKM_CONT bool operator== (const vtkm::worklet::Keys< KeyType > &other) const
 
VTKM_CONT bool operator!= (const vtkm::worklet::Keys< KeyType > &other) const
 

Detailed Description

template<typename T>
class vtkm::worklet::Keys< T >

Manage keys for a WorkletReduceByKey.

The WorkletReduceByKey worklet (and its associated DispatcherReduceByKey) take an array of keys for its input domain, find all identical keys, and runs a worklet that produces a single value for every key given all matching values. This class is used as the associated input for the keys input domain.

Keys is templated on the key array handle type and accepts an instance of this array handle as its constructor. It builds the internal structures needed to use the keys.

The same Keys structure can be used for multiple different Invoke of different dispatchers. When used in this way, the processing done in the Keys structure is reused for all the Invoke. This is more efficient than creating a different Keys structure for each Invoke.

Member Typedef Documentation

◆ ExecLookup

template<typename T >
using vtkm::worklet::Keys< T >::ExecLookup = vtkm::exec::internal::ReduceByKeyLookup< typename KeyArrayHandleType::ReadPortalType, typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType, typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType>

◆ KeyArrayHandleType

◆ KeyType

template<typename T >
using vtkm::worklet::Keys< T >::KeyType = T

Constructor & Destructor Documentation

◆ Keys() [1/2]

template<typename T >
VTKM_CONT vtkm::worklet::Keys< T >::Keys ( )
default

◆ Keys() [2/2]

template<typename T >
template<typename KeyStorage >
VTKM_CONT vtkm::worklet::Keys< T >::Keys ( const vtkm::cont::ArrayHandle< KeyType, KeyStorage > &  keys,
vtkm::cont::DeviceAdapterId  device = vtkm::cont::DeviceAdapterTagAny() 
)
inline

Construct a Keys class from an array of keys.

Given an array of keys, construct a Keys class that will manage using these keys to perform reduce-by-key operations.

The input keys object is not modified and the result is not stable sorted. This is the equivalent of calling BuildArrays(keys, KeysSortType::Unstable, device).

Member Function Documentation

◆ BuildArrays()

template<typename T >
template<typename KeyArrayType >
VTKM_CONT void vtkm::worklet::Keys< T >::BuildArrays ( const KeyArrayType &  keys,
KeysSortType  sort,
vtkm::cont::DeviceAdapterId  device = vtkm::cont::DeviceAdapterTagAny() 
)

Build the internal arrays without modifying the input.

This is more efficient for stable sorted arrays, but requires an extra copy of the keys for unstable sorting.

◆ BuildArraysInPlace()

template<typename T >
template<typename KeyArrayType >
VTKM_CONT void vtkm::worklet::Keys< T >::BuildArraysInPlace ( KeyArrayType &  keys,
KeysSortType  sort,
vtkm::cont::DeviceAdapterId  device = vtkm::cont::DeviceAdapterTagAny() 
)

Build the internal arrays and also sort the input keys.

This is more efficient for unstable sorting, but requires an extra copy for stable sorting.

◆ GetUniqueKeys()

template<typename T >
VTKM_CONT KeyArrayHandleType vtkm::worklet::Keys< T >::GetUniqueKeys ( ) const
inline

◆ operator!=()

template<typename T >
VTKM_CONT bool vtkm::worklet::Keys< T >::operator!= ( const vtkm::worklet::Keys< KeyType > &  other) const
inline

◆ operator==()

template<typename T >
VTKM_CONT bool vtkm::worklet::Keys< T >::operator== ( const vtkm::worklet::Keys< KeyType > &  other) const
inline

◆ PrepareForInput()

template<typename T >
VTKM_CONT ExecLookup vtkm::worklet::Keys< T >::PrepareForInput ( vtkm::cont::DeviceAdapterId  device,
vtkm::cont::Token token 
) const
inline

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