From 1ee525e0803abde4754fbde94116f018e3600389 Mon Sep 17 00:00:00 2001 From: guido Date: Wed, 9 Jun 2004 17:53:36 +0000 Subject: [PATCH] function clear fixed git-svn-id: https://svn.dealii.org/trunk@9415 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_matrix_base.h | 35 +++++++++++-------- deal.II/lac/include/lac/block_sparse_matrix.h | 14 ++++++++ .../lac/block_sparse_matrix.templates.h | 11 ++++++ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/deal.II/lac/include/lac/block_matrix_base.h b/deal.II/lac/include/lac/block_matrix_base.h index c83ae4b6c1..6346271572 100644 --- a/deal.II/lac/include/lac/block_matrix_base.h +++ b/deal.II/lac/include/lac/block_matrix_base.h @@ -326,20 +326,6 @@ class BlockMatrixBase : public Subscriptor BlockMatrixBase & copy_from (const BlockMatrixType &source); - /** - * Release all memory and return - * to a state just like after - * having called the default - * constructor. It also forgets - * the sparsity pattern it was - * previously tied to. - * - * This calls SparseMatrix::clear on all - * sub-matrices and then resets this - * object to have no blocks at all. - */ - void clear (); - /** * Access the block with the * given coordinates. @@ -700,6 +686,27 @@ class BlockMatrixBase : public Subscriptor << arg3 << ',' << arg4 << "] have differing column numbers."); protected: + /** + * Release all memory and return + * to a state just like after + * having called the default + * constructor. It also forgets + * the sparsity pattern it was + * previously tied to. + * + * This calls clear for all + * sub-matrices and then resets this + * object to have no blocks at all. + * + * This function is protected + * since it may be necessary to + * release additional structures. + * A derived class can make it + * public again, if it is + * sufficient. + */ + void clear (); + /** * Index arrays for rows and columns. */ diff --git a/deal.II/lac/include/lac/block_sparse_matrix.h b/deal.II/lac/include/lac/block_sparse_matrix.h index 9b834ce760..f32d54a7ef 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.h @@ -145,6 +145,20 @@ class BlockSparseMatrix : public BlockMatrixBase > BlockSparseMatrix & operator = (const double d); + + /** + * Release all memory and return + * to a state just like after + * having called the default + * constructor. It also forgets + * the sparsity pattern it was + * previously tied to. + * + * This calls SparseMatrix::clear on all + * sub-matrices and then resets this + * object to have no blocks at all. + */ + void clear (); /** * Reinitialize the sparse matrix * with the given sparsity diff --git a/deal.II/lac/include/lac/block_sparse_matrix.templates.h b/deal.II/lac/include/lac/block_sparse_matrix.templates.h index f602d1aff7..ae4dab373f 100644 --- a/deal.II/lac/include/lac/block_sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/block_sparse_matrix.templates.h @@ -95,6 +95,17 @@ BlockSparseMatrix::operator = (const double d) +template +inline +void +BlockSparseMatrix::clear () +{ + BlockMatrixBase >::clear(); + sparsity_pattern = 0; +} + + + template void BlockSparseMatrix:: -- 2.39.5