From: Timo Heister Date: Mon, 23 Mar 2015 21:19:19 +0000 (-0400) Subject: Fix: BlockIndices in BlockDynamicSP X-Git-Tag: v8.3.0-rc1~362^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F685%2Fhead;p=dealii.git Fix: BlockIndices in BlockDynamicSP 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 --- diff --git a/include/deal.II/lac/block_sparsity_pattern.h b/include/deal.II/lac/block_sparsity_pattern.h index c64d5a2684..d7fd972c18 100644 --- a/include/deal.II/lac/block_sparsity_pattern.h +++ b/include/deal.II/lac/block_sparsity_pattern.h @@ -531,6 +531,14 @@ public: */ BlockDynamicSparsityPattern (const std::vector &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 &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. diff --git a/source/lac/block_sparsity_pattern.cc b/source/lac/block_sparsity_pattern.cc index c177c2ecbe..bfc8c5fd1d 100644 --- a/source/lac/block_sparsity_pattern.cc +++ b/source/lac/block_sparsity_pattern.cc @@ -482,6 +482,13 @@ BlockDynamicSparsityPattern (const std::vector &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::reinit(row_indices.size(), + col_indices.size()); + for (size_type i=0; iblock(i,j).reinit(row_indices.block_size(i), + col_indices.block_size(j)); + this->collect_sizes(); +} + #ifdef DEAL_II_WITH_TRILINOS namespace TrilinosWrappers