From c138203cf214d0d4e6691eed7d9b76d6da542166 Mon Sep 17 00:00:00 2001 From: hartmann Date: Tue, 17 Dec 2002 11:06:49 +0000 Subject: [PATCH] New set_matrix function. Add exception. git-svn-id: https://svn.dealii.org/trunk@6836 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/multigrid/mg_coarse.h | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_coarse.h b/deal.II/deal.II/include/multigrid/mg_coarse.h index c922b1e229..0e28452000 100644 --- a/deal.II/deal.II/include/multigrid/mg_coarse.h +++ b/deal.II/deal.II/include/multigrid/mg_coarse.h @@ -26,7 +26,7 @@ * should be derived from @p{Subscriptor} to allow for the use of a * smart pointer to it. * - * @author Guido Kanschat, 1999 + * @author Guido Kanschat, 1999, Ralf Hartmann, 2002. */ template > class MGCoarseGridLACIteration : public MGCoarseGrid @@ -52,6 +52,21 @@ class MGCoarseGridLACIteration : public MGCoarseGrid void operator() (const unsigned int level, VECTOR &dst, const VECTOR &src) const; + + /** + * Sets the matrix. This gives + * the possibility to replace the + * matrix that was given to the + * constructor by a new matrix. + */ + void set_matrix (const MATRIX &); + + /** + * Exception. + */ + DeclException0 (ExcNoMatrixGiven); + + private: /** * Reference to the solver. @@ -61,7 +76,7 @@ class MGCoarseGridLACIteration : public MGCoarseGrid /** * Reference to the matrix. */ - const SmartPointer matrix; + SmartPointer matrix; /** * Reference to the preconditioner. @@ -92,9 +107,18 @@ MGCoarseGridLACIteration VECTOR &dst, const VECTOR &src) const { + Assert(matrix!=0, ExcNoMatrixGiven()); solver.solve(*matrix, dst, src, precondition); } +template +void +MGCoarseGridLACIteration +::set_matrix(const MATRIX &m) +{ + matrix=&m; +} + #endif -- 2.39.5