]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add new n_actually_nonzero_elements() function even here.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 21 Apr 2009 09:24:10 +0000 (09:24 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 21 Apr 2009 09:24:10 +0000 (09:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@18672 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparse_matrix.h
deal.II/lac/include/lac/block_sparse_matrix.templates.h

index 08806e30b43bc689d438a684e97ea3c0d1ed3562..ff20e5b0b3fb0f10f8befb35a134a267a8e6e7ef 100644 (file)
@@ -204,11 +204,12 @@ class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix<number> >
 
                                     /**
                                      * 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:
index a22eeec2c02208d1f2971f4c24065365badd7f62..6d5d06b14e1cb49e57b206dead359bee1c0c7baa 100644 (file)
@@ -157,12 +157,12 @@ BlockSparseMatrix<number>::n_nonzero_elements () const
 
 template <typename number>
 unsigned int
-BlockSparseMatrix<number>::n_actually_nonzero_elements () const
+BlockSparseMatrix<number>::n_actually_nonzero_elements (const double threshold) const
 {
   unsigned int count = 0;
   for (unsigned int i=0; i<this->n_block_rows(); ++i)
     for (unsigned int j=0; j<this->n_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;
 }

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.