]> https://gitweb.dealii.org/ - dealii.git/commitdiff
made target eigenvalue a shared pointer 229/head
authorDenis Davydov <davydden@gmail.com>
Wed, 26 Nov 2014 09:05:57 +0000 (10:05 +0100)
committerDenis Davydov <davydden@gmail.com>
Wed, 26 Nov 2014 09:05:57 +0000 (10:05 +0100)
include/deal.II/lac/slepc_solver.h
source/lac/slepc_solver.cc

index 8510e125041a66086cffa29667f74ebce0d766ca..c84c4cdb53b8494d21020d8d0ebe2f44dcaa3b70 100644 (file)
@@ -341,7 +341,7 @@ namespace SLEPcWrappers
     /**
      * Target eigenvalue to solve for.
      */
-    PetscScalar target_eigenvalue;
+    std_cxx11::shared_ptr<PetscScalar> target_eigenvalue;
 
     /**
      * Which portion of the spectrum to solve from.
index 7db3f88d2ec5994d324258652654c1a4286ef2d2..4539d5a6adf12028ed66d95ec870b6031923aa31 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.