From e7e83d9fc9c09207b9223170181dbab78eb03148 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 12 Dec 2012 12:21:11 +0000 Subject: [PATCH] Patch by Alexander Grayver: Release memort in SparseDirectMUMPS. git-svn-id: https://svn.dealii.org/trunk@27793 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/petsc_solver.h | 7 ++++++- deal.II/source/lac/petsc_solver.cc | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deal.II/include/deal.II/lac/petsc_solver.h b/deal.II/include/deal.II/lac/petsc_solver.h index 598bc31db5..ae38d634f0 100644 --- a/deal.II/include/deal.II/lac/petsc_solver.h +++ b/deal.II/include/deal.II/lac/petsc_solver.h @@ -1241,10 +1241,15 @@ namespace PETScWrappers * function in the base is not used * here, the private SolverData struct * located in the base could not be used - * either + * either. */ struct SolverDataMUMPS { + /** + * Destructor + */ + ~SolverDataMUMPS (); + KSP ksp; PC pc; }; diff --git a/deal.II/source/lac/petsc_solver.cc b/deal.II/source/lac/petsc_solver.cc index cdd889e836..caaa9ea4b9 100644 --- a/deal.II/source/lac/petsc_solver.cc +++ b/deal.II/source/lac/petsc_solver.cc @@ -594,6 +594,19 @@ namespace PETScWrappers /* ---------------------- SparseDirectMUMPS------------------------ */ + SparseDirectMUMPS::SolverDataMUMPS::~SolverDataMUMPS () + { + // destroy the solver object +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + int ierr = KSPDestroy (ksp); +#else + int ierr = KSPDestroy (&ksp); +#endif + + AssertThrow (ierr == 0, ExcPETScError(ierr)); + } + + SparseDirectMUMPS::SparseDirectMUMPS (SolverControl &cn, const MPI_Comm &mpi_communicator, const AdditionalData &data) -- 2.39.5