From: kanschat Date: Wed, 14 Feb 2007 00:31:09 +0000 (+0000) Subject: add another convenient reinit function X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5aaf5264842ad8aba0347d98bd8a137a85b44a9;p=dealii-svn.git add another convenient reinit function git-svn-id: https://svn.dealii.org/trunk@14471 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/block_sparsity_pattern.h b/deal.II/lac/include/lac/block_sparsity_pattern.h index b582e58c48..3f44fec7ae 100644 --- a/deal.II/lac/include/lac/block_sparsity_pattern.h +++ b/deal.II/lac/include/lac/block_sparsity_pattern.h @@ -152,7 +152,7 @@ class BlockSparsityPatternBase : public Subscriptor */ void reinit (const unsigned int n_block_rows, const unsigned int n_block_columns); - + /** * Copy operator. For this the * same holds as for the copy @@ -534,7 +534,7 @@ class BlockSparsityPattern : public BlockSparsityPatternBase * * @until copy * - * @author Wolfgang Bangerth, 2000, 2001, example by Guido Kanschat, 2006 + * @author Wolfgang Bangerth, 2000, 2001, Guido Kanschat, 2006, 2007 */ class CompressedBlockSparsityPattern : public BlockSparsityPatternBase { @@ -577,6 +577,30 @@ class CompressedBlockSparsityPattern : public BlockSparsityPatternBase& row_block_sizes, const std::vector& col_block_sizes); + /** + * Resize the matrix to a tensor + * product of matrices with + * dimensions defined by the + * arguments. + * + * The matrix will have as many + * block rows and columns as + * there are entries in the two + * arguments. The block at + * position (i,j) will + * have the dimensions + * row_block_sizes[i] + * times col_block_sizes[j]. + */ + void reinit (const std::vector< unsigned int > &row_block_sizes, + const std::vector< unsigned int > &col_block_sizes); + + /** + * Allow the use of the reinit + * functions of the base class as + * well. + */ + BlockSparsityPatternBase::reinit; }; diff --git a/deal.II/lac/source/block_sparsity_pattern.cc b/deal.II/lac/source/block_sparsity_pattern.cc index 7ce640d011..68fec80527 100644 --- a/deal.II/lac/source/block_sparsity_pattern.cc +++ b/deal.II/lac/source/block_sparsity_pattern.cc @@ -97,7 +97,6 @@ reinit (const unsigned int n_block_rows, } - template BlockSparsityPatternBase & BlockSparsityPatternBase:: @@ -401,6 +400,21 @@ CompressedBlockSparsityPattern (const std::vector& row_indices, } +void +CompressedBlockSparsityPattern::reinit ( + const std::vector< unsigned int > &row_block_sizes, + const std::vector< unsigned int > &col_block_sizes) +{ + this->reinit(row_block_sizes.size(), col_block_sizes.size()); + for (unsigned int i=0;iblock(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); + this->collect_sizes(); +} + + + + // Remark: The explicit instantiations for "BlockSparsityPatternBase" were moved // to the top of this source file. The reason is a slightly buggy version // of the Apple gcc v.3.3.