OpenMPCD
Classes | Public Types | Public Member Functions | List of all members
OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride > Class Template Reference

Wraps an iterator range such that the iteration stride is not (necessarily) 1. More...

#include <StridedIteratorRange.hpp>

Classes

class  StrideFunctor
 Functor class for advancing a pointer by the given stride. More...
 

Public Types

typedef thrust::iterator_difference< UnderlyingIterator >::type IteratorDifference
 The type of the difference of two of the underlying iterators. More...
 
typedef thrust::counting_iterator< IteratorDifferenceCountingIterator
 Type that is used to linearly increment a count. More...
 
typedef thrust::transform_iterator< StrideFunctor, CountingIteratorTransformIterator
 Type that applies StrideFunctor to the input sequence. More...
 
typedef thrust::permutation_iterator< UnderlyingIterator, TransformIteratorPermutationIterator
 Type that will be indexing into the UnderlyingIterator according to the TransformIterator. More...
 
typedef PermutationIterator Iterator
 The effective iterator type. More...
 

Public Member Functions

 StridedIteratorRange (const UnderlyingIterator &start, const UnderlyingIterator &pastTheEnd_)
 The constructor. More...
 
Iterator begin () const
 Returns the first iterator in the strided range. More...
 
Iterator end () const
 Returns the first past-the-end iterator of the strided range. More...
 

Detailed Description

template<typename UnderlyingIterator, unsigned int stride = 0>
class OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >

Wraps an iterator range such that the iteration stride is not (necessarily) 1.

This strided iterator range exposes the underlying iterator range in such a way that incrementing the exposed iterator (called "effective iterator") once is equivalent to incrementing the underlying iterator as many times as the stride specifies.

Remarks
This code has been adapted from examples/strided_range.cu of the thrust library.
Template Parameters
UnderlyingIteratorThe underlying iterator type.
strideThe iterator stride. This parameter specifies how often the underlying iterator gets incremented each time this instance of StridedIteratorRange gets incremented. The special value 0 selects a (partially) specialized template of StridedIteratorRange that allows one to set the stride in the constructor.

Definition at line 46 of file StridedIteratorRange.hpp.

Member Typedef Documentation

◆ CountingIterator

template<typename UnderlyingIterator , unsigned int stride = 0>
typedef thrust::counting_iterator<IteratorDifference> OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::CountingIterator

Type that is used to linearly increment a count.

Definition at line 82 of file StridedIteratorRange.hpp.

◆ Iterator

template<typename UnderlyingIterator , unsigned int stride = 0>
typedef PermutationIterator OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::Iterator

The effective iterator type.

Definition at line 95 of file StridedIteratorRange.hpp.

◆ IteratorDifference

template<typename UnderlyingIterator , unsigned int stride = 0>
typedef thrust::iterator_difference<UnderlyingIterator>::type OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::IteratorDifference

The type of the difference of two of the underlying iterators.

Definition at line 54 of file StridedIteratorRange.hpp.

◆ PermutationIterator

template<typename UnderlyingIterator , unsigned int stride = 0>
typedef thrust::permutation_iterator< UnderlyingIterator, TransformIterator> OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::PermutationIterator

Type that will be indexing into the UnderlyingIterator according to the TransformIterator.

Definition at line 91 of file StridedIteratorRange.hpp.

◆ TransformIterator

template<typename UnderlyingIterator , unsigned int stride = 0>
typedef thrust::transform_iterator<StrideFunctor, CountingIterator> OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::TransformIterator

Type that applies StrideFunctor to the input sequence.

Definition at line 86 of file StridedIteratorRange.hpp.

Constructor & Destructor Documentation

◆ StridedIteratorRange()

template<typename UnderlyingIterator , unsigned int stride = 0>
OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::StridedIteratorRange ( const UnderlyingIterator &  start,
const UnderlyingIterator &  pastTheEnd_ 
)
inline

The constructor.

Parameters
[in]startThe first iterator to iterate over.
[in]pastTheEnd_The first iterator that is past-the-end.

Definition at line 104 of file StridedIteratorRange.hpp.

Member Function Documentation

◆ begin()

template<typename UnderlyingIterator , unsigned int stride = 0>
Iterator OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::begin ( ) const
inline

Returns the first iterator in the strided range.

Definition at line 114 of file StridedIteratorRange.hpp.

◆ end()

template<typename UnderlyingIterator , unsigned int stride = 0>
Iterator OpenMPCD::CUDA::StridedIteratorRange< UnderlyingIterator, stride >::end ( ) const
inline

Returns the first past-the-end iterator of the strided range.

Definition at line 123 of file StridedIteratorRange.hpp.


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