QUGaR 0.0.4
Loading...
Searching...
No Matches
qugar::TensorIndexRangeTP< dim >::Iterator Class Reference

Iterator class for tensor index ranges. More...

#include <tensor_index_tp.hpp>

Public Member Functions

 Iterator (const TensorIndexTP< dim > &index, const TensorIndexTP< dim > &lower_bound, const TensorIndexTP< dim > &upper_bound)
 Constructs a new iterator object given and index and its lower and upper bounds.
 
const TensorIndexTP< dim > & operator* () const
 Dereference operator.
 
const TensorIndexTP< dim > * operator-> () const
 Indirection operator.
 
int flat () const
 Transforms the current tensor index into a flat one by considering the upper bound as associated size.
 
Iteratoroperator++ ()
 Pre increments the iterator.
 
Iterator operator++ (int)
 Post increments the iterator.
 
bool operator== (const Iterator &rhs) const
 Compares if two iterators are equal. They are considered to be equal if their indices and bounds are equal for all the components.
 
bool operator!= (const Iterator &rhs) const
 Compares if two iterators are different. They are considered to be different if at least one of the components of their indices or bounds are different.
 

Private Attributes

TensorIndexTP< dim > index_
 Iterator index.
 
TensorIndexTP< dim > lower_bound_
 Lower bound.
 
TensorIndexTP< dim > upper_bound_
 Upper bound.
 

Detailed Description

template<int dim>
class qugar::TensorIndexRangeTP< dim >::Iterator

Iterator class for tensor index ranges.

Constructor & Destructor Documentation

◆ Iterator()

template<int dim>
qugar::TensorIndexRangeTP< dim >::Iterator::Iterator ( const TensorIndexTP< dim > & index,
const TensorIndexTP< dim > & lower_bound,
const TensorIndexTP< dim > & upper_bound )

Constructs a new iterator object given and index and its lower and upper bounds.

Parameters
indexCurrent index for the iterator.
lower_boundLower bounds.
upper_boundUpper bounds.

Member Function Documentation

◆ flat()

template<int dim>
int qugar::TensorIndexRangeTP< dim >::Iterator::flat ( ) const
nodiscard

Transforms the current tensor index into a flat one by considering the upper bound as associated size.

Returns
Computed flat index.

◆ operator!=()

template<int dim>
bool qugar::TensorIndexRangeTP< dim >::Iterator::operator!= ( const Iterator & rhs) const
nodiscard

Compares if two iterators are different. They are considered to be different if at least one of the components of their indices or bounds are different.

Parameters
rhsIterator to compare to the current one.
Returns
Whether both iterators are different.

◆ operator*()

template<int dim>
const TensorIndexTP< dim > & qugar::TensorIndexRangeTP< dim >::Iterator::operator* ( ) const
nodiscard

Dereference operator.

Returns
Reference to the index pointed by the iterator.

◆ operator++() [1/2]

template<int dim>
Iterator & qugar::TensorIndexRangeTP< dim >::Iterator::operator++ ( )

Pre increments the iterator.

Returns
Updated iterator.

◆ operator++() [2/2]

template<int dim>
Iterator qugar::TensorIndexRangeTP< dim >::Iterator::operator++ ( int )

Post increments the iterator.

Returns
Updated iterator.

◆ operator->()

template<int dim>
const TensorIndexTP< dim > * qugar::TensorIndexRangeTP< dim >::Iterator::operator-> ( ) const
nodiscard

Indirection operator.

Returns
Pointer to the index pointed by the iterator.

◆ operator==()

template<int dim>
bool qugar::TensorIndexRangeTP< dim >::Iterator::operator== ( const Iterator & rhs) const
nodiscard

Compares if two iterators are equal. They are considered to be equal if their indices and bounds are equal for all the components.

Parameters
rhsIterator to compare to the current one.
Returns
Whether both iterators are equal.

Member Data Documentation

◆ index_

template<int dim>
TensorIndexTP<dim> qugar::TensorIndexRangeTP< dim >::Iterator::index_
private

Iterator index.

◆ lower_bound_

template<int dim>
TensorIndexTP<dim> qugar::TensorIndexRangeTP< dim >::Iterator::lower_bound_
private

Lower bound.

◆ upper_bound_

template<int dim>
TensorIndexTP<dim> qugar::TensorIndexRangeTP< dim >::Iterator::upper_bound_
private

Upper bound.


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