Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::StorageSmvBsr< T >::const_iterator Class Reference

#include <StorageSmvBsr.hpp>

Collaboration diagram for Nektar::StorageSmvBsr< T >::const_iterator:
Collaboration graph
[legend]

Classes

struct  IterType

Public Member Functions

 const_iterator (MatrixStorage matType, IndexType begin, IndexType end, IndexType blkDim, const DataVectorType &val, const IndexVectorType &indx, const IndexVectorType &pntr)
 const_iterator (const const_iterator &src)
 ~const_iterator ()
const_iterator operator++ (int)
const_iteratoroperator++ ()
const IterTypeoperator* ()
const IterTypeoperator-> ()
const bool operator== (const const_iterator &rhs)
const bool operator!= (const const_iterator &rhs)

Private Member Functions

void forward ()
CoordType storageIndexToFullCoord (IndexType storageIndex)

Private Attributes

MatrixStorage m_matType
IterType m_iter
IndexType m_begin
IndexType m_end
IndexType m_blkDim
const DataVectorTypem_val
const IndexVectorTypem_indx
const IndexVectorTypem_pntr

Detailed Description

template<typename T>
class Nektar::StorageSmvBsr< T >::const_iterator

Definition at line 85 of file StorageSmvBsr.hpp.

Constructor & Destructor Documentation

template<typename DataType >
Nektar::StorageSmvBsr< DataType >::const_iterator::const_iterator ( MatrixStorage  matType,
IndexType  begin,
IndexType  end,
IndexType  blkDim,
const DataVectorType val,
const IndexVectorType indx,
const IndexVectorType pntr 
)

Definition at line 57 of file StorageSmvBsr.cpp.

References Nektar::StorageSmvBsr< T >::begin(), Nektar::StorageSmvBsr< T >::const_iterator::IterType::first, Nektar::NekConstants::kNekSparseNonZeroTol, Nektar::StorageSmvBsr< T >::const_iterator::m_iter, Nektar::StorageSmvBsr< T >::const_iterator::m_val, Nektar::StorageSmvBsr< T >::const_iterator::IterType::nnzindex, Nektar::Array< OneD, const DataType >::num_elements(), Nektar::StorageSmvBsr< T >::const_iterator::IterType::second, Nektar::StorageSmvBsr< T >::const_iterator::IterType::storageindex, and Nektar::StorageSmvBsr< T >::const_iterator::storageIndexToFullCoord().

:
m_matType(matType),
m_iter(),
m_blkDim(blkDim),
m_val(val),
m_indx(indx),
m_pntr(pntr)
{
// Here we rewind the iterator to the 'begin'-th
// nonzero double value. Consecutive nonzeros are
// to lie within dense block and when it's done,
// jump to the next dense block.
// NB: m_val stores some explicit zeros that need to be skept.
if (begin < end)
{
// determine offset of 'begin'-th nonzero value
{
// explicit zero?
{
}
{
std::cout << "const_iterator: 'begin' out stored values bounds" << std::endl;
throw 1;
}
}
m_iter.first.first = c.first;
m_iter.first.second = c.second;
}
}
template<typename DataType >
Nektar::StorageSmvBsr< DataType >::const_iterator::const_iterator ( const const_iterator src)

Definition at line 139 of file StorageSmvBsr.cpp.

:
m_matType(src.m_matType),
m_iter(src.m_iter),
m_begin(src.m_begin),
m_end(src.m_end),
m_val(src.m_val),
m_indx(src.m_indx),
m_pntr(src.m_pntr)
{
}
template<typename DataType >
Nektar::StorageSmvBsr< DataType >::const_iterator::~const_iterator ( )

Definition at line 151 of file StorageSmvBsr.cpp.

{
}

Member Function Documentation

template<typename DataType >
void Nektar::StorageSmvBsr< DataType >::const_iterator::forward ( )
private

Definition at line 195 of file StorageSmvBsr.cpp.

References Nektar::NekConstants::kNekSparseNonZeroTol, Nektar::StorageSmvBsr< T >::m_val, and Nektar::Array< OneD, const DataType >::num_elements().

template<typename DataType >
const bool Nektar::StorageSmvBsr< DataType >::const_iterator::operator!= ( const const_iterator rhs)

Definition at line 189 of file StorageSmvBsr.cpp.

References Nektar::StorageSmvBsr< T >::const_iterator::m_iter, and Nektar::StorageSmvBsr< T >::const_iterator::IterType::nnzindex.

{
return !(m_iter.nnzindex == rhs.m_iter.nnzindex);
}
template<typename DataType >
const StorageSmvBsr< DataType >::const_iterator::IterType & Nektar::StorageSmvBsr< DataType >::const_iterator::operator* ( )

Definition at line 171 of file StorageSmvBsr.cpp.

{
return m_iter;
}
template<typename DataType >
StorageSmvBsr< DataType >::const_iterator Nektar::StorageSmvBsr< DataType >::const_iterator::operator++ ( int  )

Definition at line 156 of file StorageSmvBsr.cpp.

{
const_iterator out = *this;
return out;
}
template<typename DataType >
StorageSmvBsr< DataType >::const_iterator & Nektar::StorageSmvBsr< DataType >::const_iterator::operator++ ( )

Definition at line 164 of file StorageSmvBsr.cpp.

{
return *this;
}
template<typename DataType >
const StorageSmvBsr< DataType >::const_iterator::IterType * Nektar::StorageSmvBsr< DataType >::const_iterator::operator-> ( )

Definition at line 177 of file StorageSmvBsr.cpp.

{
return &m_iter;
}
template<typename DataType >
const bool Nektar::StorageSmvBsr< DataType >::const_iterator::operator== ( const const_iterator rhs)

Definition at line 183 of file StorageSmvBsr.cpp.

References Nektar::StorageSmvBsr< T >::const_iterator::m_iter, and Nektar::StorageSmvBsr< T >::const_iterator::IterType::nnzindex.

{
return m_iter.nnzindex == rhs.m_iter.nnzindex;
}
template<typename DataType >
CoordType Nektar::StorageSmvBsr< DataType >::const_iterator::storageIndexToFullCoord ( IndexType  storageIndex)
private

Definition at line 110 of file StorageSmvBsr.cpp.

References Nektar::StorageSmvBsr< T >::m_blkDim, Nektar::StorageSmvBsr< T >::m_indx, and Nektar::StorageSmvBsr< T >::m_pntr.

Referenced by Nektar::StorageSmvBsr< T >::const_iterator::const_iterator().

{
// find local row and column indices within this block
const IndexType elms = m_blkDim*m_blkDim;
const IndexType block = storageIndex / elms;
const IndexType loc_offset = storageIndex % elms;
const IndexType loc_row = loc_offset % m_blkDim;
const IndexType loc_col = loc_offset / m_blkDim;
// find block row and block column
IndexType block_col = m_indx[block];
IndexType block_row = 0;
while(block >= m_pntr[block_row+1])
{
block_row++;
}
// full matrix coordinates of this nonzero entry
CoordType coord;
coord.first = block_row*m_blkDim + loc_row;
coord.second = block_col*m_blkDim + loc_col;
return coord;
}

Member Data Documentation

template<typename T >
IndexType Nektar::StorageSmvBsr< T >::const_iterator::m_begin
private

Definition at line 122 of file StorageSmvBsr.hpp.

template<typename T >
IndexType Nektar::StorageSmvBsr< T >::const_iterator::m_blkDim
private

Definition at line 124 of file StorageSmvBsr.hpp.

template<typename T >
IndexType Nektar::StorageSmvBsr< T >::const_iterator::m_end
private

Definition at line 123 of file StorageSmvBsr.hpp.

template<typename T >
const IndexVectorType& Nektar::StorageSmvBsr< T >::const_iterator::m_indx
private

Definition at line 126 of file StorageSmvBsr.hpp.

template<typename T >
IterType Nektar::StorageSmvBsr< T >::const_iterator::m_iter
private

Definition at line 121 of file StorageSmvBsr.hpp.

Referenced by Nektar::StorageSmvBsr< T >::const_iterator::const_iterator(), Nektar::StorageSmvBsr< T >::const_iterator::operator!=(), and Nektar::StorageSmvBsr< T >::const_iterator::operator==().

template<typename T >
MatrixStorage Nektar::StorageSmvBsr< T >::const_iterator::m_matType
private

Definition at line 120 of file StorageSmvBsr.hpp.

template<typename T >
const IndexVectorType& Nektar::StorageSmvBsr< T >::const_iterator::m_pntr
private

Definition at line 127 of file StorageSmvBsr.hpp.

template<typename T >
const DataVectorType& Nektar::StorageSmvBsr< T >::const_iterator::m_val
private

Definition at line 125 of file StorageSmvBsr.hpp.

Referenced by Nektar::StorageSmvBsr< T >::const_iterator::const_iterator().