From 7f3d9fe09248fc775418b42456d59a869ec5c6a0 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 23 Mar 2015 17:19:19 -0400 Subject: [PATCH] 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 --- include/deal.II/lac/block_sparsity_pattern.h | 15 ++++++++++++++ source/lac/block_sparsity_pattern.cc | 21 ++++++++++++++++++++ 2 files changed, 36 insertions(+) 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 -- 2.39.5