From 59ef23f0fd3b331c76d480c9ce54ea2998817117 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Tue, 21 Apr 2009 09:24:10 +0000 Subject: [PATCH] Add new n_actually_nonzero_elements() function even here. git-svn-id: https://svn.dealii.org/trunk@18672 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_sparse_matrix.h | 9 +++++---- deal.II/lac/include/lac/block_sparse_matrix.templates.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index 08806e30b4..ff20e5b0b3 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -204,11 +204,12 @@ class BlockSparseMatrix : public BlockMatrixBase > /** * Return the number of actually - * nonzero elements. Just counts - * the number of actually nonzero - * elements of all the blocks. + * nonzero elements. Just counts the + * number of actually nonzero elements + * (with absolute value larger than + * threshold) of all the blocks. */ - unsigned int n_actually_nonzero_elements () const; + unsigned int n_actually_nonzero_elements (const double threshold = 0.0) const; /** * Matrix-vector multiplication: diff --git a/deal.II/lac/include/lac/block_sparse_matrix.templates.h b/deal.II/lac/include/lac/block_sparse_matrix.templates.h index a22eeec2c0..6d5d06b14e 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.templates.h @@ -157,12 +157,12 @@ BlockSparseMatrix::n_nonzero_elements () const template unsigned int -BlockSparseMatrix::n_actually_nonzero_elements () const +BlockSparseMatrix::n_actually_nonzero_elements (const double threshold) const { unsigned int count = 0; for (unsigned int i=0; in_block_rows(); ++i) for (unsigned int j=0; jn_block_cols(); ++j) - count += this->sub_objects[i][j]->n_actually_nonzero_elements (); + count += this->sub_objects[i][j]->n_actually_nonzero_elements (threshold); return count; } -- 2.39.5