From c59daeecc96694d988ba8c239f51a21553c8ead1 Mon Sep 17 00:00:00 2001 From: young Date: Fri, 22 Mar 2013 15:52:10 +0000 Subject: [PATCH] Function to instruct SLEPc to exploit symmetry operations. git-svn-id: https://svn.dealii.org/trunk@28990 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/slepc_solver.h | 27 ++++++++++++++++++++-- deal.II/source/lac/slepc_solver.cc | 7 ++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/deal.II/include/deal.II/lac/slepc_solver.h b/deal.II/include/deal.II/lac/slepc_solver.h index 865296a36b..1f95532381 100644 --- a/deal.II/include/deal.II/lac/slepc_solver.h +++ b/deal.II/include/deal.II/lac/slepc_solver.h @@ -187,12 +187,24 @@ namespace SLEPcWrappers /** * Indicate which part of the spectrum is to be computed. By - * default largest magnitude eigenvalues are computed. For other - * allowed values see the SLEPc documentation. + * default largest magnitude eigenvalues are computed. + * + * @note For other allowed values see the SLEPc documentation. */ void set_which_eigenpairs (EPSWhich set_which); + /** + * Specify the type of the eigenspectrum problem. This can be used + * to exploit known symmetries of the matrices that make up the + * standard/generalized eigenspectrum problem. By default a + * non-Hermitian problem is assumed. + * + * @note For other allowed values see the SLEPc documentation. + */ + void + set_problem_type (EPSProblemType set_problem); + /** * Solve the linear system for n_eigenvectors * eigenstates. Parameter n_converged contains the @@ -286,6 +298,11 @@ namespace SLEPcWrappers */ EPSWhich set_which; + /** + * Set the eigenspectrum problem type. + */ + EPSProblemType set_problem; + /** * The matrix $A$ of the generalized eigenvalue problem * $Ax=B\lambda x$, or the standard eigenvalue problem $Ax=\lambda @@ -639,6 +656,9 @@ namespace SLEPcWrappers std::vector &vr, const unsigned int n_eigenvectors = 1) { + // Panic if no eigenpairs are wanted. + AssertThrow (n_eigenvectors != 0, ExcSLEPcWrappersUsageError()); + unsigned int n_converged = 0; // Set the matrices of the problem @@ -668,6 +688,9 @@ namespace SLEPcWrappers std::vector &vr, const unsigned int n_eigenvectors = 1) { + // Panic if no eigenpairs are wanted. + AssertThrow (n_eigenvectors != 0, ExcSLEPcWrappersUsageError()); + unsigned int n_converged = 0; // Set the matrices of the problem diff --git a/deal.II/source/lac/slepc_solver.cc b/deal.II/source/lac/slepc_solver.cc index ac453b8d0d..a7bdf48670 100644 --- a/deal.II/source/lac/slepc_solver.cc +++ b/deal.II/source/lac/slepc_solver.cc @@ -50,6 +50,7 @@ namespace SLEPcWrappers solver_control (cn), mpi_communicator (mpi_communicator), set_which (EPS_LARGEST_MAGNITUDE), + set_problem (EPS_NHEP), opA (NULL), opB (NULL), initial_vector (NULL), @@ -94,6 +95,12 @@ namespace SLEPcWrappers set_which = eps_which; } + void + SolverBase::set_problem_type (const EPSProblemType eps_problem) + { + set_problem = eps_problem; + } + void SolverBase::solve (const unsigned int n_eigenvectors, unsigned int *n_converged) -- 2.39.5