From: Guido Kanschat Date: Tue, 6 Jul 2010 17:55:58 +0000 (+0000) Subject: add reinit function X-Git-Tag: v8.0.0~5849 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a2213139cfba0b7b9917313f30f08bdc89542e9;p=dealii.git add reinit function git-svn-id: https://svn.dealii.org/trunk@21457 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/matrix_block.h b/deal.II/lac/include/lac/matrix_block.h index c3752db5b2..ce414d21e9 100644 --- a/deal.II/lac/include/lac/matrix_block.h +++ b/deal.II/lac/include/lac/matrix_block.h @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include @@ -352,16 +354,28 @@ class MatrixBlockVector : public NamedDatai. */ const MatrixBlock& block(unsigned int i) const; + /** * Access a reference to * the block at position i. */ MatrixBlock& block(unsigned int i); + /** * Access the matrix at position * i for read and write @@ -389,21 +403,31 @@ class MGMatrixBlockVector : public NamedData(row,column) - * in the block system. + * in the block system. The third + * argument allows to give the + * matrix a name for later + * identification. + * + * @deprecated The final + * argument is ignored and will + * be removed in a future release. */ void add(unsigned int row, unsigned int column, const std::string& name, - const BlockIndices* block_indices); + const BlockIndices* block_indices = 0); + /** * Access a constant reference to * the block at position i. */ const MatrixBlock& block(unsigned int i) const; + /** * Access a reference to * the block at position i. */ MatrixBlock& block(unsigned int i); + /** * Access the matrix at position * i for read and write @@ -417,6 +441,25 @@ class MGMatrixBlockVector : public NamedData + void + reinit(MatrixBlockVector& v, const BlockSparsityPattern& p) + { + Assert(false, ExcNotImplemented()); + } + + template + void + reinit(MatrixBlockVector >& v, const BlockSparsityPattern& p) + { + for (unsigned int i=0;imatrix.reinit(p.block(v(i)->row, v(i)->column)); + } + +} + template inline MatrixBlock::MatrixBlock() @@ -616,6 +659,15 @@ MatrixBlockVector::add( } +template +inline void +MatrixBlockVector::reinit(const BlockSparsityPattern& sparsity) +{ + internal::reinit(*this, sparsity); +} + + + template inline const MatrixBlock& MatrixBlockVector::block(unsigned int i) const