11 #ifndef BELOS_STATUS_TEST_MAXITERS_HPP
12 #define BELOS_STATUS_TEST_MAXITERS_HPP
30 template <
class ScalarType,
class MV,
class OP>
85 void print(std::ostream& os,
int indent = 0)
const;
98 std::ostringstream oss;
120 template <
class ScalarType,
class MV,
class OP>
126 maxIters_ = maxIters;
132 template <
class ScalarType,
class MV,
class OP>
137 if (nIters_ >= maxIters_)
142 template <
class ScalarType,
class MV,
class OP>
149 template <
class ScalarType,
class MV,
class OP>
152 for (
int j = 0; j < indent; j ++)
154 printStatus(os, status_);
155 os <<
"Number of Iterations = ";
157 os << ((nIters_ < maxIters_) ?
" < " : ((nIters_ == maxIters_) ?
" == " :
" > "));
162 template <
class ScalarType,
class MV,
class OP>
165 os << std::left << std::setw(13) << std::setfill(
'.');
178 os << std::left << std::setfill(
' ');
StatusType getStatus() const
Return the result of the most recent CheckStatus call.
int getMaxIters() const
Returns the maximum number of iterations set in the constructor.
void print(std::ostream &os, int indent=0) const
Output formatted description of stopping test to output stream.
Pure virtual base class for defining the status testing capabilities of Belos.
void reset()
Resets the status test to the initial internal state.
A pure virtual class for defining the status tests for the Belos iterative solvers.
std::string description() const
Method to return description of the maximum iteration status test.
StatusType
Whether the StatusTest wants iteration to stop.
A Belos::StatusTest class for specifying a maximum number of iterations.
virtual int getNumIters() const =0
Get the current iteration count.
StatusType status_
Status.
StatusTestMaxIters(int maxIters)
Constructor.
int getNumIters() const
Returns the current number of iterations from the most recent StatusTest call.
void printStatus(std::ostream &os, StatusType type) const
Print message for each status specific to this stopping test.
StatusType checkStatus(Iteration< ScalarType, MV, OP > *iSolver)
Check convergence status of the iterative solver: Unconverged, Converged, Failed. ...
virtual ~StatusTestMaxIters()
Destructor.
int nIters_
Current number of iterations.
int maxIters_
Maximum number of iterations allowed.
void setMaxIters(int maxIters)
Sets the maximum number of iterations allowed.