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

Wraps an iterator range such that it is grouped into "bunches" of a given length, with a configurable gap between bunches. More...

#include <BunchIteratorRange.hpp>

Classes

class  AdvancingFunctor
 Functor class for advancing a pointer by the given number of effective elements. 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< AdvancingFunctor, CountingIteratorTransformIterator
 Type that applies AdvancingFunctor 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

 BunchIteratorRange (const UnderlyingIterator &start, const UnderlyingIterator &pastTheEnd_, const unsigned int bunchSize_, const unsigned int gapSize_)
 The constructor. More...
 
Iterator begin () const
 Returns the first iterator in the effective range. More...
 
Iterator end () const
 Returns the first past-the-end iterator of the effective range. More...
 

Detailed Description

template<typename UnderlyingIterator>
class OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >

Wraps an iterator range such that it is grouped into "bunches" of a given length, with a configurable gap between bunches.

As an example, assume that one has an input iterator range that represents the sequence A_0, A_1, A_2, ..., A_N. If bunchSize is set to 3, gapSize is set to 2, and N = 11 (i.e. if the input sequence has 12 elements), this iterator range will iterate over the elements A_0, A_1, A_2, followed by A_5, A_6, A_7 (skipping the two elements A_3 and A_4), followed by A_10 and A_11, and end there since the input sequence is exhausted.

Template Parameters
UnderlyingIteratorThe underlying iterator type.

Definition at line 39 of file BunchIteratorRange.hpp.

Member Typedef Documentation

◆ CountingIterator

template<typename UnderlyingIterator >
typedef thrust::counting_iterator<IteratorDifference> OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::CountingIterator

Type that is used to linearly increment a count.

Definition at line 113 of file BunchIteratorRange.hpp.

◆ Iterator

template<typename UnderlyingIterator >
typedef PermutationIterator OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::Iterator

The effective iterator type.

Definition at line 126 of file BunchIteratorRange.hpp.

◆ IteratorDifference

template<typename UnderlyingIterator >
typedef thrust::iterator_difference<UnderlyingIterator>::type OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::IteratorDifference

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

Definition at line 45 of file BunchIteratorRange.hpp.

◆ PermutationIterator

template<typename UnderlyingIterator >
typedef thrust::permutation_iterator< UnderlyingIterator, TransformIterator> OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::PermutationIterator

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

Definition at line 122 of file BunchIteratorRange.hpp.

◆ TransformIterator

template<typename UnderlyingIterator >
typedef thrust::transform_iterator<AdvancingFunctor, CountingIterator> OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::TransformIterator

Type that applies AdvancingFunctor to the input sequence.

Definition at line 117 of file BunchIteratorRange.hpp.

Constructor & Destructor Documentation

◆ BunchIteratorRange()

template<typename UnderlyingIterator >
OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::BunchIteratorRange ( const UnderlyingIterator &  start,
const UnderlyingIterator &  pastTheEnd_,
const unsigned int  bunchSize_,
const unsigned int  gapSize_ 
)
inline

The constructor.

Exceptions
OpenMPCD::InvalidArgumentExceptionIf OPENMPCD_DEBUG is defined, throws if bunchSize_ == 0.
Parameters
[in]startThe first iterator to iterate over.
[in]pastTheEnd_The first iterator that is past-the-end.
[in]bunchSize_The bunch size, which must not be 0.
[in]gapSize_The gap size.

Definition at line 140 of file BunchIteratorRange.hpp.

Member Function Documentation

◆ begin()

template<typename UnderlyingIterator >
Iterator OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::begin ( ) const
inline

Returns the first iterator in the effective range.

Definition at line 154 of file BunchIteratorRange.hpp.

◆ end()

template<typename UnderlyingIterator >
Iterator OpenMPCD::CUDA::BunchIteratorRange< UnderlyingIterator >::end ( ) const
inline

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

Definition at line 166 of file BunchIteratorRange.hpp.


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