Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosStatusTest.hpp
Go to the documentation of this file.
1 
2 // @HEADER
3 // *****************************************************************************
4 // Belos: Block Linear Solvers Package
5 //
6 // Copyright 2004-2016 NTESS and the Belos contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 //
11 
12 #ifndef BELOS_STATUS_TEST_HPP
13 #define BELOS_STATUS_TEST_HPP
14 
20 #include "BelosTypes.hpp"
21 #include "BelosIteration.hpp"
22 #include "BelosConfigDefs.hpp"
23 #include "Teuchos_Describable.hpp"
24 
34 namespace Belos {
35 
37 
38 
41  class StatusTestError : public BelosError
42  {public: StatusTestError(const std::string& what_arg) : BelosError(what_arg) {}};
43 
45  {public: StatusTestNaNError(const std::string& what_arg) : StatusTestError(what_arg) {}};
46 
48 
49 template <class ScalarType, class MV, class OP>
50 class StatusTest : public Teuchos::Describable {
51 
52  public:
54 
55 
57  StatusTest() {};
58 
60  virtual ~StatusTest() {};
62 
64 
65 
74  virtual StatusType checkStatus( Iteration<ScalarType,MV,OP>* iSolver ) = 0;
75 
77  virtual StatusType getStatus() const = 0;
79 
81 
82 
88  virtual void reset() = 0;
90 
92 
93 
95  virtual void print(std::ostream& os, int indent = 0) const = 0;
96 
98  virtual void printStatus(std::ostream& os, StatusType type) const {
99  os << std::left << std::setw(13) << std::setfill('.');
100  switch (type) {
101  case Passed:
102  os << "Passed";
103  break;
104  case Failed:
105  os << "Failed";
106  break;
107  case Undefined:
108  default:
109  os << "**";
110  break;
111  }
112  os << std::left << std::setfill(' ');
113  return;
114  };
116 
117 };
118 
119 } // end of Belos namespace
120 
121 #endif /* BELOS_STATUS_TEST_HPP */
Collection of types and exceptions used within the Belos solvers.
Exception thrown to signal error in a status test during Belos::StatusTest::checkStatus().
StatusTest()
Constructor.
Pure virtual base class which describes the basic interface to the linear solver iteration.
virtual StatusType checkStatus(Iteration< ScalarType, MV, OP > *iSolver)=0
Check convergence status: Unconverged, Converged, Failed.
A pure virtual class for defining the status tests for the Belos iterative solvers.
StatusType
Whether the StatusTest wants iteration to stop.
Definition: BelosTypes.hpp:157
virtual void print(std::ostream &os, int indent=0) const =0
Output formatted description of stopping test to output stream.
virtual ~StatusTest()
Destructor.
StatusTestNaNError(const std::string &what_arg)
BelosError(const std::string &what_arg)
Definition: BelosTypes.hpp:30
StatusTestError(const std::string &what_arg)
virtual void reset()=0
Informs the convergence test that it should reset its internal configuration to the initialized state...
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:28
virtual StatusType getStatus() const =0
Return the result of the most recent CheckStatus call.
virtual void printStatus(std::ostream &os, StatusType type) const
Output the result of the most recent CheckStatus call.
Belos header file which uses auto-configuration information to include necessary C++ headers...

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