From 1b2fd6744a2fbe53080dba31d035fc7b3d5469ba Mon Sep 17 00:00:00 2001
From: Wolfgang Bangerth <bangerth@math.tamu.edu>
Date: Thu, 12 Feb 2015 10:40:24 -0600
Subject: [PATCH] Remove deprecated functions
 SparsityPattern::get_rowstart_indices and
 SparsityPattern::get_column_numbers.

These functions have also been deprecated for more than a decade as they leak the storage format of SparsityPattern to the outside.
---
 doc/news/changes.h                            |  2 +
 include/deal.II/lac/sparsity_pattern.h        | 57 +------------------
 tests/bits/dof_tools_01a.cc                   |  6 +-
 tests/bits/dof_tools_01a_constraints_false.cc |  6 +-
 tests/bits/dof_tools_01a_constraints_true.cc  |  6 +-
 tests/bits/dof_tools_01a_subdomain.cc         |  6 +-
 tests/bits/dof_tools_02a.cc                   |  6 +-
 tests/bits/dof_tools_02a_constraints_false.cc |  6 +-
 tests/bits/dof_tools_02a_constraints_true.cc  |  6 +-
 tests/bits/dof_tools_02a_subdomain.cc         |  6 +-
 tests/bits/dof_tools_15a.cc                   |  6 +-
 tests/bits/dof_tools_16a.cc                   |  6 +-
 tests/bits/dof_tools_17a.cc                   |  6 +-
 tests/bits/dof_tools_18a.cc                   |  6 +-
 tests/bits/dof_tools_18a_1d.cc                |  6 +-
 tests/lac/sparsity_pattern.cc                 | 29 +++-------
 16 files changed, 38 insertions(+), 128 deletions(-)

diff --git a/doc/news/changes.h b/doc/news/changes.h
index b449e56bd7..b4c7022516 100644
--- a/doc/news/changes.h
+++ b/doc/news/changes.h
@@ -171,6 +171,8 @@ inconvenience this causes.
   - SparsityPattern and ChunkSparsityPattern functions that take an
     <code>optimize_diagonal</code> argument.
   - SparsityPattern::partition.
+  - SparsityPattern::get_rowstart_indices and
+    SparsityPattern::get_column_numbers.
   - The typedef CompressedBlockSparsityPattern.
   - The deprecated constructors of SparsityPattern iterator classes.
   - The deprecated variants of DoFTools::make_periodicity_constraints.
diff --git a/include/deal.II/lac/sparsity_pattern.h b/include/deal.II/lac/sparsity_pattern.h
index d213d71945..1f5f31ae97 100644
--- a/include/deal.II/lac/sparsity_pattern.h
+++ b/include/deal.II/lac/sparsity_pattern.h
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2000 - 2014 by the deal.II authors
+// Copyright (C) 2000 - 2015 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -986,45 +986,6 @@ public:
    */
   row_iterator row_end (const size_type r) const DEAL_II_DEPRECATED;
 
-  /**
-   * @deprecated This is kind of an expert mode. Get access to the rowstart
-   * array, but read-only.
-   *
-   * Use of this function is highly deprecated. Use @p row_length and @p
-   * column_number instead. Also, using iterators may get you most of the
-   * information you may want.
-   *
-   * Though the return value is declared <tt>const</tt>, you should be aware
-   * that it may change if you call any nonconstant function of objects which
-   * operate on it.
-   *
-   * You should use this interface very carefully and only if you are
-   * absolutely sure to know what you do. You should also note that the
-   * structure of these arrays may change over time.  If you change the layout
-   * yourself, you should also rename this function to avoid programs relying
-   * on outdated information!
-   */
-  const std::size_t *get_rowstart_indices () const DEAL_II_DEPRECATED;
-
-  /**
-   * @deprecated. Use @p row_length and @p column_number instead. Also, using
-   * iterators may get you most of the information you may want.
-   *
-   * This is kind of an expert mode: get access to the colnums array, but
-   * readonly.
-   *
-   * Though the return value is declared <tt>const</tt>, you should be aware
-   * that it may change if you call any nonconstant function of objects which
-   * operate on it.
-   *
-   * You should use this interface very carefully and only if you are
-   * absolutely sure to know what you do. You should also note that the
-   * structure of these arrays may change over time. If you change the layout
-   * yourself, you should also rename this function to avoid programs relying
-   * on outdated information!
-   */
-  const size_type *get_column_numbers () const DEAL_II_DEPRECATED;
-
 // @}
 
   BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -1462,22 +1423,6 @@ SparsityPattern::stores_only_added_elements () const
 }
 
 
-inline
-const std::size_t *
-SparsityPattern::get_rowstart_indices () const
-{
-  return rowstart;
-}
-
-
-inline
-const SparsityPattern::size_type *
-SparsityPattern::get_column_numbers () const
-{
-  return colnums;
-}
-
-
 
 inline
 unsigned int
diff --git a/tests/bits/dof_tools_01a.cc b/tests/bits/dof_tools_01a.cc
index 33caec77b8..26a8959834 100644
--- a/tests/bits/dof_tools_01a.cc
+++ b/tests/bits/dof_tools_01a.cc
@@ -57,9 +57,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_01a_constraints_false.cc b/tests/bits/dof_tools_01a_constraints_false.cc
index 445cf83bee..e331488fd7 100644
--- a/tests/bits/dof_tools_01a_constraints_false.cc
+++ b/tests/bits/dof_tools_01a_constraints_false.cc
@@ -63,9 +63,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_01a_constraints_true.cc b/tests/bits/dof_tools_01a_constraints_true.cc
index 42f4229512..49775e2672 100644
--- a/tests/bits/dof_tools_01a_constraints_true.cc
+++ b/tests/bits/dof_tools_01a_constraints_true.cc
@@ -63,9 +63,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_01a_subdomain.cc b/tests/bits/dof_tools_01a_subdomain.cc
index 202608a3f7..8598c37564 100644
--- a/tests/bits/dof_tools_01a_subdomain.cc
+++ b/tests/bits/dof_tools_01a_subdomain.cc
@@ -64,9 +64,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_02a.cc b/tests/bits/dof_tools_02a.cc
index d4ca5da944..cd5ccf09b8 100644
--- a/tests/bits/dof_tools_02a.cc
+++ b/tests/bits/dof_tools_02a.cc
@@ -67,9 +67,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_02a_constraints_false.cc b/tests/bits/dof_tools_02a_constraints_false.cc
index fa3b229cb1..a6373d1bc6 100644
--- a/tests/bits/dof_tools_02a_constraints_false.cc
+++ b/tests/bits/dof_tools_02a_constraints_false.cc
@@ -73,9 +73,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_02a_constraints_true.cc b/tests/bits/dof_tools_02a_constraints_true.cc
index ae1758a266..463662484c 100644
--- a/tests/bits/dof_tools_02a_constraints_true.cc
+++ b/tests/bits/dof_tools_02a_constraints_true.cc
@@ -73,9 +73,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_02a_subdomain.cc b/tests/bits/dof_tools_02a_subdomain.cc
index 4f218b5c9d..a944c0e663 100644
--- a/tests/bits/dof_tools_02a_subdomain.cc
+++ b/tests/bits/dof_tools_02a_subdomain.cc
@@ -75,9 +75,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_15a.cc b/tests/bits/dof_tools_15a.cc
index ffd9d85050..e2dea1e61a 100644
--- a/tests/bits/dof_tools_15a.cc
+++ b/tests/bits/dof_tools_15a.cc
@@ -66,9 +66,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_16a.cc b/tests/bits/dof_tools_16a.cc
index 9ede31b698..ee4259091f 100644
--- a/tests/bits/dof_tools_16a.cc
+++ b/tests/bits/dof_tools_16a.cc
@@ -72,9 +72,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_17a.cc b/tests/bits/dof_tools_17a.cc
index 09ba7c8dfa..92a3774270 100644
--- a/tests/bits/dof_tools_17a.cc
+++ b/tests/bits/dof_tools_17a.cc
@@ -57,9 +57,7 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
diff --git a/tests/bits/dof_tools_18a.cc b/tests/bits/dof_tools_18a.cc
index 19cd178e0e..986a72bcef 100644
--- a/tests/bits/dof_tools_18a.cc
+++ b/tests/bits/dof_tools_18a.cc
@@ -83,10 +83,8 @@ my_check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
 
diff --git a/tests/bits/dof_tools_18a_1d.cc b/tests/bits/dof_tools_18a_1d.cc
index b9cbae5afa..b6e79894bc 100644
--- a/tests/bits/dof_tools_18a_1d.cc
+++ b/tests/bits/dof_tools_18a_1d.cc
@@ -84,10 +84,8 @@ check_this (const DoFHandler<dim> &dof_handler)
   unsigned int hash = 0;
   for (unsigned int l=0; l<sp.n_rows(); ++l)
     hash += l*(sp.row_length(l) +
-               sp.get_rowstart_indices()[l] +
-               sp.get_column_numbers()[sp.get_rowstart_indices()[l]
-                                       +
-                                       (sp.row_length(l)>1 ? 1 : 0)]);
+               (sp.begin(l)-sp.begin()) +
+               (sp.row_length(l)>1 ? ++sp.begin(l) : sp.begin(l))->column());
   deallog << hash << std::endl;
 }
 
diff --git a/tests/lac/sparsity_pattern.cc b/tests/lac/sparsity_pattern.cc
index b657a0ef21..2f365245a6 100644
--- a/tests/lac/sparsity_pattern.cc
+++ b/tests/lac/sparsity_pattern.cc
@@ -86,9 +86,8 @@ main ()
   for (unsigned int row=0; row<sp3.n_rows(); ++row)
     {
       sparsity.push_back (std::set<unsigned int,std::greater<unsigned int> >());
-      for (const types::global_dof_index *p=sp3.get_column_numbers()+sp3.get_rowstart_indices()[row];
-           p != sp3.get_column_numbers()+sp3.get_rowstart_indices()[row+1]; ++p)
-        sparsity.back().insert (*p);
+      for (SparsityPattern::const_iterator p=sp3.begin(row); p!=sp3.end(row); ++p)
+        sparsity.back().insert (p->column());
     };
   SparsityPattern sp4;
   sp4.copy_from ((N-1)*(N-1), (N-1)*(N-1),
@@ -97,14 +96,9 @@ main ()
   // now check for equivalence of sp3 and sp4
   for (unsigned int row=0; row<sp3.n_rows(); ++row)
     {
-      const types::global_dof_index
-      *sp3_p=sp3.get_column_numbers()+sp3.get_rowstart_indices()[row];
-      const types::global_dof_index
-      *sp4_p=sp4.get_column_numbers()+sp4.get_rowstart_indices()[row];
-      for (; sp3_p != (sp3.get_column_numbers() +
-                       sp3.get_rowstart_indices()[row+1]);
-           ++sp3_p, ++sp4_p)
-        Assert (*sp3_p == *sp4_p, ExcInternalError());
+      SparsityPattern::const_iterator p3=sp3.begin(row), p4=sp4.begin(row);
+      for (; p3!=sp3.end(row); ++p3, ++p4)
+        Assert (p3->column() == p4->column(), ExcInternalError());
     };
 
 
@@ -159,15 +153,10 @@ main ()
 
   for (unsigned int row=0; row<sp3.n_rows(); ++row)
     {
-      const types::global_dof_index
-      *sp3_p=sp3.get_column_numbers()+sp3.get_rowstart_indices()[row];
-      const types::global_dof_index
-      *sp5_p=sp5.get_column_numbers()+sp5.get_rowstart_indices()[row];
-      for (; sp3_p != (sp3.get_column_numbers() +
-                       sp3.get_rowstart_indices()[row+1]);
-           ++sp3_p, ++sp5_p)
-        Assert (*sp3_p == *sp5_p, ExcInternalError());
-    };
+      SparsityPattern::const_iterator p3=sp3.begin(row), p5=sp5.begin(row);
+      for (; p3!=sp3.end(row); ++p3, ++p5)
+        Assert (p3->column() == p5->column(), ExcInternalError());
+    }
 }
 
 
-- 
2.39.5