10#ifndef BELOS_BLOCK_GMRES_SOLMGR_HPP
11#define BELOS_BLOCK_GMRES_SOLMGR_HPP
34#ifdef BELOS_TEUCHOS_TIME_MONITOR
35#include "Teuchos_TimeMonitor.hpp"
95template<
class ScalarType,
class MV,
class OP>
101 typedef Teuchos::ScalarTraits<ScalarType> SCT;
102 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
103 typedef Teuchos::ScalarTraits<MagnitudeType> MT;
138 const Teuchos::RCP<Teuchos::ParameterList> &
pl );
144 Teuchos::RCP<SolverManager<ScalarType, MV, OP> >
clone ()
const override {
171 Teuchos::Array<Teuchos::RCP<Teuchos::Time> >
getTimers()
const {
172 return Teuchos::tuple(timerSolve_);
259 const Teuchos::EVerbosityLevel
verbLevel =
260 Teuchos::Describable::verbLevel_default)
const override;
270 bool checkStatusTest();
273 Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > problem_;
276 Teuchos::RCP<OutputManager<ScalarType> > printer_;
277 Teuchos::RCP<std::ostream> outputStream_;
280 Teuchos::RCP<StatusTest<ScalarType,MV,OP> > debugStatusTest_;
281 Teuchos::RCP<StatusTest<ScalarType,MV,OP> > sTest_;
282 Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP> > maxIterTest_;
283 Teuchos::RCP<StatusTest<ScalarType,MV,OP> > convTest_;
284 Teuchos::RCP<StatusTestResNorm<ScalarType,MV,OP> > expConvTest_, impConvTest_;
285 Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > outputTest_;
288 Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> > ortho_;
291 Teuchos::RCP<Teuchos::ParameterList> params_;
294 static constexpr int maxRestarts_default_ = 20;
295 static constexpr int maxIters_default_ = 1000;
296 static constexpr bool adaptiveBlockSize_default_ =
true;
297 static constexpr bool showMaxResNormOnly_default_ =
false;
298 static constexpr bool flexibleGmres_default_ =
false;
299 static constexpr bool keepHessenberg_default_ =
false;
300 static constexpr bool expResTest_default_ =
false;
301 static constexpr int blockSize_default_ = 1;
302 static constexpr int numBlocks_default_ = 300;
305 static constexpr int outputFreq_default_ = -1;
306 static constexpr const char * impResScale_default_ =
"Norm of Preconditioned Initial Residual";
307 static constexpr const char * expResScale_default_ =
"Norm of Initial Residual";
308 static constexpr const char * label_default_ =
"Belos";
309 static constexpr const char * orthoType_default_ =
"ICGS";
312 MagnitudeType convtol_, orthoKappa_, achievedTol_;
313 int maxRestarts_, maxIters_, numIters_;
314 int blockSize_, numBlocks_, verbosity_, outputStyle_, outputFreq_;
315 bool adaptiveBlockSize_, showMaxResNormOnly_, isFlexible_, keepHessenberg_, expResTest_;
316 std::string orthoType_;
317 std::string impResScale_, expResScale_;
321 Teuchos::RCP<Teuchos::Time> timerSolve_;
324 bool isSet_, isSTSet_;
330template<
class ScalarType,
class MV,
class OP>
336 maxRestarts_(maxRestarts_default_),
337 maxIters_(maxIters_default_),
339 blockSize_(blockSize_default_),
340 numBlocks_(numBlocks_default_),
341 verbosity_(verbosity_default_),
342 outputStyle_(outputStyle_default_),
343 outputFreq_(outputFreq_default_),
344 adaptiveBlockSize_(adaptiveBlockSize_default_),
345 showMaxResNormOnly_(showMaxResNormOnly_default_),
346 isFlexible_(flexibleGmres_default_),
347 keepHessenberg_(keepHessenberg_default_),
348 expResTest_(expResTest_default_),
349 orthoType_(orthoType_default_),
350 impResScale_(impResScale_default_),
351 expResScale_(expResScale_default_),
352 label_(label_default_),
360template<
class ScalarType,
class MV,
class OP>
363 const Teuchos::RCP<Teuchos::ParameterList> &
pl) :
369 maxRestarts_(maxRestarts_default_),
370 maxIters_(maxIters_default_),
372 blockSize_(blockSize_default_),
373 numBlocks_(numBlocks_default_),
374 verbosity_(verbosity_default_),
375 outputStyle_(outputStyle_default_),
376 outputFreq_(outputFreq_default_),
377 adaptiveBlockSize_(adaptiveBlockSize_default_),
378 showMaxResNormOnly_(showMaxResNormOnly_default_),
379 isFlexible_(flexibleGmres_default_),
380 keepHessenberg_(keepHessenberg_default_),
381 expResTest_(expResTest_default_),
382 orthoType_(orthoType_default_),
383 impResScale_(impResScale_default_),
384 expResScale_(expResScale_default_),
385 label_(label_default_),
401template<
class ScalarType,
class MV,
class OP>
402Teuchos::RCP<const Teuchos::ParameterList>
405 static Teuchos::RCP<const Teuchos::ParameterList>
validPL;
407 Teuchos::RCP<Teuchos::ParameterList>
pl = Teuchos::parameterList();
412 "The relative residual tolerance that needs to be achieved by the\n"
413 "iterative solver in order for the linear system to be declared converged." );
414 pl->set(
"Maximum Restarts",
static_cast<int>(maxRestarts_default_),
415 "The maximum number of restarts allowed for each\n"
416 "set of RHS solved.");
417 pl->set(
"Maximum Iterations",
static_cast<int>(maxIters_default_),
418 "The maximum number of block iterations allowed for each\n"
419 "set of RHS solved.");
420 pl->set(
"Num Blocks",
static_cast<int>(numBlocks_default_),
421 "The maximum number of blocks allowed in the Krylov subspace\n"
422 "for each set of RHS solved.");
423 pl->set(
"Block Size",
static_cast<int>(blockSize_default_),
424 "The number of vectors in each block. This number times the\n"
425 "number of blocks is the total Krylov subspace dimension.");
426 pl->set(
"Adaptive Block Size",
static_cast<bool>(adaptiveBlockSize_default_),
427 "Whether the solver manager should adapt the block size\n"
428 "based on the number of RHS to solve.");
429 pl->set(
"Verbosity",
static_cast<int>(verbosity_default_),
430 "What type(s) of solver information should be outputted\n"
431 "to the output stream.");
432 pl->set(
"Output Style",
static_cast<int>(outputStyle_default_),
433 "What style is used for the solver information outputted\n"
434 "to the output stream.");
435 pl->set(
"Output Frequency",
static_cast<int>(outputFreq_default_),
436 "How often convergence information should be outputted\n"
437 "to the output stream.");
438 pl->set(
"Output Stream", Teuchos::rcpFromRef(std::cout),
439 "A reference-counted pointer to the output stream where all\n"
440 "solver output is sent.");
441 pl->set(
"Show Maximum Residual Norm Only",
static_cast<bool>(showMaxResNormOnly_default_),
442 "When convergence information is printed, only show the maximum\n"
443 "relative residual norm when the block size is greater than one.");
444 pl->set(
"Flexible Gmres",
static_cast<bool>(flexibleGmres_default_),
445 "Whether the solver manager should use the flexible variant\n"
447 pl->set(
"Keep Hessenberg",
static_cast<bool>(keepHessenberg_default_),
448 "Whether the raw upper Hessenberg matrix should be stored separately\n"
449 "from the QR-factored least squares system. Useful for harmonic Ritz\n"
450 "pair computation from the GMRES iteration state.");
451 pl->set(
"Explicit Residual Test",
static_cast<bool>(expResTest_default_),
452 "Whether the explicitly computed residual should be used in the convergence test.");
453 pl->set(
"Implicit Residual Scaling",
static_cast<const char *
>(impResScale_default_),
454 "The type of scaling used in the implicit residual convergence test.");
455 pl->set(
"Explicit Residual Scaling",
static_cast<const char *
>(expResScale_default_),
456 "The type of scaling used in the explicit residual convergence test.");
457 pl->set(
"Timer Label",
static_cast<const char *
>(label_default_),
458 "The string to use as a prefix for the timer labels.");
459 pl->set(
"Orthogonalization",
static_cast<const char *
>(orthoType_default_),
460 "The type of orthogonalization to use: DGKS, ICGS, or IMGS.");
462 "The constant used by DGKS orthogonalization to determine\n"
463 "whether another step of classical Gram-Schmidt is necessary.");
470template<
class ScalarType,
class MV,
class OP>
475 if (params_ == Teuchos::null) {
476 params_ = Teuchos::rcp(
new Teuchos::ParameterList(*getValidParameters()) );
479 params->validateParameters(*getValidParameters());
483 if (
params->isParameter(
"Maximum Restarts")) {
484 maxRestarts_ =
params->get(
"Maximum Restarts",maxRestarts_default_);
487 params_->set(
"Maximum Restarts", maxRestarts_);
491 if (
params->isParameter(
"Maximum Iterations")) {
492 maxIters_ =
params->get(
"Maximum Iterations",maxIters_default_);
495 params_->set(
"Maximum Iterations", maxIters_);
496 if (maxIterTest_!=Teuchos::null)
497 maxIterTest_->setMaxIters( maxIters_ );
501 if (
params->isParameter(
"Block Size")) {
502 blockSize_ =
params->get(
"Block Size",blockSize_default_);
504 "Belos::BlockGmresSolMgr: \"Block Size\" must be strictly positive.");
507 params_->set(
"Block Size", blockSize_);
511 if (
params->isParameter(
"Adaptive Block Size")) {
512 adaptiveBlockSize_ =
params->get(
"Adaptive Block Size",adaptiveBlockSize_default_);
515 params_->set(
"Adaptive Block Size", adaptiveBlockSize_);
519 if (
params->isParameter(
"Num Blocks")) {
520 numBlocks_ =
params->get(
"Num Blocks",numBlocks_default_);
522 "Belos::BlockGmresSolMgr: \"Num Blocks\" must be strictly positive.");
525 params_->set(
"Num Blocks", numBlocks_);
529 if (
params->isParameter(
"Timer Label")) {
535 params_->set(
"Timer Label", label_);
536 std::string
solveLabel = label_ +
": BlockGmresSolMgr total solve time";
537#ifdef BELOS_TEUCHOS_TIME_MONITOR
538 timerSolve_ = Teuchos::TimeMonitor::getNewCounter(
solveLabel);
540 if (ortho_ != Teuchos::null) {
541 ortho_->setLabel( label_ );
547 if (
params->isParameter(
"Keep Hessenberg")) {
548 keepHessenberg_ = Teuchos::getParameter<bool>(*
params,
"Keep Hessenberg");
549 params_->set(
"Keep Hessenberg", keepHessenberg_);
553 if (
params->isParameter(
"Flexible Gmres")) {
554 isFlexible_ = Teuchos::getParameter<bool>(*
params,
"Flexible Gmres");
555 params_->set(
"Flexible Gmres", isFlexible_);
556 if (isFlexible_ && expResTest_) {
563 if (
params->isParameter(
"Verbosity")) {
564 if (Teuchos::isParameterType<int>(*
params,
"Verbosity")) {
565 verbosity_ =
params->get(
"Verbosity", verbosity_default_);
567 verbosity_ = (
int)Teuchos::getParameter<Belos::MsgType>(*
params,
"Verbosity");
571 params_->set(
"Verbosity", verbosity_);
572 if (printer_ != Teuchos::null)
573 printer_->setVerbosity(verbosity_);
577 if (
params->isParameter(
"Output Style")) {
578 if (Teuchos::isParameterType<int>(*
params,
"Output Style")) {
579 outputStyle_ =
params->get(
"Output Style", outputStyle_default_);
581 outputStyle_ = (
int)Teuchos::getParameter<Belos::OutputType>(*
params,
"Output Style");
585 params_->set(
"Output Style", outputStyle_);
586 if (outputTest_ != Teuchos::null) {
592 if (
params->isParameter(
"Output Stream")) {
593 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*
params,
"Output Stream");
596 params_->set(
"Output Stream", outputStream_);
597 if (printer_ != Teuchos::null)
598 printer_->setOStream( outputStream_ );
603 if (
params->isParameter(
"Output Frequency")) {
604 outputFreq_ =
params->get(
"Output Frequency", outputFreq_default_);
608 params_->set(
"Output Frequency", outputFreq_);
609 if (outputTest_ != Teuchos::null)
610 outputTest_->setOutputFrequency( outputFreq_ );
614 if (printer_ == Teuchos::null) {
620 if (
params->isParameter(
"Orthogonalization")) {
627 params_->set(
"Orthogonalization", orthoType_);
630 if (
params->isParameter(
"Orthogonalization Constant")) {
631 if (
params->isType<MagnitudeType> (
"Orthogonalization Constant")) {
632 orthoKappa_ =
params->get (
"Orthogonalization Constant",
636 orthoKappa_ =
params->get (
"Orthogonalization Constant",
641 params_->set(
"Orthogonalization Constant",orthoKappa_);
642 if (orthoType_==
"DGKS") {
644 Teuchos::rcp_dynamic_cast<DGKSOrthoManager<ScalarType,MV,OP> >(ortho_)->setDepTol( orthoKappa_ );
653 if (orthoType_==
"DGKS" && orthoKappa_ > 0) {
654 paramsOrtho = Teuchos::rcp(
new Teuchos::ParameterList());
658 ortho_ =
factory.makeMatOrthoManager (orthoType_, Teuchos::null, printer_, label_,
paramsOrtho);
662 if (
params->isParameter(
"Convergence Tolerance")) {
663 if (
params->isType<MagnitudeType> (
"Convergence Tolerance")) {
664 convtol_ =
params->get (
"Convergence Tolerance",
672 params_->set(
"Convergence Tolerance", convtol_);
673 if (impConvTest_ != Teuchos::null)
674 impConvTest_->setTolerance( convtol_ );
675 if (expConvTest_ != Teuchos::null)
676 expConvTest_->setTolerance( convtol_ );
680 if (
params->isParameter(
"Implicit Residual Scaling")) {
681 std::string
tempImpResScale = Teuchos::getParameter<std::string>( *
params,
"Implicit Residual Scaling" );
689 params_->set(
"Implicit Residual Scaling", impResScale_);
690 if (impConvTest_ != Teuchos::null) {
694 catch (std::exception&
e) {
702 if (
params->isParameter(
"Explicit Residual Scaling")) {
703 std::string
tempExpResScale = Teuchos::getParameter<std::string>( *
params,
"Explicit Residual Scaling" );
711 params_->set(
"Explicit Residual Scaling", expResScale_);
712 if (expConvTest_ != Teuchos::null) {
716 catch (std::exception&
e) {
724 if (
params->isParameter(
"Explicit Residual Test")) {
725 expResTest_ = Teuchos::getParameter<bool>( *
params,
"Explicit Residual Test" );
728 params_->set(
"Explicit Residual Test", expResTest_);
729 if (expConvTest_ == Teuchos::null) {
734 if (
params->isParameter(
"Show Maximum Residual Norm Only")) {
735 showMaxResNormOnly_ = Teuchos::getParameter<bool>(*
params,
"Show Maximum Residual Norm Only");
738 params_->set(
"Show Maximum Residual Norm Only", showMaxResNormOnly_);
739 if (impConvTest_ != Teuchos::null)
740 impConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
741 if (expConvTest_ != Teuchos::null)
742 expConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
747 if (timerSolve_ == Teuchos::null) {
748 std::string
solveLabel = label_ +
": BlockGmresSolMgr total solve time";
749#ifdef BELOS_TEUCHOS_TIME_MONITOR
750 timerSolve_ = Teuchos::TimeMonitor::getNewCounter(
solveLabel);
759template<
class ScalarType,
class MV,
class OP>
772 if (isFlexible_ && Teuchos::is_null(problem_->getRightPrec())) {
774 params_->set(
"Flexible Gmres", isFlexible_);
778 "Belos::BlockGmresSolMgr::solve(): Linear problem has a left preconditioner, not a right preconditioner, which is required for flexible GMRES.");
783 if (!Teuchos::is_null(problem_->getLeftPrec()) && !isFlexible_) {
805 convTest_ = Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::SEQ, impConvTest_, expConvTest_ ) );
828 expConvTest_ = impConvTest_;
829 convTest_ = impConvTest_;
833 sTest_ = Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::OR, maxIterTest_, convTest_ ) );
836 if (
nonnull(debugStatusTest_) ) {
838 Teuchos::rcp_dynamic_cast<StatusTestCombo_t>(sTest_)->addStatusTest( debugStatusTest_ );
858template<
class ScalarType,
class MV,
class OP>
868template<
class ScalarType,
class MV,
class OP>
875 setParameters(Teuchos::parameterList(*getValidParameters()));
879 "Belos::BlockGmresSolMgr::solve(): Linear problem is not a valid object.");
882 "Belos::BlockGmresSolMgr::solve(): Linear problem is not ready, setProblem() has not been called.");
884 if (!isSTSet_ || (!expResTest_ && !Teuchos::is_null(problem_->getLeftPrec())) ) {
886 "Belos::BlockGmresSolMgr::solve(): Linear problem and requested status tests are incompatible.");
891 int numRHS2Solve = MVT::GetNumberVecs( *(problem_->getRHS()) );
897 if ( adaptiveBlockSize_ ) {
913 problem_->setLSIndex(
currIdx );
917 Teuchos::ParameterList
plist;
918 plist.set(
"Block Size",blockSize_);
919 plist.set(
"Keep Hessenberg",keepHessenberg_);
921 ptrdiff_t dim = MVT::GetGlobalLength( *(problem_->getRHS()) );
922 if (blockSize_*
static_cast<ptrdiff_t>(numBlocks_) >
dim) {
929 "Belos::BlockGmresSolMgr::solve(): Warning! Requested Krylov subspace dimension is larger than operator dimension!"
930 << std::endl <<
" The maximum number of blocks allowed for the Krylov subspace will be adjusted to " <<
tmpNumBlocks << std::endl;
934 plist.set(
"Num Blocks",numBlocks_);
937 outputTest_->reset();
938 loaDetected_ =
false;
955#ifdef BELOS_TEUCHOS_TIME_MONITOR
956 Teuchos::TimeMonitor
slvtimer(*timerSolve_);
962 if (blockSize_*numBlocks_ >
dim) {
977 outputTest_->resetNumCalls();
980 Teuchos::RCP<MV>
V_0;
983 if (
currIdx[blockSize_-1] == -1) {
984 V_0 = MVT::Clone( *(problem_->getInitResVec()), blockSize_ );
985 problem_->computeCurrResVec( &*
V_0 );
988 V_0 = MVT::CloneCopy( *(problem_->getInitResVec()),
currIdx );
993 if (
currIdx[blockSize_-1] == -1) {
994 V_0 = MVT::Clone( *(problem_->getInitPrecResVec()), blockSize_ );
995 problem_->computeCurrPrecResVec( &*
V_0 );
998 V_0 = MVT::CloneCopy( *(problem_->getInitPrecResVec()),
currIdx );
1003 Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> >
z_0 =
1004 Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>( blockSize_, blockSize_ ) );
1009 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors.");
1029 if ( convTest_->getStatus() ==
Passed ) {
1030 if ( expConvTest_->getLOADetected() ) {
1032 loaDetected_ =
true;
1034 "Belos::BlockGmresSolMgr::solve(): Warning! Solver has experienced a loss of accuracy!" << std::endl;
1044 else if ( maxIterTest_->getStatus() ==
Passed ) {
1062 printer_->stream(
Debug) <<
" Performing restart number " <<
numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
1068 Teuchos::RCP<MV>
curX = problem_->getCurrLHSVec();
1072 problem_->updateSolution(
update,
true );
1081 problem_->computeCurrResVec( &*
V_0 );
1083 problem_->computeCurrPrecResVec( &*
V_0 );
1086 z_0 = Teuchos::rcp(
new Teuchos::SerialDenseMatrix<int,ScalarType>( blockSize_, blockSize_ ) );
1091 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors after restart.");
1110 "Belos::BlockGmresSolMgr::solve(): Invalid return from BlockGmresIter::iterate().");
1115 if (blockSize_ != 1) {
1116 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1118 <<
e.what() << std::endl;
1119 if (convTest_->getStatus() !=
Passed)
1129 if (convTest_->getStatus() !=
Passed)
1136 achievedTol_ = MT::one();
1137 Teuchos::RCP<MV>
X = problem_->getLHS();
1138 MVT::MvInit( *
X, SCT::zero() );
1139 printer_->stream(
Warnings) <<
"Belos::BlockGmresSolMgr::solve(): Warning! NaN has been detected!"
1143 catch (
const std::exception &
e) {
1144 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1146 <<
e.what() << std::endl;
1156 Teuchos::RCP<MV>
curX = problem_->getCurrLHSVec();
1158 if (
update != Teuchos::null)
1163 if ( !Teuchos::is_null(expConvTest_->getSolution()) ) {
1164 Teuchos::RCP<MV>
newX = expConvTest_->getSolution();
1165 Teuchos::RCP<MV>
curX = problem_->getCurrLHSVec();
1170 problem_->updateSolution(
update,
true );
1175 problem_->setCurrLS();
1183 if ( adaptiveBlockSize_ ) {
1197 problem_->setLSIndex(
currIdx );
1211#ifdef BELOS_TEUCHOS_TIME_MONITOR
1216 Teuchos::TimeMonitor::summarize( printer_->stream(
TimingDetails) );
1220 numIters_ = maxIterTest_->getNumIters();
1246 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1247 "getTestValue() method returned NULL. Please report this bug to the "
1248 "Belos developers.");
1250 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1251 "getTestValue() method returned a vector of length zero. Please report "
1252 "this bug to the Belos developers.");
1267template<
class ScalarType,
class MV,
class OP>
1270 std::ostringstream
out;
1271 out <<
"\"Belos::BlockGmresSolMgr\": {";
1275 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false")
1276 <<
", Num Blocks: " << numBlocks_
1277 <<
", Maximum Iterations: " << maxIters_
1278 <<
", Maximum Restarts: " << maxRestarts_
1279 <<
", Convergence Tolerance: " << convtol_
1285template<
class ScalarType,
class MV,
class OP>
1289 const Teuchos::EVerbosityLevel
verbLevel)
const
1291 using Teuchos::TypeNameTraits;
1292 using Teuchos::VERB_DEFAULT;
1293 using Teuchos::VERB_NONE;
1294 using Teuchos::VERB_LOW;
1301 const Teuchos::EVerbosityLevel
vl =
1307 out <<
"\"Belos::BlockGmresSolMgr\":" << endl;
1309 out <<
"Template parameters:" << endl;
1319 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false") << endl
1320 <<
"Num Blocks: " << numBlocks_ << endl
1321 <<
"Maximum Iterations: " << maxIters_ << endl
1322 <<
"Maximum Restarts: " << maxRestarts_ << endl
1323 <<
"Convergence Tolerance: " << convtol_ << endl;
Belos concrete class for performing the block, flexible GMRES iteration.
Belos concrete class for performing the block GMRES iteration.
Belos header file which uses auto-configuration information to include necessary C++ headers.
Pure virtual base class which augments the basic interface for a Gmres linear solver iteration.
Class which describes the linear problem to be solved by the iterative solver.
Class which manages the output and verbosity of the Belos solvers.
Pure virtual base class which describes the basic interface for a solver manager.
Belos::StatusTest for logically combining several status tests.
Belos::StatusTestResNorm for specifying general residual norm stopping criteria.
Belos::StatusTest for specifying an implicit residual norm stopping criteria that checks for loss of ...
Belos::StatusTest class for specifying a maximum number of iterations.
Virtual base class for StatusTest that printing status tests.
A factory class for generating StatusTestOutput objects.
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
Interface to Block GMRES and Flexible GMRES.
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
int getNumIters() const override
Get the iteration count for the most recent call to solve().
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Print the object with the given verbosity level to a FancyOStream.
void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &debugStatusTest) override
Set a debug status test that will be checked at the same time as the top-level status test.
ReturnType solve() override
This method performs possibly repeated calls to the underlying linear solver's iterate() routine unti...
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
std::string description() const override
Return a one-line description of this object.
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms) override
Set the parameters the solver manager should use to solve the linear problem.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Get a parameter list containing the valid parameters for this object.
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
BlockGmresSolMgr()
Empty constructor for BlockGmresSolMgr. This constructor takes no arguments and sets the default valu...
virtual ~BlockGmresSolMgr()
Destructor.
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Get a parameter list containing the current parameters for this object.
void reset(const ResetType type) override
Performs a reset of the solver manager specified by the ResetType. This informs the solver manager th...
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.
BlockGmresSolMgrLinearProblemFailure is thrown when the linear problem is not setup (i....
BlockGmresSolMgrLinearProblemFailure(const std::string &what_arg)
BlockGmresSolMgrOrthoFailure is thrown when the orthogonalization manager is unable to generate ortho...
BlockGmresSolMgrOrthoFailure(const std::string &what_arg)
GmresIterationOrthoFailure is thrown when the GmresIteration object is unable to compute independent ...
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
ReturnType
Whether the Belos solve converged for all linear systems.
ScaleType
The type of scaling to use on the residual norm value.
ResetType
How to reset the solver.
Default parameters common to most Belos solvers.
static const double convTol
Default convergence tolerance.
static const double orthoKappa
DGKS orthogonalization constant.