/**
* Accessor class for iterators
*/
- template <typename number>
+ template <class BlockMatrix>
class Accessor
{
public:
* Typedef the value type of the
* matrix we point into.
*/
- typedef
- typename BlockSparseMatrix<number>::value_type
- value_type;
+ typedef typename BlockMatrix::value_type value_type;
/**
* Constructor. Since we use
* access, a const matrix
* pointer is sufficient.
*/
- Accessor (const BlockSparseMatrix<number> *m,
- const unsigned int row,
- const unsigned int index);
+ Accessor (const BlockMatrix *m,
+ const unsigned int row,
+ const unsigned int index);
/**
* Row number of the element
/**
* The matrix accessed.
*/
- const BlockSparseMatrix<number>* matrix;
+ const BlockMatrix * matrix;
/**
* Iterator of the underlying matrix
* class.
*/
- typename
- BlockSparseMatrix<number>::BlockType::const_iterator
- base_iterator;
+ typename BlockMatrix::BlockType::const_iterator base_iterator;
/**
* Number of block where row lies in.
/**
* STL conforming iterator.
*/
- template <typename number>
- class ConstIterator : private Accessor<number>
+ template <class BlockMatrix>
+ class ConstIterator : private Accessor<BlockMatrix>
{
public:
/**
* Constructor.
*/
- ConstIterator(const BlockSparseMatrix<number>*,
- const unsigned int row,
- const unsigned int index);
+ ConstIterator(const BlockMatrix *matrix,
+ const unsigned int row,
+ const unsigned int index);
/**
* Prefix increment.
/**
* Dereferencing operator.
*/
- const Accessor<number> & operator* () const;
+ const Accessor<BlockMatrix> & operator* () const;
/**
* Dereferencing operator.
*/
- const Accessor<number> * operator-> () const;
+ const Accessor<BlockMatrix> * operator-> () const;
/**
* Comparison. True, if
typedef typename BlockType::value_type value_type;
typedef value_type *pointer;
typedef const value_type *const_pointer;
- typedef internal::BlockMatrixIterators::ConstIterator<number> iterator;
- typedef internal::BlockMatrixIterators::ConstIterator<number> const_iterator;
typedef value_type &reference;
typedef const value_type &const_reference;
typedef size_t size_type;
+ typedef
+ internal::BlockMatrixIterators::ConstIterator<BlockSparseMatrix>
+ iterator;
+
+ typedef
+ internal::BlockMatrixIterators::ConstIterator<BlockSparseMatrix>
+ const_iterator;
+
+
/**
* Constructor; initializes the
* matrix to be empty, without
const unsigned int j,
const number value);
+ /**
+ * Add <tt>value</tt> to the element
+ * <tt>(i,j)</tt>. Throws an error if
+ * the entry does not
+ * exist. Still, it is allowed to
+ * store zero values in
+ * non-existent fields.
+ */
+ void add (const unsigned int i,
+ const unsigned int j,
+ const number value);
+
/**
* Multiply the entire matrix by a
* fixed factor.
*/
BlockSparseMatrix & operator /= (const number factor);
- /**
- * Add <tt>value</tt> to the element
- * <tt>(i,j)</tt>. Throws an error if
- * the entry does not
- * exist. Still, it is allowed to
- * store zero values in
- * non-existent fields.
- */
- void add (const unsigned int i, const unsigned int j,
- const number value);
-
/**
* Copy the given matrix to this
* one. The operation throws an
template <typename>
friend class internal::BlockMatrixIterators::ConstIterator;
#else
- typedef internal::BlockMatrixIterators::Accessor<number> Accessor;
+ typedef internal::BlockMatrixIterators::Accessor<BlockSparseMatrix> Accessor;
friend class Accessor;
friend class const_iterator;
{
namespace BlockMatrixIterators
{
- template <typename number>
+ template <class BlockMatrix>
inline
- Accessor<number>::
- Accessor (const BlockSparseMatrix<number> *matrix,
- const unsigned int r,
- const unsigned int i)
+ Accessor<BlockMatrix>::
+ Accessor (const BlockMatrix *matrix,
+ const unsigned int r,
+ const unsigned int i)
:
matrix(matrix),
base_iterator(matrix->block(0,0).begin()),
}
- template <typename number>
+ template <class BlockMatrix>
inline
unsigned int
- Accessor<number>::row() const
+ Accessor<BlockMatrix>::row() const
{
return row_start + base_iterator->row();
}
- template <typename number>
+ template <class BlockMatrix>
inline
unsigned int
- Accessor<number>::index() const
+ Accessor<BlockMatrix>::index() const
{
return a_index;
}
- template <typename number>
+ template <class BlockMatrix>
inline
unsigned int
- Accessor<number>::column() const
+ Accessor<BlockMatrix>::column() const
{
return col_start + base_iterator->column();
}
- template <typename number>
+ template <class BlockMatrix>
inline
unsigned int
- Accessor<number>::block_row() const
+ Accessor<BlockMatrix>::block_row() const
{
return row_block;
}
- template <typename number>
+ template <class BlockMatrix>
inline
unsigned int
- Accessor<number>::block_column() const
+ Accessor<BlockMatrix>::block_column() const
{
return col_block;
}
- template <typename number>
+ template <class BlockMatrix>
inline
- typename Accessor<number>::value_type
- Accessor<number>::value () const
+ typename Accessor<BlockMatrix>::value_type
+ Accessor<BlockMatrix>::value () const
{
return base_iterator->value();
}
//----------------------------------------------------------------------//
- template <typename number>
+ template <class BlockMatrix>
inline
- ConstIterator<number>::
- ConstIterator (const BlockSparseMatrix<number>* m,
+ ConstIterator<BlockMatrix>::
+ ConstIterator (const BlockMatrix *m,
const unsigned int r,
const unsigned int i)
:
- Accessor<number>(m, r, i)
+ Accessor<BlockMatrix>(m, r, i)
{}
- template <typename number>
+ template <class BlockMatrix>
inline
- ConstIterator<number> &
- ConstIterator<number>::operator++ ()
+ ConstIterator<BlockMatrix> &
+ ConstIterator<BlockMatrix>::operator++ ()
{
Assert (this->row_block<this->matrix->n_block_rows(), ExcIteratorPastEnd());
-// template <typename number>
+// template <class BlockMatrix>
// inline
// const_iterator&
// ConstIterator::operator++ (int)
- template <typename number>
+ template <class BlockMatrix>
inline
- const Accessor<number> &
- ConstIterator<number>::operator* () const
+ const Accessor<BlockMatrix> &
+ ConstIterator<BlockMatrix>::operator* () const
{
return *this;
}
- template <typename number>
+ template <class BlockMatrix>
inline
- const Accessor<number> *
- ConstIterator<number>::operator-> () const
+ const Accessor<BlockMatrix> *
+ ConstIterator<BlockMatrix>::operator-> () const
{
return this;
}
- template <typename number>
+ template <class BlockMatrix>
inline
bool
- ConstIterator<number>::
+ ConstIterator<BlockMatrix>::
operator == (const ConstIterator& i) const
{
if (this->matrix != i->matrix)
- template <typename number>
+ template <class BlockMatrix>
inline
bool
- ConstIterator<number>::
+ ConstIterator<BlockMatrix>::
operator != (const ConstIterator& i) const
{
return !(*this == i);
- template <typename number>
+ template <class BlockMatrix>
inline
bool
- ConstIterator<number>::
+ ConstIterator<BlockMatrix>::
operator < (const ConstIterator& i) const
{
if (this->row_block < i->row_block)