12#ifndef BELOS_STATUS_TEST_COMBO_H
13#define BELOS_STATUS_TEST_COMBO_H
58template <
class ScalarType,
class MV,
class OP>
63#ifndef DOXYGEN_SHOULD_SKIP_THIS
65 typedef std::vector< Teuchos::RCP<StatusTest<ScalarType,MV,OP> > >
st_vector;
66 typedef typename st_vector::iterator
iterator;
188template <
class ScalarType,
class MV,
class OP>
195template <
class ScalarType,
class MV,
class OP>
200 tests_.push_back(
test1);
204template <
class ScalarType,
class MV,
class OP>
210 tests_.push_back(
test1);
211 addStatusTest(
test2);
215template <
class ScalarType,
class MV,
class OP>
223 std::cout <<
"\n*** WARNING! ***\n";
224 std::cout <<
"This combo test currently consists of the following:\n";
225 this->print(std::cout,
indent);
226 std::cout <<
"Unable to add the following test:\n";
233template <
class ScalarType,
class MV,
class OP>
237 if (
test1.get() ==
this)
242 for (
iterator i = tests_.begin();
i != tests_.end(); ++
i) {
252template <
class ScalarType,
class MV,
class OP>
259 else if (type_ == AND)
267template <
class ScalarType,
class MV,
class OP>
281template <
class ScalarType,
class MV,
class OP>
297template <
class ScalarType,
class MV,
class OP>
327template <
class ScalarType,
class MV,
class OP>
350template <
class ScalarType,
class MV,
class OP>
354 this->printStatus(
os, status_);
355 os << ((type_ == OR) ?
"OR" : (type_ == AND) ?
"AND" :
"SEQ");
356 os <<
" Combination";
357 os <<
" -> " << std::endl;
Pure virtual base class for defining the status testing capabilities of Belos.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
A class for extending the status testing capabilities of Belos via logical combinations.
void seqOp(Iteration< ScalarType, MV, OP > *iSolver)
Use this for checkStatus when this is a sequential AND type combo. Updates status.
ComboType
The test can be either the AND of all the component tests, or the OR of all the component tests,...
void andOp(Iteration< ScalarType, MV, OP > *iSolver)
Use this for checkStatus when this is an AND type combo. Updates status.
ComboType getComboType() const
Return the type of combination (OR, AND, or SEQ).
StatusType getStatus() const
Return the result of the most recent checkStatus call.
void orOp(Iteration< ScalarType, MV, OP > *iSolver)
Use this for checkStatus when this is an OR type combo. Updates status.
bool isSafe(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1)
Check whether or not it is safe to add a to the list of tests.
StatusTestCombo< ScalarType, MV, OP > & addStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &add_test)
Add another test to this combination.
StatusType checkStatus(Iteration< ScalarType, MV, OP > *iSolver)
Check convergence status of the iterative solver.
StatusTestCombo(ComboType t)
Constructor.
virtual ~StatusTestCombo()
Destructor.
void print(std::ostream &os, int indent=0) const
Output formatted description of stopping test to output stream.
st_vector getStatusTests()
Return the vector of status tests.
void reset()
Resets all the status tests in this combination to their initial internal state.
A pure virtual class for defining the status tests for the Belos iterative solvers.
StatusType
Whether the StatusTest wants iteration to stop.