AztecOO  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members
AztecOO_StatusTestCombo Class Reference

AztecOO_StatusTestCombo: A class for extending the status testing capabilities of AztecOO via logical combinations. More...

#include <AztecOO_StatusTestCombo.h>

Inheritance diagram for AztecOO_StatusTestCombo:
Inheritance graph
[legend]
Collaboration diagram for AztecOO_StatusTestCombo:
Collaboration graph
[legend]

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_StatusTestComboAddStatusTest (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. More...
 
AztecOO_StatusType CheckStatus (int CurrentIter, Epetra_MultiVector *CurrentResVector, double CurrentResNormEst, bool SolutionUpdated)
 Check convergence status: Unconverged, Converged, Failed. More...
 
AztecOO_StatusType GetStatus () const
 Return the result of the most recent checkStatus call.
 
std::ostream & Print (std::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.
 
- Public Member Functions inherited from AztecOO_StatusTest
virtual void PrintStatus (std::ostream &os, AztecOO_StatusType type) const
 
 AztecOO_StatusTest ()
 Constructor.
 
virtual ~AztecOO_StatusTest ()
 Destructor.
 

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)
 

Detailed Description

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:

  1. OR combination: If an OR combination is selected, the status returns Converged if any one of the subtest returns as Converged.
  2. AND combination: If an AND combination is selected, the status returns Converged only when all subtests return as Converged.
  3. 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.

Warning
Presently it is not valid to associate one status test instance with two different AztecOO objects.

Member Enumeration Documentation

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).

Enumerator
AND 

Require all subtests to be satisfied.

OR 

Require one or the other subtests to be satisfied.

SEQ 

Requires all subtests to be satisfied, but stops check after the first failed or unconverged status.

Member Function Documentation

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.

Parameters
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.
Returns
AztecOO_StatusType: Unconverged, Converged or Failed.

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().


The documentation for this class was generated from the following files: