From: Denis Davydov Date: Wed, 26 Nov 2014 09:05:57 +0000 (+0100) Subject: made target eigenvalue a shared pointer X-Git-Tag: v8.2.0-rc1~35^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F229%2Fhead;p=dealii.git made target eigenvalue a shared pointer --- diff --git a/include/deal.II/lac/slepc_solver.h b/include/deal.II/lac/slepc_solver.h index 8510e12504..c84c4cdb53 100644 --- a/include/deal.II/lac/slepc_solver.h +++ b/include/deal.II/lac/slepc_solver.h @@ -341,7 +341,7 @@ namespace SLEPcWrappers /** * Target eigenvalue to solve for. */ - PetscScalar target_eigenvalue; + std_cxx11::shared_ptr target_eigenvalue; /** * Which portion of the spectrum to solve from. diff --git a/source/lac/slepc_solver.cc b/source/lac/slepc_solver.cc index 7db3f88d2e..4539d5a6ad 100644 --- a/source/lac/slepc_solver.cc +++ b/source/lac/slepc_solver.cc @@ -49,7 +49,7 @@ namespace SLEPcWrappers : solver_control (cn), mpi_communicator (mpi_communicator), - target_eigenvalue (0.), + target_eigenvalue (NULL), set_which (EPS_LARGEST_MAGNITUDE), set_problem (EPS_GNHEP), opA (NULL), @@ -93,7 +93,7 @@ namespace SLEPcWrappers void SolverBase::set_target_eigenvalue (const PetscScalar &this_target) { - target_eigenvalue = this_target; + target_eigenvalue.reset (new PetscScalar(this_target)); } void @@ -159,10 +159,16 @@ namespace SLEPcWrappers if (transformation) { // set transformation type if any + // STSetShift is called inside transformation->set_context (solver_data->eps); + } - // set target eigenvalues to solve for - ierr = EPSSetTarget (solver_data->eps, target_eigenvalue); + // set target eigenvalues to solve for + // in all transformation except STSHIFT there is a direct connection between + // the target and the shift, read more on p41 of SLEPc manual. + if (target_eigenvalue.get() != 0) + { + int ierr = EPSSetTarget (solver_data->eps, *(target_eigenvalue.get()) ); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } @@ -181,8 +187,8 @@ namespace SLEPcWrappers // TODO breaks step-36 // force solvers to use true residual - EPSSetTrueResidual(solver_data->eps, PETSC_TRUE); - AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + //EPSSetTrueResidual(solver_data->eps, PETSC_TRUE); + //AssertThrow (ierr == 0, ExcSLEPcError(ierr)); // Set convergence test to be absolute ierr = EPSSetConvergenceTest (solver_data->eps, EPS_CONV_ABS);