From ece333134650608ee5ec4c3f77161f19a4c66099 Mon Sep 17 00:00:00 2001
From: young <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Tue, 4 Dec 2012 13:37:15 +0000
Subject: [PATCH] Give SLEPc the MPI_InitFinalize interface like what PETSc
 has.

git-svn-id: https://svn.dealii.org/trunk@27753 0785d39b-7218-0410-832d-ea1e28bc413d
---
 deal.II/source/base/mpi.cc | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/deal.II/source/base/mpi.cc b/deal.II/source/base/mpi.cc
index 0ed894db31..15917ddfb9 100644
--- a/deal.II/source/base/mpi.cc
+++ b/deal.II/source/base/mpi.cc
@@ -38,6 +38,11 @@
 #  endif
 #endif
 
+#ifdef DEAL_II_USE_SLEPC
+#  ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+#    include <slepcsys.h>
+#  endif
+#endif
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -316,7 +321,13 @@ namespace Utilities
       // if we have PETSc, we will initialize it and let it handle MPI.
       // Otherwise, we will do it.
 #ifdef DEAL_II_USE_PETSC
+#  ifdef DEAL_II_USE_SLEPC
+      // Initialise SLEPc (with PETSc):
+      SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+#  else
+      // or just initialise PETSc alone:
       PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+#  endif
 #else
       int MPI_has_been_started = 0;
       MPI_Initialized(&MPI_has_been_started);
@@ -367,8 +378,13 @@ namespace Utilities
       GrowingVectorMemory<PETScWrappers::BlockVector>
       ::release_unused_memory ();
 
-      // now end PETSc.
+#  ifdef DEAL_II_USE_SLEPC
+      // and now end SLEPc (with PETSc)
+      SlepcFinalize();
+#  else
+      // or just end PETSc.
       PetscFinalize();
+#  endif
 #else
 
 
-- 
2.39.5