10#ifndef BELOS_SOLVERMANAGER_HPP
11#define BELOS_SOLVERMANAGER_HPP
22#include "Teuchos_ParameterList.hpp"
23#include "Teuchos_RCP.hpp"
24#include "Teuchos_Describable.hpp"
34template <
class ScalarType,
class MV,
class OP,
class DM>
38template<
class ScalarType,
class MV,
class OP,
class DM = DefaultDenseMatrix<
int,ScalarType>>
55 virtual Teuchos::RCP<SolverManager<ScalarType, MV, OP, DM> >
clone ()
const = 0;
81 virtual typename Teuchos::ScalarTraits<ScalarType>::magnitudeType
achievedTol()
const {
121 <<
" overridden for the class" << this->description() <<
" yet!");
130 <<
" overridden for the class" << this->description() <<
" yet!");
190 const bool isComplex = Teuchos::ScalarTraits<ScalarType>::isComplex>
194 template<
class ScalarType,
class MV,
class OP,
class DM>
209 template<
class ScalarType,
class MV,
class OP,
class DM>
221 "This solver is not implemented for complex ScalarType." );
225 "This solver is not implemented for complex ScalarType." );
229 "This solver is not implemented for complex ScalarType." );
233 "This solver is not implemented for complex ScalarType." );
237 "This solver is not implemented for complex ScalarType." );
241 "This solver is not implemented for complex ScalarType." );
245 "This solver is not implemented for complex ScalarType." );
249 "This solver is not implemented for complex ScalarType." );
253 "This solver is not implemented for complex ScalarType." );
261 template<
class ScalarType>
279#ifdef HAVE_TEUCHOS_LONG_DOUBLE
283 const static bool value =
true;
288#ifdef HAVE_TEUCHOS_COMPLEX
290 class LapackSupportsScalar<std::
complex<float> > {
292 const static bool value =
true;
296 class LapackSupportsScalar<std::complex<double> > {
298 const static bool value =
true;
306 template<
class ScalarType,
309 class DM = DefaultDenseMatrix<int, ScalarType>,
310 const bool lapackSupportsScalarType =
318 template<
class ScalarType,
class MV,
class OP,
class DM>
332 template<
class ScalarType,
class MV,
class OP,
class DM>
338 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
339 " types for which Teuchos::LAPACK does not have a valid implementation. "
340 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
346 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
347 " types for which Teuchos::LAPACK does not have a valid implementation. "
348 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
352 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
353 " types for which Teuchos::LAPACK does not have a valid implementation. "
354 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
358 (
true, std::logic_error,
"This solver is not implemented for ScalarType"
359 " types for which Teuchos::LAPACK does not have a valid implementation. "
360 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
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 () <<
".");
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 () <<
".");
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 () <<
".");
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 () <<
".");
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 () <<
".");
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 () <<
".");
410 ! Teuchos::ScalarTraits<ScalarType>::isComplex>
420 template<
class ScalarType,
class MV,
class OP,
class DM>
435 template<
class ScalarType,
class MV,
class OP,
class DM>
447 (
true, std::logic_error,
"This solver is not implemented for complex "
448 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
449 "does not have a valid implementation."
450 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
454 (
true, std::logic_error,
"This solver is not implemented for complex "
455 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
456 "does not have a valid implementation."
457 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
461 (
true, std::logic_error,
"This solver is not implemented for complex "
462 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
463 "does not have a valid implementation."
464 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
468 (
true, std::logic_error,
"This solver is not implemented for complex "
469 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
470 "does not have a valid implementation."
471 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
475 (
true, std::logic_error,
"This solver is not implemented for complex "
476 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
477 "does not have a valid implementation."
478 "ScalarType = " << Teuchos::TypeNameTraits<ScalarType>::name () <<
".");
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 () <<
".");
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 () <<
".");
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 (
true, std::logic_error,
"This solver is not implemented for complex "
505 "ScalarType types, or for ScalarType types for which Teuchos::LAPACK "
506 "does not have a valid implementation."
507 "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 void reset(const ResetType type)
Reset the solver manager.
virtual int getNumIters() const
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 void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem)
Set the linear problem that needs to be solved.
virtual const LinearProblem< ScalarType, MV, OP, DM > & getProblem() const
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.
virtual ~RealSolverManager()
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.
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 for real ScalarType.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
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.
virtual ~SolverManagerRequiresLapack()
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
virtual const LinearProblem< ScalarType, MV, OP, DM > & 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, DM > > &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.
SolverManagerRequiresLapack()
virtual void reset(const ResetType type)
Reset the solver manager.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
SolverManagerRequiresLapack()
virtual ~SolverManagerRequiresLapack()
Base class for Belos::SolverManager subclasses which normally can only compile with ScalarType types ...
virtual void reset(const ResetType type)
Reset the solver manager.
virtual int getNumIters() const
Get the iteration count for the most recent call to solve().
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Return the current parameters being used for this solver manager.
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 const LinearProblem< ScalarType, MV, OP, DM > & 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, DM > > &)
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.
virtual void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters to use when solving the linear problem.
virtual ~SolverManagerRequiresRealLapack()
SolverManagerRequiresRealLapack()
virtual ~SolverManagerRequiresRealLapack()
SolverManagerRequiresRealLapack()
Base class for Belos::SolverManager subclasses which normally can only compile with real ScalarType t...
Alternative run-time polymorphic interface for operators.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
virtual void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &)
Set user-defined debug status test.
virtual void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem)=0
Set the linear problem that needs to be solved.
virtual Teuchos::ScalarTraits< ScalarType >::magnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
virtual ReturnType solve()=0
Iterate until the status test tells us to stop.
virtual void reset(const ResetType type)=0
Reset the solver manager.
virtual bool isLOADetected() const =0
Returns whether a loss of accuracy was detected in the solver.
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &, const typename StatusTestCombo< ScalarType, MV, OP, DM >::ComboType &=StatusTestCombo< ScalarType, MV, OP, DM >::SEQ)
Set user-defined convergence status test.
virtual const LinearProblem< ScalarType, MV, OP, DM > & getProblem() const =0
Return a reference to the linear problem being solved by this solver manager.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const =0
Return the valid parameters for this solver manager.
SolverManager()
Empty constructor.
virtual Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const =0
Return the current parameters being used for this solver manager.
virtual ~SolverManager()
Destructor.
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< SolverManager< ScalarType, MV, OP, DM > > clone() const =0
clone the solver manager.
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,...
ReturnType
Whether the Belos solve converged for all linear systems.
ResetType
How to reset the solver.