VTK-m  2.2
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag > Struct Template Reference

Struct containing device adapter algorithms. More...

#include <DeviceAdapterAlgorithm.h>

Public Member Functions

static T class BinaryFunctor static void ScanExclusiveByKey (const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output, const U &initialValue, BinaryFunctor binaryFunctor)
 

Static Public Member Functions

template<typename IndicesStorage >
static vtkm::Id BitFieldToUnorderedSet (const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
 Create a unique, unsorted list of indices denoting which bits are set in a bitfield. More...
 
template<typename T , typename U , class CIn , class COut >
static void Copy (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
 Copy the contents of one ArrayHandle to another. More...
 
template<typename T , typename U , class CIn , class CStencil , class COut >
static void CopyIf (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
 Conditionally copy elements in the input array to the output array. More...
 
template<typename T , typename U , class CIn , class CStencil , class COut , class UnaryPredicate >
static void CopyIf (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
 Conditionally copy elements in the input array to the output array. More...
 
template<typename T , typename U , class CIn , class COut >
static bool CopySubRange (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
 Copy the contents of a section of one ArrayHandle to another. More...
 
static vtkm::Id CountSetBits (const vtkm::cont::BitField &bits)
 Returns the total number of "1" bits in BitField. More...
 
template<typename T , class CIn , class CVal , class COut >
static void LowerBounds (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
 Output is the first index in input for each item in values that wouldn't alter the ordering of input. More...
 
template<typename T , class CIn , class CVal , class COut , class BinaryCompare >
static void LowerBounds (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
 Output is the first index in input for each item in values that wouldn't alter the ordering of input. More...
 
template<class CIn , class COut >
static void LowerBounds (const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
 A special version of LowerBounds that does an in place operation. More...
 
template<typename T , typename U , class CIn >
static U Reduce (const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
 Compute a accumulated sum operation on the input ArrayHandle. More...
 
template<typename T , typename U , class CIn , class BinaryFunctor >
static U Reduce (const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
 Compute a accumulated sum operation on the input ArrayHandle. More...
 
template<typename T , typename U , class CKeyIn , class CValIn , class CKeyOut , class CValOut , class BinaryFunctor >
static void ReduceByKey (const vtkm::cont::ArrayHandle< T, CKeyIn > &keys, const vtkm::cont::ArrayHandle< U, CValIn > &values, vtkm::cont::ArrayHandle< T, CKeyOut > &keys_output, vtkm::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
 Compute a accumulated sum operation on the input key value pairs. More...
 
template<typename T , class CIn , class COut >
static T ScanInclusive (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
 Compute an inclusive prefix sum operation on the input ArrayHandle. More...
 
template<typename T , class CIn , class COut , class BinaryFunctor >
static T ScanInclusive (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
 Compute an inclusive prefix sum operation on the input ArrayHandle. More...
 
template<typename T , typename U , typename KIn , typename VIn , typename VOut , typename BinaryFunctor >
static void ScanInclusiveByKey (const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output, BinaryFunctor binary_functor)
 Compute a segmented inclusive prefix sum operation on the input key value pairs. More...
 
template<typename T , typename U , typename KIn , typename VIn , typename VOut >
static void ScanInclusiveByKey (const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &values_output)
 Compute a segmented inclusive prefix sum operation on the input key value pairs. More...
 
template<typename T , class CIn , class COut >
static T ScanExclusive (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
 Compute an exclusive prefix sum operation on the input ArrayHandle. More...
 
template<typename T , class CIn , class COut , class BinaryFunctor >
static T ScanExclusive (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue) template< typename T
 Compute an exclusive prefix sum operation on the input ArrayHandle. More...
 
template<typename T , typename U , class KIn , typename VIn , typename VOut >
static void ScanExclusiveByKey (const vtkm::cont::ArrayHandle< T, KIn > &keys, const vtkm::cont::ArrayHandle< U, VIn > &values, vtkm::cont::ArrayHandle< U, VOut > &output)
 Compute a segmented exclusive prefix sum operation on the input key value pairs. More...
 
template<typename T , class CIn , class COut >
static void ScanExtended (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
 Compute an extended prefix sum operation on the input ArrayHandle. More...
 
template<typename T , class CIn , class COut , class BinaryFunctor >
static void ScanExtended (const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
 Compute an extended prefix sum operation on the input ArrayHandle. More...
 
template<class Functor >
static void Schedule (Functor functor, vtkm::Id numInstances)
 Schedule many instances of a function to run on concurrent threads. More...
 
template<class Functor , class IndiceType >
static void Schedule (Functor functor, vtkm::Id3 rangeMax)
 Schedule many instances of a function to run on concurrent threads. More...
 
template<typename T , class Storage >
static void Sort (vtkm::cont::ArrayHandle< T, Storage > &values)
 Unstable ascending sort of input array. More...
 
template<typename T , class Storage , class BinaryCompare >
static void Sort (vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
 Unstable ascending sort of input array. More...
 
template<typename T , typename U , class StorageT , class StorageU >
static void SortByKey (vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
 Unstable ascending sort of keys and values. More...
 
template<typename T , typename U , class StorageT , class StorageU , class BinaryCompare >
static void SortByKey (vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare) static void Synchronize()
 Unstable ascending sort of keys and values. More...
 
template<typename T , typename U , typename V , typename StorageT , typename StorageU , typename StorageV , typename BinaryFunctor >
static void Transform (const vtkm::cont::ArrayHandle< T, StorageT > &input1, const vtkm::cont::ArrayHandle< U, StorageU > &input2, vtkm::cont::ArrayHandle< V, StorageV > &output, BinaryFunctor binaryFunctor)
 Apply a given binary operation function element-wise to input arrays. More...
 
template<typename T , class Storage >
static void Unique (vtkm::cont::ArrayHandle< T, Storage > &values)
 Reduce an array to only the unique values it contains. More...
 
template<typename T , class Storage , class BinaryCompare >
static void Unique (vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
 Reduce an array to only the unique values it contains. More...
 
template<typename T , class CIn , class CVal , class COut >
static void UpperBounds (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output)
 Output is the last index in input for each item in values that wouldn't alter the ordering of input. More...
 
template<typename T , class CIn , class CVal , class COut , class BinaryCompare >
static void UpperBounds (const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< T, CVal > &values, vtkm::cont::ArrayHandle< vtkm::Id, COut > &output, BinaryCompare binary_compare)
 Output is the last index in input for each item in values that wouldn't alter the ordering of input. More...
 
template<class CIn , class COut >
static void UpperBounds (const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &input, vtkm::cont::ArrayHandle< vtkm::Id, COut > &values_output)
 A special version of UpperBounds that does an in place operation. More...
 
static void Fill (vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
 Fill the BitField with a specific pattern of bits. More...
 
static void Fill (vtkm::cont::BitField &bits, bool value)
 Fill the BitField with a specific pattern of bits. More...
 
template<typename WordType >
static void Fill (vtkm::cont::BitField &bits, WordType word, vtkm::Id numBits)
 Fill the BitField with a specific pattern of bits. More...
 
template<typename WordType >
static void Fill (vtkm::cont::BitField &bits, WordType word)
 Fill the BitField with a specific pattern of bits. More...
 
template<typename T , typename S >
static void Fill (vtkm::cont::ArrayHandle< T, S > &array, const T &value)
 Fill array with value. More...
 
template<typename T , typename S >
static void Fill (vtkm::cont::ArrayHandle< T, S > &array, const T &value, const vtkm::Id numValues)
 Fill array with value. More...
 

Public Attributes

static T U
 
static T KIn
 
static T VIn
 
static T VOut
 

Detailed Description

template<class DeviceAdapterTag>
struct vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >

Struct containing device adapter algorithms.

This struct, templated on the device adapter tag, comprises static methods that implement the algorithms provided by the device adapter. The default struct is not implemented. Device adapter implementations must specialize the template.

Member Function Documentation

◆ BitFieldToUnorderedSet()

template<class DeviceAdapterTag >
template<typename IndicesStorage >
static vtkm::Id vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::BitFieldToUnorderedSet ( const vtkm::cont::BitField bits,
vtkm::cont::ArrayHandle< Id, IndicesStorage > &  indices 
)
static

Create a unique, unsorted list of indices denoting which bits are set in a bitfield.

Returns the total number of set bits.

◆ Copy()

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Copy ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< U, COut > &  output 
)
static

Copy the contents of one ArrayHandle to another.

Copies the contents of input to output. The array output will be allocated to the same size of input. If output has already been allocated we will reallocate and clear any current values.

◆ CopyIf() [1/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn , class CStencil , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::CopyIf ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< U, CStencil > &  stencil,
vtkm::cont::ArrayHandle< T, COut > &  output 
)
static

Conditionally copy elements in the input array to the output array.

Calls the parallel primitive function of stream compaction on the input to remove unwanted elements. The result of the stream compaction is placed in output. The values in stencil are used to determine which input values are placed into output, with all stencil values not equal to the default constructor being considered valid. The size of output will be modified after this call as we can't know the number of elements that will be removed by the stream compaction algorithm.

◆ CopyIf() [2/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn , class CStencil , class COut , class UnaryPredicate >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::CopyIf ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< U, CStencil > &  stencil,
vtkm::cont::ArrayHandle< T, COut > &  output,
UnaryPredicate  unary_predicate 
)
static

Conditionally copy elements in the input array to the output array.

Calls the parallel primitive function of stream compaction on the input to remove unwanted elements. The result of the stream compaction is placed in output. The values in stencil are passed to the unary comparison object which is used to determine which /c input values are placed into output. The size of output will be modified after this call as we can't know the number of elements that will be removed by the stream compaction algorithm.

◆ CopySubRange()

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn , class COut >
static bool vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::CopySubRange ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::Id  inputStartIndex,
vtkm::Id  numberOfElementsToCopy,
vtkm::cont::ArrayHandle< U, COut > &  output,
vtkm::Id  outputIndex = 0 
)
static

Copy the contents of a section of one ArrayHandle to another.

Copies the a range of elements of input to output. The number of elements is determined by numberOfElementsToCopy, and initial start position is determined by inputStartIndex. You can control where in the destination the copy should occur by specifying the outputIndex

If inputStartIndex + numberOfElementsToCopy is greater than the length of input we will only copy until we reach the end of the input array

If the outputIndex + numberOfElementsToCopy is greater than the length of output we will reallocate the output array so it can fit the number of elements we desire.

Requirements:
  • If input and output share memory, the input and output ranges must not overlap.

◆ CountSetBits()

template<class DeviceAdapterTag >
static vtkm::Id vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::CountSetBits ( const vtkm::cont::BitField bits)
static

Returns the total number of "1" bits in BitField.

◆ Fill() [1/6]

template<class DeviceAdapterTag >
template<typename T , typename S >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::ArrayHandle< T, S > &  array,
const T &  value 
)
static

Fill array with value.

If numValues is specified, the array will be resized.

◆ Fill() [2/6]

template<class DeviceAdapterTag >
template<typename T , typename S >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::ArrayHandle< T, S > &  array,
const T &  value,
const vtkm::Id  numValues 
)
static

Fill array with value.

If numValues is specified, the array will be resized.

◆ Fill() [3/6]

template<class DeviceAdapterTag >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::BitField bits,
bool  value 
)
static

Fill the BitField with a specific pattern of bits.

For boolean values, all bits are set to 1 if value is true, or 0 if value is false. For word masks, the word type must be an unsigned integral type, which will be stamped across the BitField. If numBits is provided, the BitField is resized appropriately.

◆ Fill() [4/6]

template<class DeviceAdapterTag >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::BitField bits,
bool  value,
vtkm::Id  numBits 
)
static

Fill the BitField with a specific pattern of bits.

For boolean values, all bits are set to 1 if value is true, or 0 if value is false. For word masks, the word type must be an unsigned integral type, which will be stamped across the BitField. If numBits is provided, the BitField is resized appropriately.

◆ Fill() [5/6]

template<class DeviceAdapterTag >
template<typename WordType >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::BitField bits,
WordType  word 
)
static

Fill the BitField with a specific pattern of bits.

For boolean values, all bits are set to 1 if value is true, or 0 if value is false. For word masks, the word type must be an unsigned integral type, which will be stamped across the BitField. If numBits is provided, the BitField is resized appropriately.

◆ Fill() [6/6]

template<class DeviceAdapterTag >
template<typename WordType >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Fill ( vtkm::cont::BitField bits,
WordType  word,
vtkm::Id  numBits 
)
static

Fill the BitField with a specific pattern of bits.

For boolean values, all bits are set to 1 if value is true, or 0 if value is false. For word masks, the word type must be an unsigned integral type, which will be stamped across the BitField. If numBits is provided, the BitField is resized appropriately.

◆ LowerBounds() [1/3]

template<class DeviceAdapterTag >
template<typename T , class CIn , class CVal , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::LowerBounds ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< T, CVal > &  values,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  output 
)
static

Output is the first index in input for each item in values that wouldn't alter the ordering of input.

LowerBounds is a vectorized search. From each value in values it finds the first place the item can be inserted in the ordered input array and stores the index in output.

Requirements:
  • input must already be sorted

◆ LowerBounds() [2/3]

template<class DeviceAdapterTag >
template<typename T , class CIn , class CVal , class COut , class BinaryCompare >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::LowerBounds ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< T, CVal > &  values,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  output,
BinaryCompare  binary_compare 
)
static

Output is the first index in input for each item in values that wouldn't alter the ordering of input.

LowerBounds is a vectorized search. From each value in values it finds the first place the item can be inserted in the ordered input array and stores the index in output. Uses the custom comparison functor to determine the correct location for each item.

Requirements:
  • input must already be sorted

◆ LowerBounds() [3/3]

template<class DeviceAdapterTag >
template<class CIn , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::LowerBounds ( const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &  input,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  values_output 
)
static

A special version of LowerBounds that does an in place operation.

This version of lower bounds performs an in place operation where each value in the values_output array is replaced by the index in input where it occurs. Because this is an in place operation, the type of the arrays is limited to vtkm::Id.

◆ Reduce() [1/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn >
static U vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Reduce ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
U  initialValue 
)
static

Compute a accumulated sum operation on the input ArrayHandle.

Computes an accumulated sum on the input ArrayHandle, returning the total sum. Reduce is similar to the stl accumulate sum function, exception that Reduce doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be commutative, or you will get inconsistent results.

Returns
The total sum.

◆ Reduce() [2/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class CIn , class BinaryFunctor >
static U vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Reduce ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
U  initialValue,
BinaryFunctor  binary_functor 
)
static

Compute a accumulated sum operation on the input ArrayHandle.

Computes an accumulated sum (or any user binary operation) on the input ArrayHandle, returning the total sum. Reduce is similar to the stl accumulate sum function, exception that Reduce doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be commutative, or you will get inconsistent results.

Returns
The total sum.

◆ ReduceByKey()

template<class DeviceAdapterTag >
template<typename T , typename U , class CKeyIn , class CValIn , class CKeyOut , class CValOut , class BinaryFunctor >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ReduceByKey ( const vtkm::cont::ArrayHandle< T, CKeyIn > &  keys,
const vtkm::cont::ArrayHandle< U, CValIn > &  values,
vtkm::cont::ArrayHandle< T, CKeyOut > &  keys_output,
vtkm::cont::ArrayHandle< U, CValOut > &  values_output,
BinaryFunctor  binary_functor 
)
static

Compute a accumulated sum operation on the input key value pairs.

Computes a segmented accumulated sum (or any user binary operation) on the keys and values ArrayHandle(s). Each segmented accumulated sum is run on consecutive equal keys with the binary operation applied to all values inside that range. Once finished a single key and value is created for each segment.

◆ ScanExclusive() [1/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut >
static T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExclusive ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output 
)
static

Compute an exclusive prefix sum operation on the input ArrayHandle.

Computes an exclusive prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. ExclusiveScan is similar to the stl partial sum function, exception that ExclusiveScan doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results. When the input and output ArrayHandles are the same ArrayHandle the operation will be done inplace.

Returns
The total sum.

◆ ScanExclusive() [2/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut , class BinaryFunctor >
static T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExclusive ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output,
BinaryFunctor  binaryFunctor,
const T &  initialValue 
)
static

Compute an exclusive prefix sum operation on the input ArrayHandle.

Computes an exclusive prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. ExclusiveScan is similar to the stl partial sum function, exception that ExclusiveScan doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results. When the input and output ArrayHandles are the same ArrayHandle the operation will be done inplace.

Returns
The total sum.

Compute a segmented exclusive prefix sum operation on the input key value pairs.

Computes a segmented exclusive prefix sum (or any user binary operation) on the keys and values ArrayHandle(s). Each segmented exclusive prefix sum is run on consecutive equal keys with the binary operation applied to all values inside that range. Once finished the result is stored in values_output ArrayHandle.

◆ ScanExclusiveByKey() [1/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class KIn , typename VIn , typename VOut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExclusiveByKey ( const vtkm::cont::ArrayHandle< T, KIn > &  keys,
const vtkm::cont::ArrayHandle< U, VIn > &  values,
vtkm::cont::ArrayHandle< U, VOut > &  output 
)
static

Compute a segmented exclusive prefix sum operation on the input key value pairs.

Computes a segmented inclusive prefix sum on the keys and values ArrayHandle(s). Each segmented inclusive prefix sum is run on consecutive equal keys with the binary operation vtkm::Add applied to all values inside that range. Once finished the result is stored in values_output ArrayHandle.

◆ ScanExclusiveByKey() [2/2]

template<class DeviceAdapterTag >
static T class BinaryFunctor static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExclusiveByKey ( const vtkm::cont::ArrayHandle< T, KIn > &  keys,
const vtkm::cont::ArrayHandle< U, VIn > &  values,
vtkm::cont::ArrayHandle< U, VOut > &  output,
const U initialValue,
BinaryFunctor  binaryFunctor 
)

◆ ScanExtended() [1/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExtended ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output 
)
static

Compute an extended prefix sum operation on the input ArrayHandle.

Computes an extended prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. The output array is one element longer than the input array. This produces an output array that contains both an inclusive scan (in elements [1, size]) and an exclusive scan (in elements [0, size-1]). As such, the first element of the output array always has the initial value and the last element of the output array always has the total sum. By using ArrayHandleView, arrays containing both inclusive and exclusive scans can be generated from an extended scan with minimal memory usage.

This algorithm may also be more efficient than ScanInclusive and ScanExclusive on some devices, since it may be able to avoid copying the total sum to the control environment to return.

ScanExtended is similar to the stl partial sum function, exception that ScanExtended doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results.

This overload of ScanExtended uses vtkm::Add for the binary functor, and uses zero for the initial value of the scan operation.

◆ ScanExtended() [2/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut , class BinaryFunctor >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanExtended ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output,
BinaryFunctor  binaryFunctor,
const T &  initialValue 
)
static

Compute an extended prefix sum operation on the input ArrayHandle.

Computes an extended prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. The output array is one element longer than the input array. This produces an output array that contains both an inclusive scan (in elements [1, size]) and an exclusive scan (in elements [0, size-1]). As such, the first element of the output array always has the initial value and the last element of the output array always has the total sum. By using ArrayHandleView, arrays containing both inclusive and exclusive scans can be generated from an extended scan with minimal memory usage.

This algorithm may also be more efficient than ScanInclusive and ScanExclusive on some devices, since it may be able to avoid copying the total sum to the control environment to return.

ScanExtended is similar to the stl partial sum function, exception that ScanExtended doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results.

◆ ScanInclusive() [1/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut >
static T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanInclusive ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output 
)
static

Compute an inclusive prefix sum operation on the input ArrayHandle.

Computes an inclusive prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. InclusiveScan is similar to the stl partial sum function, exception that InclusiveScan doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results. When the input and output ArrayHandles are the same ArrayHandle the operation will be done inplace.

Returns
The total sum.

◆ ScanInclusive() [2/2]

template<class DeviceAdapterTag >
template<typename T , class CIn , class COut , class BinaryFunctor >
static T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanInclusive ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
vtkm::cont::ArrayHandle< T, COut > &  output,
BinaryFunctor  binary_functor 
)
static

Compute an inclusive prefix sum operation on the input ArrayHandle.

Computes an inclusive prefix sum operation on the input ArrayHandle, storing the results in the output ArrayHandle. InclusiveScan is similar to the stl partial sum function, exception that InclusiveScan doesn't do a serial summation. This means that if you have defined a custom plus operator for T it must be associative, or you will get inconsistent results. When the input and output ArrayHandles are the same ArrayHandle the operation will be done inplace.

Returns
The total sum.

◆ ScanInclusiveByKey() [1/2]

template<class DeviceAdapterTag >
template<typename T , typename U , typename KIn , typename VIn , typename VOut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanInclusiveByKey ( const vtkm::cont::ArrayHandle< T, KIn > &  keys,
const vtkm::cont::ArrayHandle< U, VIn > &  values,
vtkm::cont::ArrayHandle< U, VOut > &  values_output 
)
static

Compute a segmented inclusive prefix sum operation on the input key value pairs.

Computes a segmented inclusive prefix sum on the keys and values ArrayHandle(s). Each segmented inclusive prefix sum is run on consecutive equal keys with the binary operation vtkm::Add applied to all values inside that range. Once finished the result is stored in values_output ArrayHandle.

◆ ScanInclusiveByKey() [2/2]

template<class DeviceAdapterTag >
template<typename T , typename U , typename KIn , typename VIn , typename VOut , typename BinaryFunctor >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::ScanInclusiveByKey ( const vtkm::cont::ArrayHandle< T, KIn > &  keys,
const vtkm::cont::ArrayHandle< U, VIn > &  values,
vtkm::cont::ArrayHandle< U, VOut > &  values_output,
BinaryFunctor  binary_functor 
)
static

Compute a segmented inclusive prefix sum operation on the input key value pairs.

Computes a segmented inclusive prefix sum (or any user binary operation) on the keys and values ArrayHandle(s). Each segmented inclusive prefix sum is run on consecutive equal keys with the binary operation applied to all values inside that range. Once finished the result is stored in values_output ArrayHandle.

◆ Schedule() [1/2]

template<class DeviceAdapterTag >
template<class Functor >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Schedule ( Functor  functor,
vtkm::Id  numInstances 
)
static

Schedule many instances of a function to run on concurrent threads.

Calls the functor on several threads. This is the function used in the control environment to spawn activity in the execution environment. functor is a function-like object that can be invoked with the calling specification functor(vtkm::Id index). It also has a method called from the control environment to establish the error reporting buffer with the calling specification functor.SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer &errorMessage). This object can be stored in the functor's state such that if RaiseError is called on it in the execution environment, an ErrorExecution will be thrown from Schedule.

The argument of the invoked functor uniquely identifies the thread or instance of the invocation. There should be one invocation for each index in the range [0, numInstances].

◆ Schedule() [2/2]

template<class DeviceAdapterTag >
template<class Functor , class IndiceType >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Schedule ( Functor  functor,
vtkm::Id3  rangeMax 
)
static

Schedule many instances of a function to run on concurrent threads.

Calls the functor on several threads. This is the function used in the control environment to spawn activity in the execution environment. functor is a function-like object that can be invoked with the calling specification functor(vtkm::Id3 index) or functor(vtkm::Id index). It also has a method called from the control environment to establish the error reporting buffer with the calling specification functor.SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer &errorMessage). This object can be stored in the functor's state such that if RaiseError is called on it in the execution environment, an ErrorExecution will be thrown from Schedule.

The argument of the invoked functor uniquely identifies the thread or instance of the invocation. It is at the device adapter's discretion whether to schedule on 1D or 3D indices, so the functor should have an operator() overload for each index type. If 3D indices are used, there is one invocation for every i, j, k value between [0, 0, 0] and rangeMax. If 1D indices are used, this Schedule behaves as if Schedule(functor, rangeMax[0]*rangeMax[1]*rangeMax[2]) were called.

◆ Sort() [1/2]

template<class DeviceAdapterTag >
template<typename T , class Storage >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Sort ( vtkm::cont::ArrayHandle< T, Storage > &  values)
static

Unstable ascending sort of input array.

Sorts the contents of values so that they in ascending value. Doesn't guarantee stability

◆ Sort() [2/2]

template<class DeviceAdapterTag >
template<typename T , class Storage , class BinaryCompare >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Sort ( vtkm::cont::ArrayHandle< T, Storage > &  values,
BinaryCompare  binary_compare 
)
static

Unstable ascending sort of input array.

Sorts the contents of values so that they in ascending value based on the custom compare functor.

BinaryCompare should be a strict weak ordering comparison operator

◆ SortByKey() [1/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class StorageT , class StorageU >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::SortByKey ( vtkm::cont::ArrayHandle< T, StorageT > &  keys,
vtkm::cont::ArrayHandle< U, StorageU > &  values 
)
static

Unstable ascending sort of keys and values.

Sorts the contents of keys and values so that they in ascending value based on the values of keys.

◆ SortByKey() [2/2]

template<class DeviceAdapterTag >
template<typename T , typename U , class StorageT , class StorageU , class BinaryCompare >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::SortByKey ( vtkm::cont::ArrayHandle< T, StorageT > &  keys,
vtkm::cont::ArrayHandle< U, StorageU > &  values,
BinaryCompare  binary_compare 
)
static

Unstable ascending sort of keys and values.

Sorts the contents of keys and values so that they in ascending value based on the custom compare functor.

BinaryCompare should be a strict weak ordering comparison operator

Completes any asynchronous operations running on the device.

Waits for any asynchronous operations running on the device to complete.

◆ Transform()

template<class DeviceAdapterTag >
template<typename T , typename U , typename V , typename StorageT , typename StorageU , typename StorageV , typename BinaryFunctor >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Transform ( const vtkm::cont::ArrayHandle< T, StorageT > &  input1,
const vtkm::cont::ArrayHandle< U, StorageU > &  input2,
vtkm::cont::ArrayHandle< V, StorageV > &  output,
BinaryFunctor  binaryFunctor 
)
static

Apply a given binary operation function element-wise to input arrays.

Apply the give binary operation to pairs of elements from the two input array input1 and input2. The number of elements in the input arrays do not have to be the same, in this case, only the smaller of the two numbers of elements will be applied. Outputs of the binary operation is stored in output.

◆ Unique() [1/2]

template<class DeviceAdapterTag >
template<typename T , class Storage >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Unique ( vtkm::cont::ArrayHandle< T, Storage > &  values)
static

Reduce an array to only the unique values it contains.

Removes all duplicate values in values that are adjacent to each other. Which means you should sort the input array unless you want duplicate values that aren't adjacent. Note the values array size might be modified by this operation.

◆ Unique() [2/2]

template<class DeviceAdapterTag >
template<typename T , class Storage , class BinaryCompare >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::Unique ( vtkm::cont::ArrayHandle< T, Storage > &  values,
BinaryCompare  binary_compare 
)
static

Reduce an array to only the unique values it contains.

Removes all duplicate values in values that are adjacent to each other. Which means you should sort the input array unless you want duplicate values that aren't adjacent. Note the values array size might be modified by this operation.

Uses the custom binary predicate Comparison to determine if something is unique. The predicate must return true if the two items are the same.

◆ UpperBounds() [1/3]

template<class DeviceAdapterTag >
template<typename T , class CIn , class CVal , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::UpperBounds ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< T, CVal > &  values,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  output 
)
static

Output is the last index in input for each item in values that wouldn't alter the ordering of input.

UpperBounds is a vectorized search. From each value in values it finds the last place the item can be inserted in the ordered input array and stores the index in output.

Requirements:
  • input must already be sorted

◆ UpperBounds() [2/3]

template<class DeviceAdapterTag >
template<typename T , class CIn , class CVal , class COut , class BinaryCompare >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::UpperBounds ( const vtkm::cont::ArrayHandle< T, CIn > &  input,
const vtkm::cont::ArrayHandle< T, CVal > &  values,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  output,
BinaryCompare  binary_compare 
)
static

Output is the last index in input for each item in values that wouldn't alter the ordering of input.

LowerBounds is a vectorized search. From each value in values it finds the last place the item can be inserted in the ordered input array and stores the index in output. Uses the custom comparison functor to determine the correct location for each item.

Requirements:
  • input must already be sorted

◆ UpperBounds() [3/3]

template<class DeviceAdapterTag >
template<class CIn , class COut >
static void vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::UpperBounds ( const vtkm::cont::ArrayHandle< vtkm::Id, CIn > &  input,
vtkm::cont::ArrayHandle< vtkm::Id, COut > &  values_output 
)
static

A special version of UpperBounds that does an in place operation.

This version of lower bounds performs an in place operation where each value in the values_output array is replaced by the last index in input where it occurs. Because this is an in place operation, the type of the arrays is limited to vtkm::Id.

Member Data Documentation

◆ KIn

template<class DeviceAdapterTag >
T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::KIn

◆ U

template<class DeviceAdapterTag >
T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::U

◆ VIn

template<class DeviceAdapterTag >
T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::VIn

◆ VOut

template<class DeviceAdapterTag >
T vtkm::cont::DeviceAdapterAlgorithm< DeviceAdapterTag >::VOut

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