From: Matthias Maier Date: Thu, 13 Jul 2017 17:57:36 +0000 (-0500) Subject: Cleanup: Use LinearOperator instead of PointerMatrix X-Git-Tag: v9.0.0-rc1~1423^2~7 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=584c8af85f09ef7a23fc7e1dab215a307d8dc064;p=dealii.git Cleanup: Use LinearOperator instead of PointerMatrix --- diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 41d4afadd0..ea6d8981ac 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -18,8 +18,9 @@ #include -#include #include +#include +#include #include DEAL_II_NAMESPACE_OPEN @@ -143,14 +144,14 @@ private: SmartPointer > solver; /** - * Reference to the matrix. + * LinearOperator wrapping a reference to the matrix. */ - PointerMatrixBase *matrix; + LinearOperator matrix; /** - * Reference to the preconditioner. + * LinearOperator wrapping a reference to the preconditioner. */ - PointerMatrixBase *precondition; + LinearOperator precondition; } DEAL_II_DEPRECATED; @@ -375,8 +376,8 @@ MGCoarseGridLACIteration : solver(&s, typeid(*this).name()) { - matrix = new PointerMatrix(&m); - precondition = new PointerMatrix(&p); + matrix = linear_operator(m); + precondition = linear_operator(p); } @@ -399,10 +400,10 @@ MGCoarseGridLACIteration solver = &s; if (matrix) delete matrix; - matrix = new PointerMatrix(&m); + matrix = linear_operator(m); if (precondition) delete precondition; - precondition = new PointerMatrix(&p); + precondition = linear_operator(p); } @@ -412,12 +413,9 @@ MGCoarseGridLACIteration ::clear() { solver = nullptr; - if (matrix) - delete matrix; - matrix = nullptr; - if (precondition) - delete precondition; - precondition = nullptr; + matrix = LinearOperator(); + precondition = LinearOperator(); + } @@ -429,9 +427,7 @@ MGCoarseGridLACIteration const VectorType &src) const { Assert(solver!=nullptr, ExcNotInitialized()); - Assert(matrix!=nullptr, ExcNotInitialized()); - Assert(precondition!=nullptr, ExcNotInitialized()); - solver->solve(*matrix, dst, src, *precondition); + solver->solve(matrix, dst, src, precondition); } @@ -443,7 +439,7 @@ MGCoarseGridLACIteration { if (matrix) delete matrix; - matrix = new PointerMatrix(&m); + matrix = linear_operator(m); } DEAL_II_ENABLE_EXTRA_DIAGNOSTICS @@ -525,9 +521,7 @@ MGCoarseGridIterativeSolversolve(*matrix, dst, src, *preconditioner); + solver->solve(matrix, dst, src, preconditioner); }