]> https://gitweb.dealii.org/ - dealii.git/commitdiff
port arpack/tep-36_parpack_trilinos to inverse_operator
authorMatthias Maier <tamiko@43-1.org>
Sun, 2 Jul 2017 17:37:19 +0000 (12:37 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 3 Jul 2017 10:15:14 +0000 (05:15 -0500)
tests/arpack/step-36_parpack_trilinos.cc

index 9ca48e597376232d257742ede91fe3b610b21861..47dce5574354d2994d1564c8a7305b91936a26c5 100644 (file)
@@ -38,7 +38,8 @@
 #include <deal.II/lac/sparsity_tools.h>
 #include <deal.II/lac/dynamic_sparsity_pattern.h>
 
-#include <deal.II/lac/iterative_inverse.h>
+#include <deal.II/lac/linear_operator.h>
+#include <deal.II/lac/solver_cg.h>
 
 #include <deal.II/lac/trilinos_sparse_matrix.h>
 #include <deal.II/lac/trilinos_precondition.h>
@@ -278,15 +279,20 @@ void test ()
     SolverControl solver_control     (dof_handler.n_dofs(), 1e-9,/*log_history*/false,/*log_results*/false);
     SolverControl solver_control_lin (dof_handler.n_dofs(), 1e-10,/*log_history*/false,/*log_results*/false);
 
-    PArpackSolver<TrilinosWrappers::MPI::Vector>::Shift<TrilinosWrappers::SparseMatrix> shifted_matrix(stiffness_matrix,mass_matrix,shift);
-    TrilinosWrappers::PreconditionIdentity preconditioner;
-    IterativeInverse<TrilinosWrappers::MPI::Vector > shift_and_invert;
-    shift_and_invert.initialize(shifted_matrix,preconditioner);
-    shift_and_invert.solver.select("cg");
     static ReductionControl inner_control_c(/*maxiter*/stiffness_matrix.m(),
                                                        /*tolerance (global)*/ 0.0,
                                                        /*reduce (w.r.t. initial)*/ 1.e-13);
-    shift_and_invert.solver.set_control(inner_control_c);
+
+    typedef TrilinosWrappers::MPI::Vector VectorType;
+    SolverCG<VectorType> solver_c(inner_control_c);
+    TrilinosWrappers::PreconditionIdentity preconditioner;
+
+    const auto shifted_matrix =
+      linear_operator<VectorType>(stiffness_matrix) -
+      shift * linear_operator<VectorType>(mass_matrix);
+
+    const auto shift_and_invert =
+      inverse_operator(shifted_matrix, solver_c, preconditioner);
 
     const unsigned int num_arnoldi_vectors = 2*eigenvalues.size() + 2;
 

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.