VTK-m  2.2
Classes | Public Types | Static Public Member Functions | List of all members
vtkm::worklet::StableSortIndices Struct Reference

Produces an ArrayHandle<vtkm::Id> index array that stable-sorts and optionally uniquifies an input array. More...

#include <StableSortIndices.h>

Classes

struct  IndirectSortPredicate
 
struct  IndirectSortPredicateExecObject
 
struct  IndirectUniquePredicate
 
struct  IndirectUniquePredicateExecObject
 

Public Types

using IndexArrayType = vtkm::cont::ArrayHandle< vtkm::Id >
 

Static Public Member Functions

template<typename KeyType , typename Storage >
static void Sort (vtkm::cont::DeviceAdapterId device, const vtkm::cont::ArrayHandle< KeyType, Storage > &keys, IndexArrayType &indices)
 Permutes the indices array so that it will map keys into a stable sorted order. More...
 
template<typename KeyType , typename Storage >
static void Sort (const vtkm::cont::ArrayHandle< KeyType, Storage > &keys, IndexArrayType &indices)
 Permutes the indices array so that it will map keys into a stable sorted order. More...
 
template<typename KeyType , typename Storage >
static IndexArrayType Sort (vtkm::cont::DeviceAdapterId device, const vtkm::cont::ArrayHandle< KeyType, Storage > &keys)
 Returns an index array that maps the keys array into a stable sorted ordering. More...
 
template<typename KeyType , typename Storage >
static IndexArrayType Sort (const vtkm::cont::ArrayHandle< KeyType, Storage > &keys)
 Returns an index array that maps the keys array into a stable sorted ordering. More...
 
template<typename KeyType , typename Storage >
static void Unique (vtkm::cont::DeviceAdapterId device, const vtkm::cont::ArrayHandle< KeyType, Storage > &keys, IndexArrayType &indices)
 Reduces the array returned by Sort so that the mapped keys are unique. More...
 
template<typename KeyType , typename Storage >
static void Unique (const vtkm::cont::ArrayHandle< KeyType, Storage > &keys, IndexArrayType &indices)
 Reduces the array returned by Sort so that the mapped keys are unique. More...
 

Detailed Description

Produces an ArrayHandle<vtkm::Id> index array that stable-sorts and optionally uniquifies an input array.

Member Typedef Documentation

◆ IndexArrayType

Member Function Documentation

◆ Sort() [1/4]

template<typename KeyType , typename Storage >
static IndexArrayType vtkm::worklet::StableSortIndices::Sort ( const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys)
inlinestatic

Returns an index array that maps the keys array into a stable sorted ordering.

The keys array is not modified.

This is a convenience overload that generates the index array.

◆ Sort() [2/4]

template<typename KeyType , typename Storage >
static void vtkm::worklet::StableSortIndices::Sort ( const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys,
IndexArrayType indices 
)
inlinestatic

Permutes the indices array so that it will map keys into a stable sorted order.

The keys array is not modified.

Parameters
keysThe ArrayHandle containing data to be sorted.
indicesThe ArrayHandle<vtkm::Id> containing the permutation indices.
Note
indices is expected to contain the values (0, numKeys] in increasing order. If the values in indices are not sequential, the sort will succeed and be consistently reproducible, but the result is not guaranteed to be stable with respect to the original ordering of keys.

◆ Sort() [3/4]

template<typename KeyType , typename Storage >
static IndexArrayType vtkm::worklet::StableSortIndices::Sort ( vtkm::cont::DeviceAdapterId  device,
const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys 
)
inlinestatic

Returns an index array that maps the keys array into a stable sorted ordering.

The keys array is not modified.

This is a convenience overload that generates the index array.

◆ Sort() [4/4]

template<typename KeyType , typename Storage >
static void vtkm::worklet::StableSortIndices::Sort ( vtkm::cont::DeviceAdapterId  device,
const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys,
IndexArrayType indices 
)
inlinestatic

Permutes the indices array so that it will map keys into a stable sorted order.

The keys array is not modified.

Parameters
deviceThe Id for the device on which to compute the sort
keysThe ArrayHandle containing data to be sorted.
indicesThe ArrayHandle<vtkm::Id> containing the permutation indices.
Note
indices is expected to contain the values (0, numKeys] in increasing order. If the values in indices are not sequential, the sort will succeed and be consistently reproducible, but the result is not guaranteed to be stable with respect to the original ordering of keys.

◆ Unique() [1/2]

template<typename KeyType , typename Storage >
static void vtkm::worklet::StableSortIndices::Unique ( const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys,
IndexArrayType indices 
)
inlinestatic

Reduces the array returned by Sort so that the mapped keys are unique.

The indices array will be modified in-place and the keys array is not modified.

◆ Unique() [2/2]

template<typename KeyType , typename Storage >
static void vtkm::worklet::StableSortIndices::Unique ( vtkm::cont::DeviceAdapterId  device,
const vtkm::cont::ArrayHandle< KeyType, Storage > &  keys,
IndexArrayType indices 
)
inlinestatic

Reduces the array returned by Sort so that the mapped keys are unique.

The indices array will be modified in-place and the keys array is not modified.


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