26 template <
class Level>
28 const std::shared_ptr<prec_t>& prec_p)
32 , problem_mp( Teuchos::rcp( new
problem_t() ) )
42 template <
class Level>
44 const Teuchos::RCP<mv_t>& b)
53 problem_mp->setProblem(x, b);
55 solver_mp->setProblem(problem_mp);
57 Belos::ReturnType ret = solver_mp->solve();
59 if ( ret != Belos::Converged ) {
60 *
gmsg <<
"Warning: Bottom solver not converged. Achieved tolerance"
61 <<
" after " << solver_mp->getNumIters() <<
" iterations is "
62 << solver_mp->achievedTol() <<
"." <<
endl;
70 template <
class Level>
75 A_mp = Teuchos::rcp(
new matrix_t(*A, Teuchos::Copy));
80 if ( problem_mp == Teuchos::null )
82 "No problem defined.");
84 problem_mp->setOperator(A_mp);
88 if ( prec_mp !=
nullptr ) {
90 prec_mp->create(A_mp, level_p);
92 problem_mp->setLeftPrec(prec_mp->get());
95 this->isInitialized_m =
true;
99 template <
class Level>
101 if ( solver_mp == Teuchos::null )
103 "No solver initialized.");
105 return solver_mp->getNumIters();
109 template <
class Level>
112 Belos::SolverFactory<scalar_t, mv_t, op_t> factory;
114 params_mp = Teuchos::parameterList();
116 params_mp->set(
"Block Size", 1);
117 params_mp->set(
"Convergence Tolerance", reltol_m);
118 params_mp->set(
"Adaptive Block Size",
false);
119 params_mp->set(
"Use Single Reduction",
true);
120 params_mp->set(
"Explicit Residual Scaling",
"Norm of RHS");
121 params_mp->set(
"Maximum Iterations", maxiter_m);
122 params_mp->set(
"Verbosity", Belos::Errors + Belos::Warnings);
123 params_mp->set(
"Output Frequency", 1);
125 solver_mp = factory.create(solvertype, params_mp);
Inform & endl(Inform &inf)
Some AMR types used a lot.
Tpetra::MultiVector< scalar_t, local_ordinal_t, global_ordinal_t, node_t > multivector_t
Tpetra::CrsMatrix< scalar_t, local_ordinal_t, global_ordinal_t, node_t > matrix_t
void initSolver_m(std::string solvertype)
Belos::LinearProblem< scalar_t, mv_t, op_t > problem_t
void solve(const Teuchos::RCP< mv_t > &x, const Teuchos::RCP< mv_t > &b)
BelosBottomSolver(std::string solvertype="Pseudoblock CG", const std::shared_ptr< prec_t > &prec_p=nullptr)
void setOperator(const Teuchos::RCP< matrix_t > &A, Level *level_p=nullptr)
std::size_t getNumIters()
The base class for all OPAL exceptions.
Timing::TimerRef TimerRef
static TimerRef getTimer(const char *nm)
static void stopTimer(TimerRef t)
static void startTimer(TimerRef t)