From c8bfed8dd0bd5840cec27465169e3add9bf6787d Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 4 May 1999 11:46:45 +0000 Subject: [PATCH] Implement a way to get the actual maximum number of elements per row from the sparsity pattern. git-svn-id: https://svn.dealii.org/trunk@1261 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/sparse_matrix.h | 11 ++++++++++- deal.II/lac/source/sparse_matrix.cc | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index 3c215ec5c0..23507bc94c 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -174,7 +174,16 @@ class SparseMatrixStruct : public Subscriptor * dimensions are zero. */ bool empty () const; - + + /** + * Return the maximum number of entries per + * row. Before compression, this equals the + * number given to the constructor, while + * after compression, it equals the maximum + * number of entries actually allocated by + * the user. + */ + unsigned int max_entries_per_row () const; /** * Return the index of the matrix diff --git a/deal.II/lac/source/sparse_matrix.cc b/deal.II/lac/source/sparse_matrix.cc index ca35ddb28f..4df57c18c7 100644 --- a/deal.II/lac/source/sparse_matrix.cc +++ b/deal.II/lac/source/sparse_matrix.cc @@ -321,6 +321,18 @@ SparseMatrixStruct::empty () const { +unsigned int +SparseMatrixStruct::max_entries_per_row () const +{ + unsigned int m = 0; + for (unsigned int i=1; i