]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add simplified reinit with row length vector
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Sep 2010 17:07:58 +0000 (17:07 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Sep 2010 17:07:58 +0000 (17:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@22195 0785d39b-7218-0410-832d-ea1e28bc413d

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

index b5a32f7e93ffb07bee0d98df3e36c3d0f7c1c299..29fbdb146c2676c1cd0b21a5a25d307bddcc7633 100644 (file)
@@ -73,6 +73,9 @@ namespace TrilinosWrappers
  * You will in general not want to use this class, but one of the
  * derived classes.
  *
+ * @todo Handle opitmization of diagonal elements of the underlying
+ * SparsityPattern correctly.
+ *
  * @see @ref GlossBlockLA "Block (linear algebra)"
  * @author Wolfgang Bangerth, 2000, 2001
  */
@@ -514,8 +517,22 @@ class BlockSparsityPattern : public BlockSparsityPatternBase<SparsityPattern>
                                      * two BlockIndices for the block
                                      * structures of matrix rows and
                                      * columns as well as a row
-                                     * length vector in the format
-                                     * produced by DoFTools.
+                                     * length vector.
+                                     *
+                                     * The row length vector should
+                                     * be in the format produced by
+                                     * DoFTools. Alternatively, there
+                                     * is a simplified version,
+                                     * where each of the inner
+                                     * vectors has length one. Then,
+                                     * the corresponding entry is
+                                     * used as the maximal row length.
+                                     *
+                                     * For the diagonal blocks, the
+                                     * inner SparsityPattern is
+                                     * initialized with optimized
+                                     * diagonals, while this is not
+                                     * done for the off-diagonal blocks. 
                                      */
     void reinit (const BlockIndices& row_indices,
                 const BlockIndices& col_indices,
index 1d3840245fe6f599f0d8307cf0ddf00e797a34a3..50e3c59605aca57cb74abfc88e38f72298b20b2a 100644 (file)
@@ -343,11 +343,17 @@ BlockSparsityPattern::reinit(
        const unsigned int start = rows.local_to_global(i, 0);
        const unsigned int length = rows.block_size(i);
 
-       VectorSlice<const std::vector<unsigned int> >
-         block_rows(row_lengths[j], start, length);
-       block(i,j).reinit(rows.block_size(i),
-                         cols.block_size(j),
-                         block_rows);
+       if (row_lengths[j].size()==1)
+         block(i,j).reinit(rows.block_size(i),
+                           cols.block_size(j), row_lengths[j][0], i==j);
+       else
+         {
+           VectorSlice<const std::vector<unsigned int> >
+             block_rows(row_lengths[j], start, length);
+           block(i,j).reinit(rows.block_size(i),
+                             cols.block_size(j),
+                             block_rows);
+         }
       }
   this->collect_sizes();
   Assert (this->row_indices == rows, ExcInternalError());

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.