]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
n_actually_nonzero_elements added to BlockSparseMatrix
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Jul 2002 10:35:33 +0000 (10:35 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 10 Jul 2002 10:35:33 +0000 (10:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@6243 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 4880083558ee7805ef7399a76fc32a4b64d0feb9..476f6245af676057492b188351ea4087582c751d 100644 (file)
@@ -249,6 +249,14 @@ class BlockSparseMatrix : public Subscriptor
                                      * be zero, it is counted anyway.
                                      */
     unsigned int n_nonzero_elements () const;
+
+                                    /**
+                                     * Return the number of actually
+                                     * nonzero elements. Just counts
+                                     * the number of actually nonzero
+                                     * elements of all the blocks.
+                                     */
+    unsigned int n_actually_nonzero_elements () const;
     
                                     /**
                                      * Set the element @p{(i,j)} to
index 886dad110a321bbc3be4b478fcebacd52bfb54e0..403ef71ea98698c0e169ddc8984c688dbc8ee8d9 100644 (file)
@@ -156,6 +156,19 @@ BlockSparseMatrix<number>::n_nonzero_elements () const
 
 
 
+template <typename number>
+unsigned int
+BlockSparseMatrix<number>::n_actually_nonzero_elements () const
+{
+  unsigned int count = 0;
+  for (unsigned int i=0; i<rows; ++i)
+    for (unsigned int j=0; j<columns; ++j)
+      count += sub_objects[i][j]->n_actually_nonzero_elements ();
+  return count;
+};
+
+
+
 template <typename number>
 const BlockSparsityPattern &
 BlockSparseMatrix<number>::get_sparsity_pattern () const

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.