AztecOO_StatusTestCombo: A class for extending the status testing capabilities of AztecOO via logical combinations. More...
#include <AztecOO_StatusTestCombo.h>
Public Types | |
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... | |
Public Member Functions | |
AztecOO_StatusTestCombo (ComboType t) | |
Constructor. | |
AztecOO_StatusTestCombo (ComboType t, AztecOO_StatusTest &a) | |
Constructor with a single test. | |
AztecOO_StatusTestCombo (ComboType t, AztecOO_StatusTest &a, AztecOO_StatusTest &b) | |
Constructor with two tests. | |
AztecOO_StatusTestCombo & | AddStatusTest (AztecOO_StatusTest &a) |
Add another test to this combination. | |
virtual | ~AztecOO_StatusTestCombo () |
Destructor. | |
bool | ResidualVectorRequired () const |
Indicates if residual vector is required by this convergence test. | |
AztecOO_StatusType | CheckStatus (int CurrentIter, Epetra_MultiVector *CurrentResVector, double CurrentResNormEst, bool SolutionUpdated) |
Check convergence status: Unconverged, Converged, Failed. | |
AztecOO_StatusType | GetStatus () const |
Return the result of the most recent checkStatus call. | |
ostream & | Print (ostream &stream, int indent=0) const |
Output formatted description of stopping test to output stream. | |
ComboType | GetComboType () const |
Returns the maximum number of iterations set in the constructor. | |
Protected Member Functions | |
void | OrOp (int CurrentIter, Epetra_MultiVector *CurrentResVector, double CurrentResNormEst, bool SolutionUpdated) |
Use this for checkStatus when this is an OR type combo. Updates status. | |
void | AndOp (int CurrentIter, Epetra_MultiVector *CurrentResVector, double CurrentResNormEst, bool SolutionUpdated) |
Use this for checkStatus when this is an AND type combo. Updates status. | |
void | SeqOp (int CurrentIter, Epetra_MultiVector *CurrentResVector, double CurrentResNormEst, bool SolutionUpdated) |
Use this for checkStatus when this is a sequential AND type combo. Updates status. | |
bool | IsSafe (AztecOO_StatusTest &a) |
AztecOO_StatusTestCombo: A class for extending the status testing capabilities of AztecOO via logical combinations.
AztecOO_StatusTestCombo is an interface that can be implemented to extend the convergence testing capabilities of AztecOO. This class supports composite tests. In this situation, two or more existing AztecOO_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 Unconverged, Failed or NaN, no other subtests are done, and the status is returned as Unconverged if the first test was Unconverged, 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 vector (the one produced by the iterative method) as the first subtest and define a second test using the explicitly computed residual 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.
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).
AztecOO_StatusType AztecOO_StatusTestCombo::CheckStatus | ( | int | CurrentIter, | |
Epetra_MultiVector * | CurrentResVector, | |||
double | CurrentResNormEst, | |||
bool | SolutionUpdated | |||
) | [virtual] |
Check convergence status: Unconverged, Converged, Failed.
This method checks to see if the convergence criteria are met. Depending on how the combined test is constructed this method will return the appropriate status type using common logic principals. However, if any subtest returns with a Failed status type, the combined test will return a status type of Failed.
CurrentIter | (In) Current iteration of iterative method. | |
CurrentResVector | (In) The current residuals of the iterative process. | |
CurrentResNormEst | (In) Estimate of the two-norm of the residual. The value will be set to -1.0 if no estimate is available. | |
SolutionUpdated | (In) If this argument is true, then the solution vector that is part of the Epetra_LinearProblem object being solved is consistent with the residual. |
Implements AztecOO_StatusTest.
References AND, AndOp(), OR, OrOp(), SeqOp(), and Unconverged.
bool AztecOO_StatusTestCombo::IsSafe | ( | AztecOO_StatusTest & | a | ) | [protected] |
Check whether or not it is safe to add a to the list of tests. This is necessary to avoid any infinite recursions.
References IsSafe().
Referenced by AddStatusTest(), and IsSafe().
bool AztecOO_StatusTestCombo::ResidualVectorRequired | ( | ) | const [virtual] |
Indicates if residual vector is required by this convergence test.
If this method returns true, then one or more of the AztecOO_StatusTest objects that make up this combined test requires the Residual Vector to perform its test.
Implements AztecOO_StatusTest.
References AztecOO_StatusTest::ResidualVectorRequired().