]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix: BlockIndices in BlockDynamicSP 685/head
authorTimo Heister <timo.heister@gmail.com>
Mon, 23 Mar 2015 21:19:19 +0000 (17:19 -0400)
committerTimo Heister <timo.heister@gmail.com>
Mon, 23 Mar 2015 21:19:19 +0000 (17:19 -0400)
Implement constructor and reinit with BlockIndices for
BlockDynamicSparsityPattern. This existed for BlockCompressedSP but not
for BlockCompressedSimpleSP, but BlockCompressedSP is now a typedef to
BlockDynamicSP (see 3b9a4bc2).

This should fix the test integrators/cochain_01.cc

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

index c64d5a268479827daf47681249f63d19252adc18..d7fd972c18003e662ce328605168d2920c7fe7cb 100644 (file)
@@ -531,6 +531,14 @@ public:
    */
   BlockDynamicSparsityPattern (const std::vector<IndexSet> &partitioning);
 
+  /**
+   * Initialize the pattern with two BlockIndices for the block structures of
+   * matrix rows and columns.
+   */
+  BlockDynamicSparsityPattern (const BlockIndices &row_indices,
+                               const BlockIndices &col_indices);
+
+
   /**
    * Resize the pattern to a tensor product of matrices with dimensions
    * defined by the arguments.
@@ -548,6 +556,13 @@ public:
    */
   void reinit(const std::vector<IndexSet> &partitioning);
 
+  /**
+   * Resize the matrix to a tensor product of matrices with dimensions defined
+   * by the arguments. The two BlockIndices objects must be initialized and
+   * the sparsity pattern will have the same block structure afterwards.
+   */
+  void reinit (const BlockIndices &row_indices, const BlockIndices &col_indices);
+
   /**
    * Access to column number field. Return the column number of the @p index
    * th entry in row @p row.
index c177c2ecbee7fb0bc7f873844720ec6f785d4954..bfc8c5fd1d4dc8565aad3b3ae44e7d112a95b183 100644 (file)
@@ -482,6 +482,13 @@ BlockDynamicSparsityPattern (const std::vector<IndexSet> &partitioning)
 }
 
 
+BlockDynamicSparsityPattern::
+BlockDynamicSparsityPattern (const BlockIndices &row_indices,
+                             const BlockIndices &col_indices)
+{
+  reinit(row_indices, col_indices);
+}
+
 
 void
 BlockDynamicSparsityPattern::reinit (
@@ -510,6 +517,20 @@ BlockDynamicSparsityPattern::reinit (
   this->collect_sizes();
 }
 
+void
+BlockDynamicSparsityPattern::reinit (
+  const BlockIndices &row_indices,
+  const BlockIndices &col_indices)
+{
+  BlockSparsityPatternBase<DynamicSparsityPattern>::reinit(row_indices.size(),
+                                                           col_indices.size());
+  for (size_type i=0; i<row_indices.size(); ++i)
+    for (size_type j=0; j<col_indices.size(); ++j)
+      this->block(i,j).reinit(row_indices.block_size(i),
+                              col_indices.block_size(j));
+  this->collect_sizes();
+}
+
 
 #ifdef DEAL_II_WITH_TRILINOS
 namespace TrilinosWrappers

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.