]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid use of a deprecated function by introducing a private function with the same...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 31 Dec 2012 23:13:33 +0000 (23:13 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 31 Dec 2012 23:13:33 +0000 (23:13 +0000)
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

index 53f20caf259f000155536ee2890d764b1d791c8e..ddf4fde1fc457c7ca80e3d03d45f98f1e530b2e8 100644 (file)
@@ -1497,6 +1497,16 @@ private:
    */
   std::size_t max_len;
 
+  /**
+   * Return the value of the <tt>index</tt>th entry in <tt>row</tt>. Here,
+   * <tt>index</tt> 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 <typename somenumber> friend class SparseMatrix;
   template <typename somenumber> friend class SparseLUDecomposition;
@@ -1506,6 +1516,13 @@ private:
    * To allow it calling private prepare_add() and prepare_set().
    */
   template <typename> friend class BlockMatrixBase;
+
+  /**
+   * Also give access to internal details to the iterator/accessor
+   * classes.
+   */
+  template <typename,bool> friend class SparseMatrixIterators::Iterator;
+  template <typename,bool> friend class SparseMatrixIterators::Accessor;
 };
 
 /**
@@ -1812,6 +1829,20 @@ inline
 number
 SparseMatrix<number>::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 <typename number>
+inline
+number
+SparseMatrix<number>::nth_entry_in_row (const unsigned int row,
+                                       const unsigned int index) const
 {
   Assert(row<cols->rows, ExcIndexRange(row,0,cols->rows));
   Assert(index<cols->row_length(row),
@@ -1917,7 +1948,7 @@ namespace SparseMatrixIterators
   number
   Accessor<number, true>::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<number, false>::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);
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.