From 0c8c4794fc6f955b543bb01c089b4c1742ab9140 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 12 Jul 2004 13:58:26 +0000 Subject: [PATCH] Small modifications to accessors and iterators. git-svn-id: https://svn.dealii.org/trunk@9506 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/sparse_matrix.h | 53 +++++++++++++++++++++- deal.II/lac/include/lac/sparsity_pattern.h | 31 +++++++++---- 2 files changed, 74 insertions(+), 10 deletions(-) diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 991385d378..578f0253be 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -91,6 +91,11 @@ namespace internals const unsigned int row, const unsigned int index); + /** + * Constructor. Construct the end + * accessor for the given matrix. + */ + Accessor (MatrixType *matrix); /** * Copy constructor to get from a @@ -220,6 +225,12 @@ namespace internals const unsigned int row, const unsigned int index); + /** + * Constructor. Construct the end + * accessor for the given matrix. + */ + Accessor (MatrixType *matrix); + /** * Value of this matrix entry, * returned as a read- and writable @@ -297,6 +308,12 @@ namespace internals const unsigned int row, const unsigned int index); + /** + * Constructor. Create the end + * iterator for the given matrix. + */ + Iterator (MatrixType *matrix); + /** * Conversion constructor to get from * a non-const iterator to a const @@ -1892,6 +1909,17 @@ namespace internals + template + inline + Accessor:: + Accessor (const MatrixType *matrix) + : + SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()), + matrix (matrix) + {} + + + template inline Accessor:: @@ -2018,7 +2046,18 @@ namespace internals row, index), matrix (matrix) {} - + + + + template + inline + Accessor:: + Accessor (MatrixType *matrix) + : + SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()), + matrix (matrix) + {} + template @@ -2054,6 +2093,16 @@ namespace internals + template + inline + Iterator:: + Iterator (MatrixType *matrix) + : + accessor(matrix) + {} + + + template inline Iterator:: @@ -2162,7 +2211,7 @@ inline typename SparseMatrix::const_iterator SparseMatrix::end () const { - return const_iterator(this, m(), 0); + return const_iterator(this); } diff --git a/deal.II/lac/include/lac/sparsity_pattern.h b/deal.II/lac/include/lac/sparsity_pattern.h index 08dfd70ccd..419e5ffe85 100644 --- a/deal.II/lac/include/lac/sparsity_pattern.h +++ b/deal.II/lac/include/lac/sparsity_pattern.h @@ -63,23 +63,28 @@ namespace internals const unsigned int row, const unsigned int index); + /** + * Constructor. Construct the end + * accessor for the given sparsity + * pattern. + */ + Accessor (const SparsityPattern *matrix); + /** * Row number of the element - * represented by this - * object. This + * represented by this object. This * function can only be called for - * entries for which is_valid_entry() is - * true. + * entries for which is_valid_entry() + * is true. */ unsigned int row () const; /** * Index in row of the element - * represented by this - * object. This + * represented by this object. This * function can only be called for - * entries for which is_valid_entry() is - * true. + * entries for which is_valid_entry() + * is true. */ unsigned int index () const; @@ -1575,6 +1580,16 @@ namespace internals {} + inline + Accessor:: + Accessor (const SparsityPattern *sparsity_pattern) + : + sparsity_pattern(sparsity_pattern), + a_row(sparsity_pattern->n_rows()), + a_index(0) + {} + + inline unsigned int Accessor::row() const -- 2.39.5