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>
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!");
220 template<
class ScalarType,
223 const bool isComplex = Teuchos::ScalarTraits<ScalarType>::isComplex>
227 template<
class ScalarType,
class MV,
class OP>
242 template<
class ScalarType,
class MV,
class OP>
253 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
254 "This solver is not implemented for complex ScalarType." );
257 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
258 "This solver is not implemented for complex ScalarType." );
261 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
262 "This solver is not implemented for complex ScalarType." );
265 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
266 "This solver is not implemented for complex ScalarType." );
269 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
270 "This solver is not implemented for complex ScalarType." );
273 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
274 "This solver is not implemented for complex ScalarType." );
276 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
277 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
278 "This solver is not implemented for complex ScalarType." );
281 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
282 "This solver is not implemented for complex ScalarType." );
285 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
286 "This solver is not implemented for complex ScalarType." );
294 template<
class ScalarType>
312 #ifdef HAVE_TEUCHOS_COMPLEX 316 const static bool value =
true;
320 class LapackSupportsScalar<std::complex<double> > {
322 const static bool value =
true;
324 #endif // HAVE_TEUCHOS_COMPLEX 330 template<
class ScalarType,
333 const bool lapackSupportsScalarType =
341 template<
class ScalarType,
class MV,
class OP>
355 template<
class ScalarType,
class MV,
class OP>
360 TEUCHOS_TEST_FOR_EXCEPTION
361 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 362 " types for which Teuchos::LAPACK does not have a valid implementation. " 363 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
368 TEUCHOS_TEST_FOR_EXCEPTION
369 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 370 " types for which Teuchos::LAPACK does not have a valid implementation. " 371 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
374 TEUCHOS_TEST_FOR_EXCEPTION
375 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 376 " types for which Teuchos::LAPACK does not have a valid implementation. " 377 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
380 TEUCHOS_TEST_FOR_EXCEPTION
381 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 382 " types for which Teuchos::LAPACK does not have a valid implementation. " 383 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
386 TEUCHOS_TEST_FOR_EXCEPTION
387 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 388 " types for which Teuchos::LAPACK does not have a valid implementation. " 389 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
392 TEUCHOS_TEST_FOR_EXCEPTION
393 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 394 " types for which Teuchos::LAPACK does not have a valid implementation. " 395 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
398 TEUCHOS_TEST_FOR_EXCEPTION
399 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 400 " types for which Teuchos::LAPACK does not have a valid implementation. " 401 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
403 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
404 TEUCHOS_TEST_FOR_EXCEPTION
405 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 406 " types for which Teuchos::LAPACK does not have a valid implementation. " 407 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
410 TEUCHOS_TEST_FOR_EXCEPTION
411 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 412 " types for which Teuchos::LAPACK does not have a valid implementation. " 413 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
416 TEUCHOS_TEST_FOR_EXCEPTION
417 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 418 " types for which Teuchos::LAPACK does not have a valid implementation. " 419 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
427 template<
class ScalarType,
430 const bool supportsScalarType =
432 ! Teuchos::ScalarTraits<ScalarType>::isComplex>
442 template<
class ScalarType,
class MV,
class OP>
457 template<
class ScalarType,
class MV,
class OP>
468 TEUCHOS_TEST_FOR_EXCEPTION
469 (
true, std::logic_error,
"This solver is not implemented for complex " 470 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 471 "does not have a valid implementation." 472 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
475 TEUCHOS_TEST_FOR_EXCEPTION
476 (
true, std::logic_error,
"This solver is not implemented for complex " 477 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 478 "does not have a valid implementation." 479 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
482 TEUCHOS_TEST_FOR_EXCEPTION
483 (
true, std::logic_error,
"This solver is not implemented for complex " 484 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 485 "does not have a valid implementation." 486 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
489 TEUCHOS_TEST_FOR_EXCEPTION
490 (
true, std::logic_error,
"This solver is not implemented for complex " 491 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 492 "does not have a valid implementation." 493 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
496 TEUCHOS_TEST_FOR_EXCEPTION
497 (
true, std::logic_error,
"This solver is not implemented for complex " 498 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 499 "does not have a valid implementation." 500 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
504 TEUCHOS_TEST_FOR_EXCEPTION
505 (
true, std::logic_error,
"This solver is not implemented for complex " 506 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 507 "does not have a valid implementation." 508 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
510 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
511 TEUCHOS_TEST_FOR_EXCEPTION
512 (
true, std::logic_error,
"This solver is not implemented for complex " 513 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 514 "does not have a valid implementation." 515 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
518 TEUCHOS_TEST_FOR_EXCEPTION
519 (
true, std::logic_error,
"This solver is not implemented for complex " 520 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 521 "does not have a valid implementation." 522 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
525 TEUCHOS_TEST_FOR_EXCEPTION
526 (
true, std::logic_error,
"This solver is not implemented for complex " 527 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 528 "does not have a valid implementation." 529 "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 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 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 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 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.
virtual void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &)
Set user-defined debug status test.
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 Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const =0
clone the 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.