Belos Package Browser (Single Doxygen Collection)
Development
|
A class for extending the status testing capabilities of Belos via logical combinations. More...
#include <BelosStatusTestCombo.hpp>
Enums | |
enum | ComboType { AND, OR, SEQ } |
The test can be either the AND of all the component tests, or the OR of all the component tests, or a sequential AND (SEQ). More... | |
Constructors / Destructor | |
StatusTestCombo (ComboType t) | |
Constructor. More... | |
StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1) | |
Single test constructor. More... | |
StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test2) | |
Dual test constructor. More... | |
StatusTestCombo< ScalarType, MV, OP > & | addStatusTest (const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &add_test) |
Add another test to this combination. More... | |
virtual | ~StatusTestCombo () |
Destructor. More... | |
Status methods | |
StatusType | checkStatus (Iteration< ScalarType, MV, OP > *iSolver) |
Check convergence status of the iterative solver. More... | |
StatusType | getStatus () const |
Return the result of the most recent checkStatus call. More... | |
Reset methods | |
void | reset () |
Resets all the status tests in this combination to their initial internal state. More... | |
Accessor methods | |
ComboType | getComboType () const |
Return the type of combination (OR, AND, or SEQ). More... | |
st_vector | getStatusTests () |
Return the vector of status tests. More... | |
Print methods | |
void | print (std::ostream &os, int indent=0) const |
Output formatted description of stopping test to output stream. More... | |
Internal methods. | |
void | orOp (Iteration< ScalarType, MV, OP > *iSolver) |
Use this for checkStatus when this is an OR type combo. Updates status. More... | |
void | andOp (Iteration< ScalarType, MV, OP > *iSolver) |
Use this for checkStatus when this is an AND type combo. Updates status. More... | |
void | seqOp (Iteration< ScalarType, MV, OP > *iSolver) |
Use this for checkStatus when this is a sequential AND type combo. Updates status. More... | |
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. More... | |
Private data members. | |
ComboType | type_ |
The type of combination (OR, AND, or SEQ) More... | |
st_vector | tests_ |
Vector of generic status tests. More... | |
StatusType | status_ |
The current status. More... | |
Additional Inherited Members | |
Public Member Functions inherited from Belos::StatusTest< ScalarType, MV, OP > | |
StatusTest () | |
Constructor. More... | |
virtual | ~StatusTest () |
Destructor. More... | |
virtual void | printStatus (std::ostream &os, StatusType type) const |
Output the result of the most recent CheckStatus call. More... | |
Public Member Functions inherited from Teuchos::Describable | |
DescribableStreamManipulatorState | describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default) |
std::ostream & | operator<< (std::ostream &os, const DescribableStreamManipulatorState &d) |
virtual std::string | description () const |
virtual void | describe (FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const |
void | describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const |
virtual | ~Describable () |
LabeledObject () | |
virtual | ~LabeledObject () |
virtual void | setObjectLabel (const std::string &objectLabel) |
virtual std::string | getObjectLabel () const |
Static Public Attributes inherited from Teuchos::Describable | |
static const EVerbosityLevel | verbLevel_default |
A class for extending the status testing capabilities of Belos via logical combinations.
StatusTestCombo is an interface that can be implemented to extend the convergence testing capabilities of Belos. This class supports composite tests. In this situation, two or more existing StatusTestCombo objects test1 and test2 can be used to create a new test. For all combinations, if any tests returns Failed or returns not-a-number (NaN) status, then the combination test returns Failed. There are three possible combinations:
SEQ combination: SEQ is a form of AND that will perform subtests in sequence. If the first test returns Passed, Failed or Undefined, no other subtests are done, and the status is returned as Failed if the first test was Failed, or as Failed if the first test was Failed or NaN. If the first test returns Converged, the second test is checked in the same fashion as the first. If the second test is Converged, the third one is tested, and so on.
The purpose of the SEQ combination is to allow the addition of expensive but more rigorous convergence tests. For example, we could define a test that used the implicit residual std::vector (the one produced by the iterative method) as the first subtest and define a second test using the explicitly computed residual std::vector. Explicitly computing the residual requires a matrix multiplication with the original matrix operator, an expensive operation. By using the SEQ combination, we can avoid the matrix multiplication associated with the explicit residual calculation until the implicit residual is small.
Definition at line 91 of file BelosStatusTestCombo.hpp.
enum Belos::StatusTestCombo::ComboType |
The test can be either the AND of all the component tests, or the OR of all the component tests, or a sequential AND (SEQ).
Definition at line 109 of file BelosStatusTestCombo.hpp.
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo | ( | ComboType | t | ) |
Constructor.
Definition at line 221 of file BelosStatusTestCombo.hpp.
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo | ( | ComboType | t, |
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | test1 | ||
) |
Single test constructor.
Definition at line 228 of file BelosStatusTestCombo.hpp.
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo | ( | ComboType | t, |
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | test1, | ||
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | test2 | ||
) |
Dual test constructor.
Definition at line 237 of file BelosStatusTestCombo.hpp.
|
inlinevirtual |
Destructor.
Definition at line 137 of file BelosStatusTestCombo.hpp.
StatusTestCombo< ScalarType, MV, OP > & Belos::StatusTestCombo< ScalarType, MV, OP >::addStatusTest | ( | const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | add_test | ) |
Add another test to this combination.
Only add the test if doing so would not in infinite recursion.
Definition at line 248 of file BelosStatusTestCombo.hpp.
|
virtual |
Check convergence status of the iterative solver.
Return one of the following values: Passed (the convergence criteria are met), Failed (they are not met) or Undefined (we can't tell).
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 285 of file BelosStatusTestCombo.hpp.
|
inlinevirtual |
Return the result of the most recent checkStatus call.
If checkStatus has not yet been called, return the default status.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 153 of file BelosStatusTestCombo.hpp.
|
virtual |
Resets all the status tests in this combination to their initial internal state.
This should be done when the status test is being reused with another solver or linear problem.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 300 of file BelosStatusTestCombo.hpp.
|
inline |
Return the type of combination (OR, AND, or SEQ).
Definition at line 171 of file BelosStatusTestCombo.hpp.
|
inline |
Return the vector of status tests.
Definition at line 174 of file BelosStatusTestCombo.hpp.
|
virtual |
Output formatted description of stopping test to output stream.
Implements Belos::StatusTest< ScalarType, MV, OP >.
Definition at line 383 of file BelosStatusTestCombo.hpp.
|
protected |
Use this for checkStatus when this is an OR type combo. Updates status.
Definition at line 314 of file BelosStatusTestCombo.hpp.
|
protected |
Use this for checkStatus when this is an AND type combo. Updates status.
Definition at line 330 of file BelosStatusTestCombo.hpp.
|
protected |
Use this for checkStatus when this is a sequential AND type combo. Updates status.
Definition at line 360 of file BelosStatusTestCombo.hpp.
|
protected |
Check whether or not it is safe to add a to the list of tests.
This is necessary to avoid any infinite recursions.
Definition at line 266 of file BelosStatusTestCombo.hpp.
|
private |
The type of combination (OR, AND, or SEQ)
Definition at line 209 of file BelosStatusTestCombo.hpp.
|
private |
Vector of generic status tests.
Definition at line 212 of file BelosStatusTestCombo.hpp.
|
private |
The current status.
Definition at line 215 of file BelosStatusTestCombo.hpp.