From 6ea6bc96757ce152217e50b0f601c8afd5fb89ac Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 31 Dec 2012 23:13:33 +0000 Subject: [PATCH] Avoid use of a deprecated function by introducing a private function with the same functionality and giving only select classes access to it. git-svn-id: https://svn.dealii.org/branches/branch_deprecated@27889 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/sparse_matrix.h | 37 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/deal.II/include/deal.II/lac/sparse_matrix.h b/deal.II/include/deal.II/lac/sparse_matrix.h index 53f20caf25..ddf4fde1fc 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.h @@ -1497,6 +1497,16 @@ private: */ std::size_t max_len; + /** + * Return the value of the indexth entry in row. Here, + * index refers to the internal representation of the matrix, not + * the column. This is an internal function because it exposes the actual + * format in which data is stored -- be sure to understand what you are + * doing here. + */ + number nth_entry_in_row (const unsigned int row, + const unsigned int index) const; + // make all other sparse matrices friends template friend class SparseMatrix; template friend class SparseLUDecomposition; @@ -1506,6 +1516,13 @@ private: * To allow it calling private prepare_add() and prepare_set(). */ template friend class BlockMatrixBase; + + /** + * Also give access to internal details to the iterator/accessor + * classes. + */ + template friend class SparseMatrixIterators::Iterator; + template friend class SparseMatrixIterators::Accessor; }; /** @@ -1812,6 +1829,20 @@ inline number SparseMatrix::raw_entry (const unsigned int row, const unsigned int index) const +{ + // this is the (deprecated) public version of the + // nth_entry_in_row() function. this function will soon + // go away. + return nth_entry_in_row (row, index); +} + + + +template +inline +number +SparseMatrix::nth_entry_in_row (const unsigned int row, + const unsigned int index) const { Assert(rowrows, ExcIndexRange(row,0,cols->rows)); Assert(indexrow_length(row), @@ -1917,7 +1948,7 @@ namespace SparseMatrixIterators number Accessor::value () const { - return matrix->raw_entry(a_row, a_index); + return matrix->nth_entry_in_row(a_row, a_index); } @@ -1946,8 +1977,8 @@ namespace SparseMatrixIterators inline Accessor::Reference::operator number() const { - return accessor->matrix->raw_entry(accessor->a_row, - accessor->a_index); + return accessor->matrix->nth_entry_in_row(accessor->a_row, + accessor->a_index); } -- 2.39.5