]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix index bugs.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 5 May 2000 15:47:00 +0000 (15:47 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 5 May 2000 15:47:00 +0000 (15:47 +0000)
git-svn-id: https://svn.dealii.org/trunk@2806 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparsity_pattern.h

index e333e297c9cbada1a9dcd0871a496c0f25eb3c42..c70a3a50a81dba3854d42870fb0a81c5878e5b6a 100644 (file)
@@ -245,6 +245,15 @@ class BlockSparsityPattern : public Subscriptor
                                      * sub-objects.
                                      */
     BlockIndices<columns> column_indices;
+
+                                    /**
+                                     * Make the block sparse matrix a
+                                     * friend, so that it can use our
+                                     * #row_indices# and
+                                     * #column_indices# objects.
+                                     */
+    template <typename number, int r, int c>
+    friend class BlockSparseMatrix;
 };
 
 
@@ -344,7 +353,7 @@ void
 BlockSparsityPattern<rows,columns>::compress ()
 {
   for (unsigned int i=0; i<rows; ++i)
-    for (unsigned int j=0; j<rows; ++j)
+    for (unsigned int j=0; j<columns; ++j)
       sub_objects[i][j].compress ();
 };
 
@@ -355,7 +364,7 @@ bool
 BlockSparsityPattern<rows,columns>::empty () const
 {
   for (unsigned int i=0; i<rows; ++i)
-    for (unsigned int j=0; j<rows; ++j)
+    for (unsigned int j=0; j<columns; ++j)
       if (sub_objects[i][j].empty () == false)
        return false;
   return true;
@@ -436,7 +445,7 @@ BlockSparsityPattern<rows,columns>::n_nonzero_elements () const
 {
   unsigned int count = 0;
   for (unsigned int i=0; i<rows; ++i)
-    for (unsigned int j=0; j<rows; ++j)
+    for (unsigned int j=0; j<columns; ++j)
       count += sub_objects[i][j].n_nonzero_elements ();
   return count;
 };
@@ -448,7 +457,7 @@ bool
 BlockSparsityPattern<rows,columns>::is_compressed () const
 {
   for (unsigned int i=0; i<rows; ++i)
-    for (unsigned int j=0; j<rows; ++j)
+    for (unsigned int j=0; j<columns; ++j)
       if (sub_objects[i][j].is_compressed () == false)
        return false;
   return true;

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.