Belos Version of the Day
BelosGmresPolySolMgr.hpp
Go to the documentation of this file.
1//@HEADER
2// ************************************************************************
3//
4// Belos: Block Linear Solvers Package
5// Copyright 2004 Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ************************************************************************
40//@HEADER
41//
42
43#ifndef BELOS_GMRES_POLY_SOLMGR_HPP
44#define BELOS_GMRES_POLY_SOLMGR_HPP
45
49
50#include "BelosConfigDefs.hpp"
51#include "BelosTypes.hpp"
52
55#include "BelosGmresPolyOp.hpp"
58#include "Teuchos_as.hpp"
59#ifdef BELOS_TEUCHOS_TIME_MONITOR
60#include "Teuchos_TimeMonitor.hpp"
61#endif
62
63
64namespace Belos {
65
67
68
76 GmresPolySolMgrLinearProblemFailure(const std::string& what_arg) : BelosError(what_arg)
77 {}};
78
86 GmresPolySolMgrPolynomialFailure(const std::string& what_arg) : BelosError(what_arg)
87 {}};
88
103//
138//
150
151template<class ScalarType, class MV, class OP>
152class GmresPolySolMgr : public SolverManager<ScalarType,MV,OP> {
153private:
154
156 typedef Teuchos::ScalarTraits<ScalarType> STS;
157 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
160
161public:
162
164
165
172
191 GmresPolySolMgr( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
192 const Teuchos::RCP<Teuchos::ParameterList> &pl );
193
195 virtual ~GmresPolySolMgr() {};
196
198 Teuchos::RCP<SolverManager<ScalarType, MV, OP> > clone () const override {
199 return Teuchos::rcp(new GmresPolySolMgr<ScalarType,MV,OP>);
200 }
202
204
205
209 return *problem_;
210 }
211
214 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const override;
215
218 Teuchos::RCP<const Teuchos::ParameterList> getCurrentParameters() const override { return params_; }
219
225 Teuchos::Array<Teuchos::RCP<Teuchos::Time> > getTimers() const {
226 return Teuchos::tuple(timerPoly_);
227 }
228
230 int getNumIters() const override {
231 return numIters_;
232 }
233
237 bool isLOADetected() const override { return loaDetected_; }
238
240
242
243
245 void setProblem( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem ) override { problem_ = problem; }
246
248 void setParameters( const Teuchos::RCP<Teuchos::ParameterList> &params ) override;
249
251
253
262 void reset( const ResetType type ) override {
263 if ((type & Belos::Problem) && ! problem_.is_null ()) {
264 problem_->setProblem ();
265 poly_Op_ = Teuchos::null;
266 poly_dim_ = 0; // Rebuild the GMRES polynomial
267 }
268 }
269
271
273
291 ReturnType solve() override;
292
294
297
299 std::string description() const override;
300
302
303private:
304
305 // Linear problem.
306 Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > problem_;
307
308 // Output manager.
309 Teuchos::RCP<std::ostream> outputStream_;
310
311 // Current parameter list.
312 Teuchos::RCP<Teuchos::ParameterList> params_;
313 Teuchos::RCP<Teuchos::ParameterList> outerParams_;
314
315 // Default solver values.
316 static constexpr int maxDegree_default_ = 25;
317 static constexpr int verbosity_default_ = Belos::Errors;
318 static constexpr const char * label_default_ = "Belos";
319 static constexpr const char * outerSolverType_default_ = "";
320 static constexpr const char * polyType_default_ = "Arnoldi";
321 static constexpr const char * orthoType_default_ = "ICGS";
322 static constexpr bool addRoots_default_ = true;
323 static constexpr bool dampPoly_default_ = false;
324 static constexpr bool randomRHS_default_ = true;
325// https://stackoverflow.com/questions/24398102/constexpr-and-initialization-of-a-static-const-void-pointer-with-reinterpret-cas
326#if defined(_WIN32) && defined(__clang__)
327 static constexpr std::ostream * outputStream_default_ =
328 __builtin_constant_p(reinterpret_cast<const std::ostream*>(&std::cout));
329#else
330 static constexpr std::ostream * outputStream_default_ = &std::cout;
331#endif
332
333 // Current solver values.
334 MagnitudeType polyTol_;
335 int maxDegree_, numIters_;
336 int verbosity_;
337 bool hasOuterSolver_;
338 bool randomRHS_;
339 bool damp_;
340 bool addRoots_;
341 std::string polyType_;
342 std::string outerSolverType_;
343 std::string orthoType_;
344
345 // Polynomial storage
346 int poly_dim_;
347 Teuchos::RCP<gmres_poly_t> poly_Op_;
348
349 // Timers.
350 std::string label_;
351 Teuchos::RCP<Teuchos::Time> timerPoly_;
352
353 // Internal state variables.
354 bool isSet_;
355 bool loaDetected_;
356
358 mutable Teuchos::RCP<const Teuchos::ParameterList> validPL_;
359};
360
361
362template<class ScalarType, class MV, class OP>
364 outputStream_ (Teuchos::rcp(outputStream_default_,false)),
365 polyTol_ (DefaultSolverParameters::polyTol),
366 maxDegree_ (maxDegree_default_),
367 numIters_ (0),
368 verbosity_ (verbosity_default_),
369 hasOuterSolver_ (false),
370 randomRHS_ (randomRHS_default_),
371 damp_ (dampPoly_default_),
372 addRoots_ (addRoots_default_),
373 polyType_ (polyType_default_),
374 outerSolverType_ (outerSolverType_default_),
375 orthoType_ (orthoType_default_),
376 poly_dim_ (0),
377 label_ (label_default_),
378 isSet_ (false),
379 loaDetected_ (false)
380{}
381
382
383template<class ScalarType, class MV, class OP>
385GmresPolySolMgr (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
386 const Teuchos::RCP<Teuchos::ParameterList> &pl) :
387 problem_ (problem),
388 outputStream_ (Teuchos::rcp(outputStream_default_,false)),
389 polyTol_ (DefaultSolverParameters::polyTol),
390 maxDegree_ (maxDegree_default_),
391 numIters_ (0),
392 verbosity_ (verbosity_default_),
393 hasOuterSolver_ (false),
394 randomRHS_ (randomRHS_default_),
395 damp_ (dampPoly_default_),
396 addRoots_ (addRoots_default_),
397 polyType_ (polyType_default_),
398 outerSolverType_ (outerSolverType_default_),
399 orthoType_ (orthoType_default_),
400 poly_dim_ (0),
401 label_ (label_default_),
402 isSet_ (false),
403 loaDetected_ (false)
404{
405 TEUCHOS_TEST_FOR_EXCEPTION(
406 problem_.is_null (), std::invalid_argument,
407 "Belos::GmresPolySolMgr: The given linear problem is null. "
408 "Please call this constructor with a nonnull LinearProblem argument, "
409 "or call the constructor that does not take a LinearProblem.");
410
411 // If the input parameter list is null, then the parameters take
412 // default values.
413 if (! pl.is_null ()) {
414 setParameters (pl);
415 }
416}
417
418
419template<class ScalarType, class MV, class OP>
420Teuchos::RCP<const Teuchos::ParameterList>
422{
423 if (validPL_.is_null ()) {
424 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList ();
425
426 // The static_cast is to resolve an issue with older clang versions which
427 // would cause the constexpr to link fail. With c++17 the problem is resolved.
428 pl->set("Polynomial Type", static_cast<const char *>(polyType_default_),
429 "The type of GMRES polynomial that is used as a preconditioner: Roots, Arnoldi, or Gmres.");
430 pl->set("Polynomial Tolerance", static_cast<MagnitudeType>(DefaultSolverParameters::polyTol),
431 "The relative residual tolerance that used to construct the GMRES polynomial.");
432 pl->set("Maximum Degree", static_cast<int>(maxDegree_default_),
433 "The maximum degree allowed for any GMRES polynomial.");
434 pl->set("Outer Solver", static_cast<const char *>(outerSolverType_default_),
435 "The outer solver that this polynomial is used to precondition.");
436 pl->set("Verbosity", static_cast<int>(verbosity_default_),
437 "What type(s) of solver information should be outputted\n"
438 "to the output stream.");
439 pl->set("Output Stream", Teuchos::rcp(outputStream_default_,false),
440 "A reference-counted pointer to the output stream where all\n"
441 "solver output is sent.");
442 pl->set("Timer Label", static_cast<const char *>(label_default_),
443 "The string to use as a prefix for the timer labels.");
444 pl->set("Orthogonalization", static_cast<const char *>(orthoType_default_),
445 "The type of orthogonalization to use to generate polynomial: DGKS, ICGS, or IMGS.");
446 pl->set("Random RHS", static_cast<bool>(randomRHS_default_),
447 "Add roots to polynomial for stability.");
448 pl->set("Add Roots", static_cast<bool>(addRoots_default_),
449 "Add roots to polynomial for stability.");
450 pl->set("Damp Poly", static_cast<bool>(dampPoly_default_),
451 "Damp polynomial for ill-conditioned problems.");
452 validPL_ = pl;
453 }
454 return validPL_;
455}
456
457
458template<class ScalarType, class MV, class OP>
460setParameters (const Teuchos::RCP<Teuchos::ParameterList>& params)
461{
462 // Create the internal parameter list if ones doesn't already exist.
463 if (params_.is_null ()) {
464 params_ = Teuchos::parameterList (*getValidParameters ());
465 }
466 else {
467 params->validateParameters (*getValidParameters ());
468 }
469
470 // Check which Gmres polynomial to use
471 if (params->isParameter("Polynomial Type")) {
472 polyType_ = params->get("Polynomial Type", polyType_default_);
473 }
474
475 // Update the outer solver in our list.
476 params_->set("Polynomial Type", polyType_);
477
478 // Check if there is an outer solver for this Gmres Polynomial
479 if (params->isParameter("Outer Solver")) {
480 outerSolverType_ = params->get("Outer Solver", outerSolverType_default_);
481 }
482
483 // Update the outer solver in our list.
484 params_->set("Outer Solver", outerSolverType_);
485
486 // Check if there is a parameter list for the outer solver
487 if (params->isSublist("Outer Solver Params")) {
488 outerParams_ = Teuchos::parameterList( params->get<Teuchos::ParameterList>("Outer Solver Params") );
489 }
490
491 // Check for maximum polynomial degree
492 if (params->isParameter("Maximum Degree")) {
493 maxDegree_ = params->get("Maximum Degree",maxDegree_default_);
494 }
495
496 // Update parameter in our list.
497 params_->set("Maximum Degree", maxDegree_);
498
499 // Check to see if the timer label changed.
500 if (params->isParameter("Timer Label")) {
501 std::string tempLabel = params->get("Timer Label", label_default_);
502
503 // Update parameter in our list and solver timer
504 if (tempLabel != label_) {
505 label_ = tempLabel;
506#ifdef BELOS_TEUCHOS_TIME_MONITOR
507 std::string polyLabel = label_ + ": GmresPolyOp creation time";
508 timerPoly_ = Teuchos::TimeMonitor::getNewCounter(polyLabel);
509#endif
510 }
511 }
512
513 // Update timer label
514 params_->set("Timer Label", label_);
515
516 // Check if the orthogonalization changed.
517 if (params->isParameter("Orthogonalization")) {
518 std::string tempOrthoType = params->get("Orthogonalization",orthoType_default_);
520 // Ensure that the specified orthogonalization type is valid.
521 if (! factory.isValidName (tempOrthoType)) {
522 std::ostringstream os;
523 os << "Belos::GCRODRSolMgr: Invalid orthogonalization name \""
524 << tempOrthoType << "\". The following are valid options "
525 << "for the \"Orthogonalization\" name parameter: ";
526 factory.printValidNames (os);
527 throw std::invalid_argument (os.str());
528 }
529 if (tempOrthoType != orthoType_) {
530 orthoType_ = tempOrthoType;
531 }
532 }
533
534 params_->set("Orthogonalization", orthoType_);
535
536 // Check for a change in verbosity level
537 if (params->isParameter("Verbosity")) {
538 if (Teuchos::isParameterType<int>(*params,"Verbosity")) {
539 verbosity_ = params->get("Verbosity", verbosity_default_);
540 } else {
541 verbosity_ = (int)Teuchos::getParameter<Belos::MsgType>(*params,"Verbosity");
542 }
543 }
544
545 // Update parameter in our list.
546 params_->set("Verbosity", verbosity_);
547
548 // output stream
549 if (params->isParameter("Output Stream")) {
550 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*params,"Output Stream");
551 }
552
553 // Update parameter in our list.
554 params_->set("Output Stream", outputStream_);
555
556 // Convergence
557 // Check for polynomial convergence tolerance
558 if (params->isParameter("Polynomial Tolerance")) {
559 if (params->isType<MagnitudeType> ("Polynomial Tolerance")) {
560 polyTol_ = params->get ("Polynomial Tolerance",
561 static_cast<MagnitudeType> (DefaultSolverParameters::polyTol));
562 }
563 else {
564 polyTol_ = params->get ("Polynomial Tolerance", DefaultSolverParameters::polyTol);
565 }
566 }
567
568 // Update parameter in our list and residual tests.
569 params_->set("Polynomial Tolerance", polyTol_);
570
571 // Check for maximum polynomial degree
572 if (params->isParameter("Random RHS")) {
573 randomRHS_ = params->get("Random RHS",randomRHS_default_);
574 }
575
576 // Update parameter in our list.
577 params_->set("Random RHS", randomRHS_);
578
579
580 // Check for polynomial damping
581 if (params->isParameter("Damped Poly")) {
582 damp_ = params->get("Damped Poly",dampPoly_default_);
583 }
584 // Update parameter in our list.
585 params_->set("Damped Poly", damp_);
586
587 // Check: Should we add roots for stability if needed?
588 if (params->isParameter("Add Roots")) {
589 addRoots_ = params->get("Add Roots",addRoots_default_);
590 }
591
592 // Update parameter in our list.
593 params_->set("Add Roots", addRoots_);
594
595 // Create the timers if we need to.
596#ifdef BELOS_TEUCHOS_TIME_MONITOR
597 if (timerPoly_ == Teuchos::null) {
598 std::string polyLabel = label_ + ": GmresPolyOp creation time";
599 timerPoly_ = Teuchos::TimeMonitor::getNewCounter(polyLabel);
600 }
601#endif
602
603 // Check if we are going to perform an outer solve.
604 if (outerSolverType_ != "") {
605 hasOuterSolver_ = true;
606 }
607
608 // Inform the solver manager that the current parameters were set.
609 isSet_ = true;
610}
611
612
613template<class ScalarType, class MV, class OP>
615{
616 using Teuchos::RCP;
617 using Teuchos::rcp;
618 using Teuchos::rcp_const_cast;
619
620 // Assume convergence is achieved if user does not require strict convergence.
622
623 // Set the current parameters if they were not set before. NOTE:
624 // This may occur if the user generated the solver manager with the
625 // default constructor and then didn't set any parameters using
626 // setParameters().
627 if (! isSet_) {
628 setParameters (Teuchos::parameterList (*getValidParameters ()));
629 }
630
631 TEUCHOS_TEST_FOR_EXCEPTION(
632 problem_.is_null (), GmresPolySolMgrLinearProblemFailure,
633 "Belos::GmresPolySolMgr::solve: The linear problem has not been set yet, "
634 "or was set to null. Please call setProblem() with a nonnull input before "
635 "calling solve().");
636
637 TEUCHOS_TEST_FOR_EXCEPTION(
638 ! problem_->isProblemSet (), GmresPolySolMgrLinearProblemFailure,
639 "Belos::GmresPolySolMgr::solve: The linear problem is not ready. Please "
640 "call setProblem() on the LinearProblem object before calling solve().");
641
642 // If the GMRES polynomial has not been constructed for this
643 // (nmatrix, preconditioner) pair, generate it.
644 if (!poly_dim_ && maxDegree_) {
645#ifdef BELOS_TEUCHOS_TIME_MONITOR
646 Teuchos::TimeMonitor slvtimer(*timerPoly_);
647#endif
648 poly_Op_ = Teuchos::rcp( new gmres_poly_t( problem_, params_ ) );
649 poly_dim_ = poly_Op_->polyDegree();
650
651 TEUCHOS_TEST_FOR_EXCEPTION( !poly_dim_, GmresPolySolMgrPolynomialFailure,
652 "Belos::GmresPolyOp: Failed to generate polynomial that satisfied requirements.");
653 }
654
655
656 // Solve the linear system using the polynomial
657 if (hasOuterSolver_ && maxDegree_) {
658
659 // Then the polynomial will be used as an operator for an outer solver.
660 // Use outer solver parameter list passed in a sublist.
662 RCP<SolverManager<ScalarType, MultiVec<ScalarType>, Operator<ScalarType> > > solver = factory.create( outerSolverType_, outerParams_ );
663 TEUCHOS_TEST_FOR_EXCEPTION( solver == Teuchos::null, std::invalid_argument,
664 "Belos::GmresPolySolMgr::solve(): Selected solver is not valid.");
665
666 // Create a copy of the linear problem that uses the polynomial as a preconditioner.
667 // The original initial solution and right-hand side are thinly wrapped in the gmres_poly_mv_t
668 RCP<gmres_poly_mv_t> new_lhs = rcp( new gmres_poly_mv_t( problem_->getLHS() ) );
669 RCP<gmres_poly_mv_t> new_rhs = rcp( new gmres_poly_mv_t( rcp_const_cast<MV>( problem_->getRHS() ) ) );
670 RCP<gmres_poly_t> A = rcp( new gmres_poly_t( problem_ ) ); // This just performs problem_->applyOp
671 RCP<LinearProblem<ScalarType,MultiVec<ScalarType>,Operator<ScalarType> > > newProblem =
672 rcp( new LinearProblem<ScalarType,MultiVec<ScalarType>,Operator<ScalarType> >( A, new_lhs, new_rhs ) );
673 std::string solverLabel = label_ + ": Hybrid Gmres";
674 newProblem->setLabel(solverLabel);
675
676 // If the preconditioner is left preconditioner, use Gmres poly as a left preconditioner.
677 if (problem_->getLeftPrec() != Teuchos::null)
678 newProblem->setLeftPrec( poly_Op_ );
679 else
680 newProblem->setRightPrec( poly_Op_ );
681 // Set the initial residual vector, if it has already been set in the original problem.
682 // Don't set the preconditioned residual vector, because it is not the GmresPoly preconditioned residual vector.
683 if (problem_->getInitResVec() != Teuchos::null)
684 newProblem->setInitResVec( rcp( new gmres_poly_mv_t( rcp_const_cast<MV>( problem_->getInitResVec() ) ) ) );
685 newProblem->setProblem();
686
687 solver->setProblem( newProblem );
688
689 ret = solver->solve();
690 numIters_ = solver->getNumIters();
691 loaDetected_ = solver->isLOADetected();
692
693 } // if (hasOuterSolver_ && maxDegree_)
694 else if (hasOuterSolver_) {
695
696 // There is no polynomial, just create the outer solver with the outerSolverType_ and outerParams_.
698 RCP<SolverManager<ScalarType, MV, OP> > solver = factory.create( outerSolverType_, outerParams_ );
699 TEUCHOS_TEST_FOR_EXCEPTION( solver == Teuchos::null, std::invalid_argument,
700 "Belos::GmresPolySolMgr::solve(): Selected solver is not valid.");
701
702 solver->setProblem( problem_ );
703
704 ret = solver->solve();
705 numIters_ = solver->getNumIters();
706 loaDetected_ = solver->isLOADetected();
707
708 }
709 else if (maxDegree_) {
710
711 // Apply the polynomial to the current linear system
712 poly_Op_->ApplyPoly( *problem_->getRHS(), *problem_->getLHS() );
713
714 }
715
716 return ret;
717}
718
719
720template<class ScalarType, class MV, class OP>
722{
723 std::ostringstream out;
724
725 out << "\"Belos::GmresPolySolMgr\": {"
726 << "ScalarType: " << Teuchos::TypeNameTraits<ScalarType>::name ()
727 << ", Poly Degree: " << poly_dim_
728 << ", Poly Max Degree: " << maxDegree_
729 << ", Poly Tol: " << polyTol_;
730 out << "}";
731 return out.str ();
732}
733
734} // namespace Belos
735
736#endif // BELOS_GMRES_POLY_SOLMGR_HPP
Belos header file which uses auto-configuration information to include necessary C++ headers.
Defines the GMRES polynomial operator hybrid-GMRES iterative linear solver.
Class which describes the linear problem to be solved by the iterative solver.
Pure virtual base class which describes the basic interface for a solver manager.
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:60
Belos's class for applying the GMRES polynomial operator that is used by the hybrid-GMRES linear solv...
GmresPolySolMgrLinearProblemFailure is thrown when the linear problem is not setup (i....
GmresPolySolMgrLinearProblemFailure(const std::string &what_arg)
GmresPolySolMgrPolynomialFailure is thrown when their is a problem generating the GMRES polynomial fo...
GmresPolySolMgrPolynomialFailure(const std::string &what_arg)
The GMRES polynomial can be created in conjunction with any standard preconditioner.
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Get a parameter list containing the current parameters for this object.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
int getNumIters() const override
Get the iteration count for the most recent call to solve().
std::string description() const override
Method to return description of the hybrid block GMRES solver manager.
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
bool isLOADetected() const override
Return whether a loss of accuracy was detected by this solver during the most current solve.
const LinearProblem< ScalarType, MV, OP > & getProblem() const override
Get current linear problem being solved for in this object.
virtual ~GmresPolySolMgr()
Destructor.
GmresPolySolMgr()
Empty constructor for GmresPolySolMgr. This constructor takes no arguments and sets the default value...
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
void reset(const ResetType type) override
Reset the solver.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Get a parameter list containing the valid parameters for this object.
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &params) override
Set the parameters the solver manager should use to solve the linear problem.
ReturnType solve() override
This method performs possibly repeated calls to the underlying linear solver's iterate() routine unti...
virtual Teuchos::RCP< solver_base_type > create(const std::string &solverName, const Teuchos::RCP< Teuchos::ParameterList > &solverParams)
Create, configure, and return the specified solver.
A linear system to solve, and its associated information.
Traits class which defines basic operations on multivectors.
Interface for multivectors used by Belos' linear solvers.
Alternative run-time polymorphic interface for operators.
std::ostream & printValidNames(std::ostream &out) const
Print all recognized MatOrthoManager names to the given ostream.
bool isValidName(const std::string &name) const
Whether this factory recognizes the MatOrthoManager with the given name.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
ReturnType
Whether the Belos solve converged for all linear systems.
Definition: BelosTypes.hpp:155
@ Converged
Definition: BelosTypes.hpp:156
ResetType
How to reset the solver.
Definition: BelosTypes.hpp:206
typename ::Belos::Impl::SolverFactorySelector< SC, MV, OP >::type SolverFactory
Default parameters common to most Belos solvers.
Definition: BelosTypes.hpp:283
static const double polyTol
Relative residual tolerance for matrix polynomial construction.
Definition: BelosTypes.hpp:296

Generated on Fri Mar 10 2023 07:13:22 for Belos by doxygen 1.9.4