Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosCGIteration.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Belos: Block Linear Solvers Package
4 //
5 // Copyright 2004-2016 NTESS and the Belos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef BELOS_CG_ITERATION_HPP
11 #define BELOS_CG_ITERATION_HPP
12 
17 #include "BelosConfigDefs.hpp"
18 #include "BelosTypes.hpp"
19 #include "BelosIteration.hpp"
20 
21 namespace Belos {
22 
24 
25 
30  template <class ScalarType, class MV>
32 
35 
38 
41 
44 
45  CGIterationState() : R(Teuchos::null), Z(Teuchos::null),
46  P(Teuchos::null), AP(Teuchos::null)
47  {}
48  };
49 
51 
52 
64  class CGIterationInitFailure : public BelosError {public:
65  CGIterationInitFailure(const std::string& what_arg) : BelosError(what_arg)
66  {}};
67 
74  class CGIterateFailure : public BelosError {public:
75  CGIterateFailure(const std::string& what_arg) : BelosError(what_arg)
76  {}};
77 
84  CGPositiveDefiniteFailure(const std::string& what_arg) : CGIterateFailure(what_arg)
85  {}};
86 
93  class CGIterationOrthoFailure : public BelosError {public:
94  CGIterationOrthoFailure(const std::string& what_arg) : BelosError(what_arg)
95  {}};
96 
103  class CGIterationLAPACKFailure : public BelosError {public:
104  CGIterationLAPACKFailure(const std::string& what_arg) : BelosError(what_arg)
105  {}};
106 
108 
109 
110 template<class ScalarType, class MV, class OP>
111 class CGIteration : virtual public Iteration<ScalarType,MV,OP> {
112 
113  public:
114 
116 
117 
131  virtual void initializeCG(CGIterationState<ScalarType,MV>& newstate) = 0;
132 
139  virtual CGIterationState<ScalarType,MV> getState() const = 0;
141 
142 
144  virtual void setDoCondEst(bool val) = 0;
145 
148 
151 
152 };
153 
154 } // end Belos namespace
155 
156 #endif /* BELOS_CG_ITERATION_HPP */
Teuchos::RCP< const MV > R
The current residual.
Collection of types and exceptions used within the Belos solvers.
CGIterateFailure(const std::string &what_arg)
CGIterationOrthoFailure(const std::string &what_arg)
virtual void initializeCG(CGIterationState< ScalarType, MV > &newstate)=0
Initialize the solver to an iterate, providing a complete state.
Structure to contain pointers to CGIteration state variables.
virtual void setDoCondEst(bool val)=0
Sets whether or not to store the diagonal for condition estimation.
Pure virtual base class which describes the basic interface to the linear solver iteration.
CGIterateFailure is thrown when the CGIteration object is unable to compute the next iterate in the C...
virtual Teuchos::ArrayView< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > getDiag()=0
Gets the diagonal for condition estimation.
Teuchos::RCP< const MV > AP
The matrix A applied to current decent direction vector.
CGPositiveDefiniteFailure is thrown when the the CG &#39;alpha = p^H*A*P&#39; value is less than zero...
CGIterationLAPACKFailure is thrown when a nonzero return value is passed back from an LAPACK routine...
virtual Teuchos::ArrayView< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > getOffDiag()=0
Gets the off-diagonal for condition estimation.
Teuchos::RCP< const MV > Z
The current preconditioned residual.
CGIterationOrthoFailure is thrown when the CGIteration object is unable to compute independent direct...
CGIterationLAPACKFailure(const std::string &what_arg)
CGPositiveDefiniteFailure(const std::string &what_arg)
CGIterationInitFailure is thrown when the CGIteration object is unable to generate an initial iterate...
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:28
virtual CGIterationState< ScalarType, MV > getState() const =0
Get the current state of the linear solver.
Belos header file which uses auto-configuration information to include necessary C++ headers...
CGIterationInitFailure(const std::string &what_arg)
Teuchos::RCP< const MV > P
The current decent direction vector.

Generated on Fri Nov 22 2024 09:23:06 for Belos by doxygen 1.8.5