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"
67template <
class ScalarType,
class MV,
class OP>
71template<
class ScalarType,
class MV,
class OP>
88 virtual Teuchos::RCP<SolverManager<ScalarType, MV, OP> >
clone ()
const = 0;
114 virtual typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
achievedTol()
const {
115 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"achievedTol() not implemented");
144 virtual void setParameters(
const Teuchos::RCP<Teuchos::ParameterList> ¶ms ) = 0;
153 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setUserConvStatusTest() has not been"
154 <<
" overridden for the class" << this->description() <<
" yet!");
162 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setDebugStatusTest() has not been"
163 <<
" overridden for the class" << this->description() <<
" yet!");
223 const bool isComplex = Teuchos::ScalarTraits<ScalarType>::isComplex>
227 template<
class ScalarType,
class MV,
class OP>
242 template<
class ScalarType,
class MV,
class OP>
254 "This solver is not implemented for complex ScalarType." );
258 "This solver is not implemented for complex ScalarType." );
262 "This solver is not implemented for complex ScalarType." );
266 "This solver is not implemented for complex ScalarType." );
270 "This solver is not implemented for complex ScalarType." );
274 "This solver is not implemented for complex ScalarType." );
278 "This solver is not implemented for complex ScalarType." );
282 "This solver is not implemented for complex ScalarType." );
286 "This solver is not implemented for complex ScalarType." );
294 template<
class ScalarType>
312#ifdef HAVE_TEUCHOS_LONG_DOUBLE
316 const static bool value =
true;
321#ifdef HAVE_TEUCHOS_COMPLEX
323 class LapackSupportsScalar<std::
complex<float> > {
325 const static bool value =
true;
329 class LapackSupportsScalar<std::
complex<double> > {
331 const static bool value =
true;
350 template<
class ScalarType,
class MV,
class OP>
364 template<
class ScalarType,
class MV,
class OP>
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 () <<
".");
378 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
379 " types for which Teuchos::LAPACK does not have a valid implementation. "
380 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
384 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
385 " types for which Teuchos::LAPACK does not have a valid implementation. "
386 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
390 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
391 " types for which Teuchos::LAPACK does not have a valid implementation. "
392 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
396 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
397 " types for which Teuchos::LAPACK does not have a valid implementation. "
398 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
402 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
403 " types for which Teuchos::LAPACK does not have a valid implementation. "
404 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
408 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
409 " types for which Teuchos::LAPACK does not have a valid implementation. "
410 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
414 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
415 " types for which Teuchos::LAPACK does not have a valid implementation. "
416 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
420 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
421 " types for which Teuchos::LAPACK does not have a valid implementation. "
422 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
426 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
427 " types for which Teuchos::LAPACK does not have a valid implementation. "
428 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
441 ! Teuchos::ScalarTraits<ScalarType>::isComplex>
451 template<
class ScalarType,
class MV,
class OP>
466 template<
class ScalarType,
class MV,
class OP>
478 (
true, std::logic_error,
"This solver is not implemented for complex "
479 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
480 "does not have a valid implementation."
481 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
485 (
true, std::logic_error,
"This solver is not implemented for complex "
486 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
487 "does not have a valid implementation."
488 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
492 (
true, std::logic_error,
"This solver is not implemented for complex "
493 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
494 "does not have a valid implementation."
495 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
499 (
true, std::logic_error,
"This solver is not implemented for complex "
500 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
501 "does not have a valid implementation."
502 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
506 (
true, std::logic_error,
"This solver is not implemented for complex "
507 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
508 "does not have a valid implementation."
509 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
514 (
true, std::logic_error,
"This solver is not implemented for complex "
515 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
516 "does not have a valid implementation."
517 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
521 (
true, std::logic_error,
"This solver is not implemented for complex "
522 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
523 "does not have a valid implementation."
524 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
528 (
true, std::logic_error,
"This solver is not implemented for complex "
529 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
530 "does not have a valid implementation."
531 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
535 (
true, std::logic_error,
"This solver is not implemented for complex "
536 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
537 "does not have a valid implementation."
538 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
Belos header file which uses auto-configuration information to include necessary C++ headers.
Class which describes the linear problem to be solved by the iterative solver.
Belos::StatusTest for logically combining several status tests.
Collection of types and exceptions used within the Belos solvers.
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
virtual ~RealSolverManager()
virtual ~RealSolverManager()
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
virtual void reset(const ResetType type)
Reset the solver manager.
virtual ReturnType solve()
Iterate until the status test tells us to stop.
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
Set the linear problem that needs to be solved.
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
Base class for Belos::SolverManager subclasses which normally can only compile for real ScalarType.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
Set the linear problem that needs to be solved.
virtual ~SolverManagerRequiresLapack()
virtual ReturnType solve()
Iterate until the status test tells us to stop.
SolverManagerRequiresLapack()
virtual void reset(const ResetType type)
Reset the solver manager.
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().
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 > getCurrentParameters() const
Return the current parameters being used for this solver manager.
SolverManagerRequiresLapack()
virtual ~SolverManagerRequiresLapack()
Base class for Belos::SolverManager subclasses which normally can only compile with ScalarType types ...
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
virtual ~SolverManagerRequiresRealLapack()
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
SolverManagerRequiresRealLapack()
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const
Return a reference to the linear problem being solved by this solver manager.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &)
Set the linear problem that needs to be solved.
virtual ReturnType solve()
Iterate until the status test tells us to stop.
virtual void reset(const ResetType type)
Reset the solver manager.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
virtual ~SolverManagerRequiresRealLapack()
SolverManagerRequiresRealLapack()
Base class for Belos::SolverManager subclasses which normally can only compile with real ScalarType t...
A linear system to solve, and its associated information.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &, const typename StatusTestCombo< ScalarType, MV, OP >::ComboType &=StatusTestCombo< ScalarType, MV, OP >::SEQ)
Set user-defined convergence status test.
virtual ReturnType solve()=0
Iterate until the status test tells us to stop.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const =0
Return the current parameters being used for this solver manager.
virtual void reset(const ResetType type)=0
Reset the solver manager.
SolverManager()
Empty constructor.
virtual int getNumIters() const =0
Get the iteration count for the most recent call to solve().
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.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)=0
Set the linear problem that needs to be solved.
virtual Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const =0
clone the solver manager.
virtual bool isLOADetected() const =0
Returns whether a loss of accuracy was detected in the solver.
virtual ~SolverManager()
Destructor.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
Return a reference to the linear problem being solved by this solver manager.
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
virtual void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &)
Set user-defined debug status test.
A class for extending the status testing capabilities of Belos via logical combinations.
ComboType
The test can be either the AND of all the component tests, or the OR of all the component tests,...
A pure virtual class for defining the status tests for the Belos iterative solvers.
void registerLinearSolverFactory()
Register Belos' LinearSolverFactory with the central repository, for all enabled combinations of temp...
ReturnType
Whether the Belos solve converged for all linear systems.
ResetType
How to reset the solver.