43 #ifndef BELOS_SOLVERMANAGER_HPP 44 #define BELOS_SOLVERMANAGER_HPP 55 #include "Teuchos_ParameterList.hpp" 56 #include "Teuchos_RCP.hpp" 57 #include "Teuchos_Describable.hpp" 67 template <
class ScalarType,
class MV,
class OP>
71 template<
class ScalarType,
class MV,
class OP>
109 virtual typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
achievedTol()
const {
110 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"achievedTol() not implemented");
139 virtual void setParameters(
const Teuchos::RCP<Teuchos::ParameterList> ¶ms ) = 0;
148 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setUserConvStatusTest() has not been" 149 <<
" overridden for the class" << this->description() <<
" yet!");
157 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setDebugStatusTest() has not been" 158 <<
" overridden for the class" << this->description() <<
" yet!");
215 template<
class ScalarType,
218 const bool isComplex = Teuchos::ScalarTraits<ScalarType>::isComplex>
222 template<
class ScalarType,
class MV,
class OP>
237 template<
class ScalarType,
class MV,
class OP>
242 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
243 "This solver is not implemented for complex ScalarType." );
248 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
249 "This solver is not implemented for complex ScalarType." );
252 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
253 "This solver is not implemented for complex ScalarType." );
256 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
257 "This solver is not implemented for complex ScalarType." );
260 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
261 "This solver is not implemented for complex ScalarType." );
264 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
265 "This solver is not implemented for complex ScalarType." );
268 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
269 "This solver is not implemented for complex ScalarType." );
271 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
272 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
273 "This solver is not implemented for complex ScalarType." );
276 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
277 "This solver is not implemented for complex ScalarType." );
280 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
281 "This solver is not implemented for complex ScalarType." );
289 template<
class ScalarType>
307 #ifdef HAVE_TEUCHOS_COMPLEX 311 const static bool value =
true;
315 class LapackSupportsScalar<std::complex<double> > {
317 const static bool value =
true;
319 #endif // HAVE_TEUCHOS_COMPLEX 325 template<
class ScalarType,
328 const bool lapackSupportsScalarType =
336 template<
class ScalarType,
class MV,
class OP>
350 template<
class ScalarType,
class MV,
class OP>
355 TEUCHOS_TEST_FOR_EXCEPTION
356 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 357 " types for which Teuchos::LAPACK does not have a valid implementation. " 358 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
363 TEUCHOS_TEST_FOR_EXCEPTION
364 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 365 " types for which Teuchos::LAPACK does not have a valid implementation. " 366 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
369 TEUCHOS_TEST_FOR_EXCEPTION
370 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 371 " types for which Teuchos::LAPACK does not have a valid implementation. " 372 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
375 TEUCHOS_TEST_FOR_EXCEPTION
376 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 377 " types for which Teuchos::LAPACK does not have a valid implementation. " 378 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
381 TEUCHOS_TEST_FOR_EXCEPTION
382 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 383 " types for which Teuchos::LAPACK does not have a valid implementation. " 384 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
387 TEUCHOS_TEST_FOR_EXCEPTION
388 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 389 " types for which Teuchos::LAPACK does not have a valid implementation. " 390 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
393 TEUCHOS_TEST_FOR_EXCEPTION
394 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 395 " types for which Teuchos::LAPACK does not have a valid implementation. " 396 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
398 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
399 TEUCHOS_TEST_FOR_EXCEPTION
400 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 401 " types for which Teuchos::LAPACK does not have a valid implementation. " 402 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
405 TEUCHOS_TEST_FOR_EXCEPTION
406 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 407 " types for which Teuchos::LAPACK does not have a valid implementation. " 408 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
411 TEUCHOS_TEST_FOR_EXCEPTION
412 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 413 " types for which Teuchos::LAPACK does not have a valid implementation. " 414 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
422 template<
class ScalarType,
425 const bool supportsScalarType =
427 ! Teuchos::ScalarTraits<ScalarType>::isComplex>
437 template<
class ScalarType,
class MV,
class OP>
452 template<
class ScalarType,
class MV,
class OP>
457 TEUCHOS_TEST_FOR_EXCEPTION
458 (
true, std::logic_error,
"This solver is not implemented for complex " 459 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 460 "does not have a valid implementation." 461 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
466 TEUCHOS_TEST_FOR_EXCEPTION
467 (
true, std::logic_error,
"This solver is not implemented for complex " 468 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 469 "does not have a valid implementation." 470 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
473 TEUCHOS_TEST_FOR_EXCEPTION
474 (
true, std::logic_error,
"This solver is not implemented for complex " 475 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 476 "does not have a valid implementation." 477 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
480 TEUCHOS_TEST_FOR_EXCEPTION
481 (
true, std::logic_error,
"This solver is not implemented for complex " 482 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 483 "does not have a valid implementation." 484 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
487 TEUCHOS_TEST_FOR_EXCEPTION
488 (
true, std::logic_error,
"This solver is not implemented for complex " 489 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 490 "does not have a valid implementation." 491 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
494 TEUCHOS_TEST_FOR_EXCEPTION
495 (
true, std::logic_error,
"This solver is not implemented for complex " 496 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 497 "does not have a valid implementation." 498 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
502 TEUCHOS_TEST_FOR_EXCEPTION
503 (
true, std::logic_error,
"This solver is not implemented for complex " 504 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 505 "does not have a valid implementation." 506 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
508 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
509 TEUCHOS_TEST_FOR_EXCEPTION
510 (
true, std::logic_error,
"This solver is not implemented for complex " 511 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 512 "does not have a valid implementation." 513 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
516 TEUCHOS_TEST_FOR_EXCEPTION
517 (
true, std::logic_error,
"This solver is not implemented for complex " 518 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 519 "does not have a valid implementation." 520 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
523 TEUCHOS_TEST_FOR_EXCEPTION
524 (
true, std::logic_error,
"This solver is not implemented for complex " 525 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 526 "does not have a valid implementation." 527 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
Collection of types and exceptions used within the Belos solvers.
ComboType
The test can be either the AND of all the component tests, or the OR of all the component tests...
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &)
Set the linear problem that needs to be solved.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)=0
Set the linear problem that needs to be solved.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const =0
Return the current parameters being used for this solver manager.
virtual ~SolverManagerRequiresLapack()
virtual ReturnType solve()
Iterate until the status test tells us to stop.
virtual int getNumIters() const =0
Get the iteration count for the most recent call to solve().
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
virtual ReturnType solve()
Iterate until the status test tells us to stop.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
SolverManager()
Empty constructor.
virtual ~RealSolverManager()
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
virtual ~RealSolverManager()
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
Base class for Belos::SolverManager subclasses which normally can only compile with real ScalarType t...
virtual ReturnType solve()=0
Iterate until the status test tells us to stop.
virtual ~SolverManagerRequiresLapack()
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
Set the linear problem that needs to be solved.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
Base class for Belos::SolverManager subclasses which normally can only compile for real ScalarType...
virtual void reset(const ResetType type)=0
Reset the solver manager.
virtual void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &debugStatusTest)
Set user-defined debug status test.
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
A pure virtual class for defining the status tests for the Belos iterative solvers.
virtual ~SolverManagerRequiresRealLapack()
virtual void reset(const ResetType type)
Reset the solver manager.
Belos::StatusTest for logically combining several status tests.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
Return a reference to the linear problem being solved by this solver manager.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
ResetType
How to reset the solver.
SolverManagerRequiresLapack()
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &userConvStatusTest, const typename StatusTestCombo< ScalarType, MV, OP >::ComboType &comboType=StatusTestCombo< ScalarType, MV, OP >::SEQ)
Set user-defined convergence status test.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
Set the linear problem that needs to be solved.
SolverManagerRequiresRealLapack()
A linear system to solve, and its associated information.
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
Class which describes the linear problem to be solved by the iterative solver.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
ReturnType
Whether the Belos solve converged for all linear systems.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
virtual void reset(const ResetType type)
Reset the solver manager.
virtual void reset(const ResetType type)
Reset the solver manager.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
virtual ~SolverManagerRequiresRealLapack()
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)=0
Set the parameters to use when solving the linear problem.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const =0
Return the valid parameters for this solver manager.
SolverManagerRequiresLapack()
virtual bool isLOADetected() const =0
Returns whether a loss of accuracy was detected in the solver.
A class for extending the status testing capabilities of Belos via logical combinations.
SolverManagerRequiresRealLapack()
virtual ReturnType solve()
Iterate until the status test tells us to stop.
Base class for Belos::SolverManager subclasses which normally can only compile with ScalarType types ...
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
Belos header file which uses auto-configuration information to include necessary C++ headers...
virtual ~SolverManager()
Destructor.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.