43 #ifndef BELOS_SOLVERMANAGER_HPP 44 #define BELOS_SOLVERMANAGER_HPP 54 #include "Teuchos_ParameterList.hpp" 55 #include "Teuchos_RCP.hpp" 56 #include "Teuchos_Describable.hpp" 66 template <
class ScalarType,
class MV,
class OP>
70 template<
class ScalarType,
class MV,
class OP>
108 virtual typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
achievedTol()
const {
109 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"achievedTol() not implemented");
138 virtual void setParameters(
const Teuchos::RCP<Teuchos::ParameterList> ¶ms ) = 0;
145 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setUserConvStatusTest() has not been" 146 <<
" overridden for the class" << this->description() <<
" yet!");
154 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setDebugStatusTest() has not been" 155 <<
" overridden for the class" << this->description() <<
" yet!");
212 template<
class ScalarType,
215 const bool isComplex = Teuchos::ScalarTraits<ScalarType>::isComplex>
219 template<
class ScalarType,
class MV,
class OP>
234 template<
class ScalarType,
class MV,
class OP>
239 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
240 "This solver is not implemented for complex ScalarType." );
245 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
246 "This solver is not implemented for complex ScalarType." );
249 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
250 "This solver is not implemented for complex ScalarType." );
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." );
268 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
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." );
277 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
278 "This solver is not implemented for complex ScalarType." );
286 template<
class ScalarType>
289 const static bool value =
false;
295 const static bool value =
true;
301 const static bool value =
true;
304 #ifdef HAVE_TEUCHOS_COMPLEX 308 const static bool value =
true;
314 const static bool value =
true;
316 #endif // HAVE_TEUCHOS_COMPLEX 322 template<
class ScalarType,
325 const bool lapackSupportsScalarType =
333 template<
class ScalarType,
class MV,
class OP>
347 template<
class ScalarType,
class MV,
class OP>
352 TEUCHOS_TEST_FOR_EXCEPTION
353 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 354 " types for which Teuchos::LAPACK does not have a valid implementation. " 355 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
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 () <<
".");
366 TEUCHOS_TEST_FOR_EXCEPTION
367 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 368 " types for which Teuchos::LAPACK does not have a valid implementation. " 369 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
372 TEUCHOS_TEST_FOR_EXCEPTION
373 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 374 " types for which Teuchos::LAPACK does not have a valid implementation. " 375 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
378 TEUCHOS_TEST_FOR_EXCEPTION
379 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 380 " types for which Teuchos::LAPACK does not have a valid implementation. " 381 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
384 TEUCHOS_TEST_FOR_EXCEPTION
385 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 386 " types for which Teuchos::LAPACK does not have a valid implementation. " 387 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
390 TEUCHOS_TEST_FOR_EXCEPTION
391 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 392 " types for which Teuchos::LAPACK does not have a valid implementation. " 393 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
395 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
396 TEUCHOS_TEST_FOR_EXCEPTION
397 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 398 " types for which Teuchos::LAPACK does not have a valid implementation. " 399 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
402 TEUCHOS_TEST_FOR_EXCEPTION
403 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 404 " types for which Teuchos::LAPACK does not have a valid implementation. " 405 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
408 TEUCHOS_TEST_FOR_EXCEPTION
409 (
true, std::logic_error,
"This solver is not implemented for ScalarType" 410 " types for which Teuchos::LAPACK does not have a valid implementation. " 411 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
419 template<
class ScalarType,
422 const bool supportsScalarType =
424 ! Teuchos::ScalarTraits<ScalarType>::isComplex>
434 template<
class ScalarType,
class MV,
class OP>
449 template<
class ScalarType,
class MV,
class OP>
454 TEUCHOS_TEST_FOR_EXCEPTION
455 (
true, std::logic_error,
"This solver is not implemented for complex " 456 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 457 "does not have a valid implementation." 458 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
463 TEUCHOS_TEST_FOR_EXCEPTION
464 (
true, std::logic_error,
"This solver is not implemented for complex " 465 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 466 "does not have a valid implementation." 467 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
470 TEUCHOS_TEST_FOR_EXCEPTION
471 (
true, std::logic_error,
"This solver is not implemented for complex " 472 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 473 "does not have a valid implementation." 474 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
477 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
484 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
491 TEUCHOS_TEST_FOR_EXCEPTION
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 TEUCHOS_TEST_FOR_EXCEPTION
500 (
true, std::logic_error,
"This solver is not implemented for complex " 501 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 502 "does not have a valid implementation." 503 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
505 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
506 TEUCHOS_TEST_FOR_EXCEPTION
507 (
true, std::logic_error,
"This solver is not implemented for complex " 508 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK " 509 "does not have a valid implementation." 510 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
513 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
520 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
Collection of types and exceptions used within the Belos solvers.
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 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 Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters 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 ReturnType solve()
Iterate until the status test tells us to stop.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used 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.
SolverManager()
Empty constructor.
virtual ~RealSolverManager()
virtual ~RealSolverManager()
Base class for Belos::SolverManager subclasses which normally can only compile with real ScalarType t...
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
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.
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 bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
A pure virtual class for defining the status tests for the Belos iterative solvers.
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &userConvStatusTest)
Set user-defined convergence status test.
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 ~SolverManagerRequiresRealLapack()
virtual bool isLOADetected() const
Returns whether a loss of accuracy was detected in the solver.
virtual void reset(const ResetType type)
Reset the solver manager.
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
virtual const LinearProblem< ScalarType, MV, OP > & getProblem() const =0
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 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 Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
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.
SolverManagerRequiresRealLapack()
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return the valid parameters for this solver manager.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
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 ~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 int getNumIters() const
Get the iteration count for the most recent call to solve().
virtual bool isLOADetected() const =0
Returns whether a loss of accuracy was detected in the solver.
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 ...
Belos header file which uses auto-configuration information to include necessary C++ headers...
virtual ~SolverManager()
Destructor.