Nektar++
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType > Class Template Reference

#include <StandardMatrix.hpp>

Classes

struct  TagType
 
struct  TagType< const Z >
 

Public Types

typedef T value_type
 
typedef TagType< T >::type iterator_category
 
typedef unsigned int difference_type
 
typedef boost::call_traits< value_type >::reference reference
 
typedef boost::call_traits< value_type >::const_reference const_reference
 
typedef std::remove_reference< value_type >::type * pointer
 

Public Member Functions

 iterator_impl (pointer d, pointer e, bool isEnd=false)
 
 iterator_impl (MatrixType *m, char transpose, bool isEnd=false)
 
 iterator_impl (const iterator_impl< T, MatrixType > &rhs)
 
iterator_impl< T, MatrixType > & operator= (const iterator_impl< T, MatrixType > &rhs)
 
reference operator* ()
 
const_reference operator* () const
 
iterator_impl< T, MatrixType > & operator++ ()
 Prefix increment operator. More...
 
iterator_impl< T, MatrixType > operator++ (int)
 \postfix increment operator. More...
 
bool operator== (const iterator_impl< T, MatrixType > &rhs)
 
bool operator!= (const iterator_impl< T, MatrixType > &rhs)
 

Private Attributes

T * m_data
 
T * m_end
 
unsigned int m_curRow
 
unsigned int m_curColumn
 
MatrixType * m_matrix
 
unsigned int m_curIndex
 
char m_transpose
 

Detailed Description

template<typename DataType>
template<typename T, typename MatrixType>
class Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >

Definition at line 65 of file StandardMatrix.hpp.

Member Typedef Documentation

◆ const_reference

template<typename DataType >
template<typename T , typename MatrixType >
typedef boost::call_traits<value_type>::const_reference Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::const_reference

Definition at line 84 of file StandardMatrix.hpp.

◆ difference_type

template<typename DataType >
template<typename T , typename MatrixType >
typedef unsigned int Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::difference_type

Definition at line 81 of file StandardMatrix.hpp.

◆ iterator_category

template<typename DataType >
template<typename T , typename MatrixType >
typedef TagType<T>::type Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::iterator_category

Definition at line 80 of file StandardMatrix.hpp.

◆ pointer

template<typename DataType >
template<typename T , typename MatrixType >
typedef std::remove_reference<value_type>::type* Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::pointer

Definition at line 85 of file StandardMatrix.hpp.

◆ reference

template<typename DataType >
template<typename T , typename MatrixType >
typedef boost::call_traits<value_type>::reference Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::reference

Definition at line 82 of file StandardMatrix.hpp.

◆ value_type

template<typename DataType >
template<typename T , typename MatrixType >
typedef T Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::value_type

Definition at line 68 of file StandardMatrix.hpp.

Constructor & Destructor Documentation

◆ iterator_impl() [1/3]

template<typename DataType >
template<typename T , typename MatrixType >
Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::iterator_impl ( pointer  d,
pointer  e,
bool  isEnd = false 
)
inline

◆ iterator_impl() [2/3]

template<typename DataType >
template<typename T , typename MatrixType >
Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::iterator_impl ( MatrixType *  m,
char  transpose,
bool  isEnd = false 
)
inline

Definition at line 102 of file StandardMatrix.hpp.

103 : m_data(nullptr), m_end(nullptr), m_curRow(0), m_curColumn(0),
104 m_matrix(m), m_curIndex(0), m_transpose(transpose)
105 {
106 if (isEnd)
107 {
108 m_curRow = std::numeric_limits<unsigned int>::max();
109 m_curColumn = std::numeric_limits<unsigned int>::max();
110 m_curIndex = std::numeric_limits<unsigned int>::max();
111 }
112 }

◆ iterator_impl() [3/3]

template<typename DataType >
template<typename T , typename MatrixType >
Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::iterator_impl ( const iterator_impl< T, MatrixType > &  rhs)
inline

Definition at line 114 of file StandardMatrix.hpp.

115 : m_data(rhs.m_data), m_end(rhs.m_end), m_curRow(rhs.m_curRow),
116 m_curColumn(rhs.m_curColumn), m_matrix(rhs.m_matrix),
117 m_curIndex(rhs.m_curIndex), m_transpose(rhs.m_transpose)
118 {
119 }

Member Function Documentation

◆ operator!=()

template<typename DataType >
template<typename T , typename MatrixType >
bool Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator!= ( const iterator_impl< T, MatrixType > &  rhs)
inline

Definition at line 204 of file StandardMatrix.hpp.

205 {
206 return !(*this == rhs);
207 }

◆ operator*() [1/2]

template<typename DataType >
template<typename T , typename MatrixType >
reference Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator* ( )
inline

Definition at line 134 of file StandardMatrix.hpp.

135 {
136 if (m_data)
137 {
138 ASSERTL1(
139 m_data < m_end,
140 "Attempt to dereference matrix iterator after its end.");
141 return *m_data;
142 }
143 else
144 {
145 return m_matrix->GetPtr()[m_curIndex];
146 }
147 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242

References ASSERTL1.

◆ operator*() [2/2]

template<typename DataType >
template<typename T , typename MatrixType >
const_reference Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator* ( ) const
inline

Definition at line 149 of file StandardMatrix.hpp.

150 {
151 if (m_data)
152 {
153 ASSERTL1(
154 m_data < m_end,
155 "Attempt to dereference matrix iterator after its end.");
156 return *m_data;
157 }
158 else
159 {
160 return m_matrix->GetPtr()[m_curIndex];
161 }
162 }

References ASSERTL1.

◆ operator++() [1/2]

template<typename DataType >
template<typename T , typename MatrixType >
iterator_impl< T, MatrixType > & Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator++ ( )
inline

Prefix increment operator.

Definition at line 165 of file StandardMatrix.hpp.

166 {
167 if (m_data)
168 {
169 ++m_data;
170 }
171 else
172 {
173 std::tie(m_curRow, m_curColumn) =
175 if (m_curRow == std::numeric_limits<unsigned int>::max())
176 {
178 }
179 else
180 {
181 m_curIndex = m_matrix->CalculateIndex(m_curRow, m_curColumn,
183 }
184 }
185 return *this;
186 }

◆ operator++() [2/2]

template<typename DataType >
template<typename T , typename MatrixType >
iterator_impl< T, MatrixType > Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator++ ( int  )
inline

\postfix increment operator.

Definition at line 189 of file StandardMatrix.hpp.

190 {
191 iterator_impl<T, MatrixType> result = *this;
192 ++(*this);
193 return result;
194 }

◆ operator=()

template<typename DataType >
template<typename T , typename MatrixType >
iterator_impl< T, MatrixType > & Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator= ( const iterator_impl< T, MatrixType > &  rhs)
inline

Definition at line 121 of file StandardMatrix.hpp.

123 {
124 m_data = rhs.m_data;
125 m_end = rhs.m_end;
126 m_curRow = rhs.m_curRow;
127 m_curColumn = rhs.m_curColumn;
128 m_matrix = rhs.m_matrix;
129 m_curIndex = rhs.m_curIndex;
130 m_transpose = rhs.m_transpose;
131 return *this;
132 }

◆ operator==()

template<typename DataType >
template<typename T , typename MatrixType >
bool Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::operator== ( const iterator_impl< T, MatrixType > &  rhs)
inline

Definition at line 196 of file StandardMatrix.hpp.

197 {
198 return m_data == rhs.m_data && m_end == rhs.m_end &&
199 m_curRow == rhs.m_curRow && m_curColumn == rhs.m_curColumn &&
200 m_matrix == rhs.m_matrix && m_curIndex == rhs.m_curIndex &&
201 m_transpose == rhs.m_transpose;
202 }

Member Data Documentation

◆ m_curColumn

template<typename DataType >
template<typename T , typename MatrixType >
unsigned int Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_curColumn
private

Definition at line 216 of file StandardMatrix.hpp.

◆ m_curIndex

template<typename DataType >
template<typename T , typename MatrixType >
unsigned int Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_curIndex
private

Definition at line 218 of file StandardMatrix.hpp.

◆ m_curRow

template<typename DataType >
template<typename T , typename MatrixType >
unsigned int Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_curRow
private

Definition at line 215 of file StandardMatrix.hpp.

◆ m_data

template<typename DataType >
template<typename T , typename MatrixType >
T* Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_data
private

Definition at line 211 of file StandardMatrix.hpp.

◆ m_end

template<typename DataType >
template<typename T , typename MatrixType >
T* Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_end
private

Definition at line 212 of file StandardMatrix.hpp.

◆ m_matrix

template<typename DataType >
template<typename T , typename MatrixType >
MatrixType* Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_matrix
private

Definition at line 217 of file StandardMatrix.hpp.

◆ m_transpose

template<typename DataType >
template<typename T , typename MatrixType >
char Nektar::NekMatrix< DataType, StandardMatrixTag >::iterator_impl< T, MatrixType >::m_transpose
private

Definition at line 219 of file StandardMatrix.hpp.