43 #ifndef BELOS_STATUS_TEST_MAXITERS_HPP
44 #define BELOS_STATUS_TEST_MAXITERS_HPP
62 template <
class ScalarType,
class MV,
class OP>
117 void print(std::ostream& os,
int indent = 0)
const;
130 std::ostringstream oss;
152 template <
class ScalarType,
class MV,
class OP>
158 maxIters_ = maxIters;
164 template <
class ScalarType,
class MV,
class OP>
169 if (nIters_ >= maxIters_)
174 template <
class ScalarType,
class MV,
class OP>
181 template <
class ScalarType,
class MV,
class OP>
184 for (
int j = 0; j < indent; j ++)
186 printStatus(os, status_);
187 os <<
"Number of Iterations = ";
189 os << ((nIters_ < maxIters_) ?
" < " : ((nIters_ == maxIters_) ?
" == " :
" > "));
194 template <
class ScalarType,
class MV,
class OP>
197 os << std::left << std::setw(13) << std::setfill(
'.');
210 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.