Loading...
Searching...
No Matches
Opm::gpuistl::GpuView< T >::iterator Class Reference

Iterator class to make GpuViews more similar to std containers. More...

`#include <GpuView.hpp>`

## Public Types

using | iterator_category = std::forward_iterator_tag
using | difference_type = std::ptrdiff_t
using | value_type = T
using | pointer = T*
using | reference = T&

## Public Member Functions

__host__ __device__ | iterator (T *ptr)
| Create iterator from a pointer.
__host__ __device__ reference | operator* () const
| Dereference operator.
__host__ __device__ iterator & | operator++ ()
| Pre-increment operator.
__host__ __device__ iterator | operator++ (int)
| Post-increment operator.
__host__ __device__ iterator & | operator-- ()
| Pre-decrement operator.
__host__ __device__ iterator | operator-- (int)
| Post-decrement operator.
__host__ __device__ bool | operator!= (const iterator &other) const
| Inequality comparison operator.
__host__ __device__ bool | operator== (const iterator &other) const
| Inequality comparison operator.
__host__ __device__ difference_type | operator- (const iterator &other) const
| subtraction operator
__host__ __device__ iterator | operator- (difference_type n) const
| Subtraction of given number of elements from iterator.
__host__ __device__ iterator | operator+ (difference_type n) const
| Addition operator with diffptr.
__host__ __device__ bool | operator< (const iterator &other) const
| Less than comparison.
__host__ __device__ bool | operator> (const iterator &other) const
| Greater than comparison.

## Detailed Description

template<typename T>
class Opm::gpuistl::GpuView< T >::iterator

Iterator class to make GpuViews more similar to std containers.

## Constructor & Destructor Documentation

## iterator()

template<typename T>

__host__ __device__ Opm::gpuistl::GpuView< T >::iterator::iterator | ( | T * | ptr | ) |

inline

Create iterator from a pointer.

Parameters

  ptr | provided pointer that will become an iterator

Returns
  // the created iterator object

## Member Function Documentation

## operator!=()

template<typename T>

__host__ __device__ bool Opm::gpuistl::GpuView< T >::iterator::operator!= | ( | const iterator & | other | ) | const

inline

Inequality comparison operator.

Returns
  boolean value that is true if the pointers contains different addresses

## operator*()

template<typename T>

__host__ __device__ reference Opm::gpuistl::GpuView< T >::iterator::operator* | ( |  | ) | const

inline

Dereference operator.

Returns
  retrieve what the iterator points at

## operator+()

template<typename T>

__host__ __device__ iterator Opm::gpuistl::GpuView< T >::iterator::operator+ | ( | difference_type | n | ) | const

inline

Addition operator with diffptr.

Parameters

  n | diffptr to add

Returns
  new iterator with diffptr added

## operator++() [1/2]

template<typename T>

__host__ __device__ iterator & Opm::gpuistl::GpuView< T >::iterator::operator++ | ( |  | ) |

inline

Pre-increment operator.

Returns
  return the pointer after it is incremented

## operator++() [2/2]

template<typename T>

__host__ __device__ iterator Opm::gpuistl::GpuView< T >::iterator::operator++ | ( | int |  | ) |

inline

Post-increment operator.

Parameters

  no | parameter, int is placeholder for c++ implementation to differentiate from pre-increment

Returns
  Iterator before it is incremented

## operator-() [1/2]

template<typename T>

__host__ __device__ difference_type Opm::gpuistl::GpuView< T >::iterator::operator- | ( | const iterator & | other | ) | const

inline

subtraction operator

Parameters

  other | iterator to subtract

Returns
  diffptr that represents difference between the iterators

## operator-() [2/2]

template<typename T>

__host__ __device__ iterator Opm::gpuistl::GpuView< T >::iterator::operator- | ( | difference_type | n | ) | const

inline

Subtraction of given number of elements from iterator.

Parameters

  n | the number of elements to step backwards

Returns
  An iterator pointing to a location n steps behind

## operator--() [1/2]

template<typename T>

__host__ __device__ iterator & Opm::gpuistl::GpuView< T >::iterator::operator-- | ( |  | ) |

inline

Pre-decrement operator.

Returns
  return the pointer after it is decremented

## operator--() [2/2]

template<typename T>

__host__ __device__ iterator Opm::gpuistl::GpuView< T >::iterator::operator-- | ( | int |  | ) |

inline

Post-decrement operator.

Parameters

  no | parameter, int is placeholder for c++ implementation to differentiate from pre-decrement

Returns
  Iterator before it is decremented

## operator<()

template<typename T>

__host__ __device__ bool Opm::gpuistl::GpuView< T >::iterator::operator< | ( | const iterator & | other | ) | const

inline

Less than comparison.

Parameters

  other | iterator

Returns
  true if this objects iterator is less than the other iterator

## operator==()

template<typename T>

__host__ __device__ bool Opm::gpuistl::GpuView< T >::iterator::operator== | ( | const iterator & | other | ) | const

inline

Inequality comparison operator.

Returns
  boolean value that is true if the pointers contains the same address

## operator>()

template<typename T>

__host__ __device__ bool Opm::gpuistl::GpuView< T >::iterator::operator> | ( | const iterator & | other | ) | const

inline

Greater than comparison.

Parameters

  other | iterator

Returns
  true if this objects iterator is greater than than the other iterator

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

- opm/simulators/linalg/gpuistl/GpuView.hpp