#include <NOX_StatusTest_Combo.H>
Public Types | |
enum | ComboType { AND, OR } |
The test can be either the AND of all the component tests, or the OR of all the component tests. More... | |
Public Member Functions | |
Combo (ComboType t, const NOX::Utils *u=NULL) | |
Constructor. Optional argument is the error stream for output. | |
Combo (ComboType t, const Teuchos::RCP< Generic > &a, const NOX::Utils *u=NULL) | |
Constructor with a single test. | |
Combo (ComboType t, const Teuchos::RCP< Generic > &a, const Teuchos::RCP< Generic > &b, const NOX::Utils *u=NULL) | |
Constructor with two tests. | |
virtual Combo & | addStatusTest (const Teuchos::RCP< Generic > &a) |
Add another test to this combination. | |
virtual | ~Combo () |
Destructor. | |
virtual StatusType | checkStatus (const NOX::Solver::Generic &problem, NOX::StatusTest::CheckType checkType) |
Tests stopping criterion. | |
virtual StatusType | getStatus () const |
Return the result of the most recent checkStatus call. | |
virtual ostream & | print (ostream &stream, int indent=0) const |
Output formatted description of stopping test to output stream. | |
Protected Member Functions | |
virtual void | orOp (const Solver::Generic &problem, NOX::StatusTest::CheckType checkType) |
Use this for checkStatus when this is an OR type combo. Updates NOX::StatusTest::Combo::status. | |
virtual void | andOp (const Solver::Generic &problem, NOX::StatusTest::CheckType checkType) |
Use this for checkStatus when this is an AND type combo. Updates NOX::StatusTest::Combo::status. | |
bool | isSafe (Generic &a) |
Check whether or not it is safe to add a to this list of tests. | |
Private Attributes | |
const ComboType | type |
Type of test. | |
vector< Teuchos::RCP< Generic > > | tests |
Vector of generic status tests. | |
StatusType | status |
Status | |
NOX::Utils | utils |
Ostream used to print errors. |
In the AND
(see NOX::StatusTest::Combo::ComboType) combination, the result is Unconverged
(see NOX::StatusTest::StatusType) if any of the tests is Unconverged
. Otherwise, the result is equal to the result of the first test in the list that is either Converged
or Failed
. It is not recommended to mix Converged
and Failed
tests in an AND
combination.
In the OR
combination, the result is Unconverged
if all of the tests are Unconverged
. Otherwise, it is the result of the first test in the list that is either Converged
or Failed
. Therefore, it will generally make sense to put the Failed
-type tests at the end of the OR
list.
Definition at line 74 of file NOX_StatusTest_Combo.H.
The test can be either the AND of all the component tests, or the OR of all the component tests.
AND | Logically "AND" together the results of the tests in this combination. |
OR | Logically "OR" together the results of the tests in this combination. |
Definition at line 82 of file NOX_StatusTest_Combo.H.
NOX::StatusTest::Combo::Combo | ( | ComboType | t, | |
const NOX::Utils * | u = NULL | |||
) |
Constructor. Optional argument is the error stream for output.
Definition at line 46 of file NOX_StatusTest_Combo.C.
References status, NOX::StatusTest::Unevaluated, and utils.
NOX::StatusTest::Combo::Combo | ( | ComboType | t, | |
const Teuchos::RCP< Generic > & | a, | |||
const NOX::Utils * | u = NULL | |||
) |
Constructor with a single test.
Definition at line 57 of file NOX_StatusTest_Combo.C.
References status, tests, NOX::StatusTest::Unevaluated, and utils.
NOX::StatusTest::Combo::Combo | ( | ComboType | t, | |
const Teuchos::RCP< Generic > & | a, | |||
const Teuchos::RCP< Generic > & | b, | |||
const NOX::Utils * | u = NULL | |||
) |
Constructor with two tests.
Definition at line 71 of file NOX_StatusTest_Combo.C.
References addStatusTest(), status, tests, NOX::StatusTest::Unevaluated, and utils.
NOX::StatusTest::Combo::~Combo | ( | ) | [virtual] |
NOX::StatusTest::Combo & NOX::StatusTest::Combo::addStatusTest | ( | const Teuchos::RCP< Generic > & | a | ) | [virtual] |
Add another test to this combination.
Calls isSafe() to determine if it is safe to add a
to the combination.
Definition at line 86 of file NOX_StatusTest_Combo.C.
References NOX::Utils::err(), isSafe(), print(), tests, and utils.
Referenced by Combo().
NOX::StatusTest::StatusType NOX::StatusTest::Combo::checkStatus | ( | const NOX::Solver::Generic & | problem, | |
NOX::StatusTest::CheckType | checkType | |||
) | [virtual] |
Tests stopping criterion.
See addOp() and orOp() for details.
Implements NOX::StatusTest::Generic.
Definition at line 129 of file NOX_StatusTest_Combo.C.
NOX::StatusTest::StatusType NOX::StatusTest::Combo::getStatus | ( | ) | const [virtual] |
Return the result of the most recent checkStatus call.
Implements NOX::StatusTest::Generic.
Definition at line 140 of file NOX_StatusTest_Combo.C.
References status.
ostream & NOX::StatusTest::Combo::print | ( | ostream & | stream, | |
int | indent = 0 | |||
) | const [virtual] |
Output formatted description of stopping test to output stream.
Implements NOX::StatusTest::Generic.
Definition at line 212 of file NOX_StatusTest_Combo.C.
References OR, status, tests, and type.
Referenced by addStatusTest().
void NOX::StatusTest::Combo::orOp | ( | const Solver::Generic & | problem, | |
NOX::StatusTest::CheckType | checkType | |||
) | [protected, virtual] |
Use this for checkStatus when this is an OR type combo. Updates NOX::StatusTest::Combo::status.
If there is a combination of NOX::StatusTest::Failed and NOX::StatusTest::Converged in the tests that are OR'd together, the value of status for this test is set to the status of the first test it encounters which is not NOX::Status::Unconvered. The tests are evaluated in the order that they were added to the combination.
Definition at line 145 of file NOX_StatusTest_Combo.C.
References NOX::StatusTest::Minimal, NOX::StatusTest::None, status, tests, NOX::StatusTest::Unconverged, and NOX::StatusTest::Unevaluated.
Referenced by checkStatus().
void NOX::StatusTest::Combo::andOp | ( | const Solver::Generic & | problem, | |
NOX::StatusTest::CheckType | checkType | |||
) | [protected, virtual] |
Use this for checkStatus when this is an AND type combo. Updates NOX::StatusTest::Combo::status.
If any tests are NOX::StatusTest::Unconverged, then the status of this test is NOX::StatusTest::Unconverged. If there is a combination of NOX::StatusTest::Failed and NOX::StatusTest::Converged in the tests that are AND'd together, the value of status for this test is set to the status of the first test it encounters. The tests are evaluated in the order that they were added to the combination.
Definition at line 173 of file NOX_StatusTest_Combo.C.
References NOX::StatusTest::Minimal, NOX::StatusTest::None, status, tests, NOX::StatusTest::Unconverged, and NOX::StatusTest::Unevaluated.
Referenced by checkStatus().
bool NOX::StatusTest::Combo::isSafe | ( | Generic & | a | ) | [protected] |
Check whether or not it is safe to add a
to this list of tests.
This is necessary to avoid any infinite recursions (i.e., a test cannot own a copy of itself).
Definition at line 103 of file NOX_StatusTest_Combo.C.
References isSafe(), and tests.
Referenced by addStatusTest(), and isSafe().
const ComboType NOX::StatusTest::Combo::type [private] |
Type of test.
Definition at line 170 of file NOX_StatusTest_Combo.H.
Referenced by checkStatus(), and print().
vector<Teuchos::RCP<Generic> > NOX::StatusTest::Combo::tests [private] |
Vector of generic status tests.
Definition at line 173 of file NOX_StatusTest_Combo.H.
Referenced by addStatusTest(), andOp(), Combo(), isSafe(), orOp(), and print().
StatusType NOX::StatusTest::Combo::status [private] |
Status
Definition at line 176 of file NOX_StatusTest_Combo.H.
Referenced by andOp(), checkStatus(), Combo(), getStatus(), orOp(), and print().
NOX::Utils NOX::StatusTest::Combo::utils [private] |
Ostream used to print errors.
Definition at line 179 of file NOX_StatusTest_Combo.H.
Referenced by addStatusTest(), and Combo().