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 {
82 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"achievedTol() not implemented");
111 virtual void setParameters(
const Teuchos::RCP<Teuchos::ParameterList> ¶ms ) = 0;
120 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setUserConvStatusTest() has not been"
121 <<
" overridden for the class" << this->description() <<
" yet!");
129 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Error, the function setDebugStatusTest() has not been"
130 <<
" overridden for the class" << this->description() <<
" yet!");
186 template<
class ScalarType,
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>
220 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
221 "This solver is not implemented for complex ScalarType." );
224 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
225 "This solver is not implemented for complex ScalarType." );
228 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
229 "This solver is not implemented for complex ScalarType." );
232 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
233 "This solver is not implemented for complex ScalarType." );
236 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
237 "This solver is not implemented for complex ScalarType." );
240 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
241 "This solver is not implemented for complex ScalarType." );
243 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
244 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
245 "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." );
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,
310 const bool lapackSupportsScalarType =
318 template<
class ScalarType,
class MV,
class OP,
class DM>
332 template<
class ScalarType,
class MV,
class OP,
class DM>
337 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
345 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
351 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
357 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
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 () <<
".");
380 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
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 () <<
".");
404 template<
class ScalarType,
408 const bool supportsScalarType =
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>
446 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
453 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
460 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
467 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
474 TEUCHOS_TEST_FOR_EXCEPTION
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 () <<
".");
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 () <<
".");
488 virtual void setParameters (
const Teuchos::RCP<Teuchos::ParameterList>& params) {
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 () <<
".");
503 TEUCHOS_TEST_FOR_EXCEPTION
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...
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.
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.
ReturnType
Whether the Belos solve converged for all linear systems.
ResetType
How to reset the solver.
Teuchos::SerialDenseMatrix< Ordinal, Scalar > DefaultDenseMatrix