NOX  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Protected Member Functions | List of all members
LOCA::StatusTest::Combo Class Reference

Arbitrary combination of status tests. More...

#include <LOCA_StatusTest_Combo.H>

Inheritance diagram for LOCA::StatusTest::Combo:
Inheritance graph
[legend]
Collaboration diagram for LOCA::StatusTest::Combo:
Collaboration graph
[legend]

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 Teuchos::RCP< const LOCA::GlobalData > globalDataPtr=Teuchos::null)
 Constructor. Optional argument is the error stream for output.
 
 Combo (ComboType t, const Teuchos::RCP< Abstract > &a, const Teuchos::RCP< const LOCA::GlobalData > globalDataPtr=Teuchos::null)
 Constructor with a single test.
 
 Combo (ComboType t, const Teuchos::RCP< Abstract > &a, const Teuchos::RCP< Abstract > &b, const Teuchos::RCP< const LOCA::GlobalData > globalDataPtr=Teuchos::null)
 Constructor with two tests.
 
virtual ComboaddStatusTest (const Teuchos::RCP< Abstract > &a)
 Add another test to this combination. More...
 
virtual ~Combo ()
 Destructor.
 
virtual
LOCA::StatusTest::StatusType 
checkStatus (const LOCA::Abstract::Iterator &stepper, LOCA::StatusTest::CheckType checkType)
 Tests stopping criterion. More...
 
virtual
LOCA::StatusTest::StatusType 
getStatus () const
 Return the result of the most recent checkStatus call.
 
virtual std::ostream & print (std::ostream &stream, int indent=0) const
 Output formatted description of stopping test to output stream.
 
- Public Member Functions inherited from LOCA::StatusTest::Abstract
 Abstract ()
 Constructor.
 
virtual ~Abstract ()
 Destructor.
 

Protected Member Functions

virtual void orOp (const LOCA::Abstract::Iterator &stepper, LOCA::StatusTest::CheckType checkType)
 Use this for checkStatus when this is an OR type combo. Updates LOCA::StatusTest::Combo::status. More...
 
virtual void andOp (const LOCA::Abstract::Iterator &stepper, LOCA::StatusTest::CheckType checkType)
 Use this for checkStatus when this is an AND type combo. Updates LOCA::StatusTest::Combo::status. More...
 
bool isSafe (Abstract &a)
 Check whether or not it is safe to add a to this list of tests. More...
 

Detailed Description

Arbitrary combination of status tests.

In the AND (see LOCA::StatusTest::Combo::ComboType) combination, the result is Unconverged (see LOCA::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.

Note
We call checkStatus on every convergence test, though some may be called with the LOCA::StatusTest::None option.

Member Enumeration Documentation

The test can be either the AND of all the component tests, or the OR of all the component tests.

Enumerator
AND 

Logically "AND" together the results of the tests in this combination.

OR 

Logically "OR" together the results of the tests in this combination.

Member Function Documentation

LOCA::StatusTest::Combo & LOCA::StatusTest::Combo::addStatusTest ( const Teuchos::RCP< Abstract > &  a)
virtual

Add another test to this combination.

Calls isSafe() to determine if it is safe to add a to the combination.

References Teuchos::RCP< T >::get(), and LOCA::StatusTest::Abstract::print().

Referenced by Combo().

void LOCA::StatusTest::Combo::andOp ( const LOCA::Abstract::Iterator stepper,
LOCA::StatusTest::CheckType  checkType 
)
protectedvirtual

Use this for checkStatus when this is an AND type combo. Updates LOCA::StatusTest::Combo::status.

If any tests are LOCA::StatusTest::Unconverged, then the status of this test is LOCA::StatusTest::Unconverged. If there is a combination of LOCA::StatusTest::Failed and LOCA::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.

Note
We compute the status of all tests in the combination for the sake of completeness, even if we could determine the status of this combination test without that check.

References LOCA::StatusTest::Minimal, LOCA::StatusTest::None, LOCA::StatusTest::NotFinished, and LOCA::StatusTest::Unevaluated.

virtual LOCA::StatusTest::StatusType LOCA::StatusTest::Combo::checkStatus ( const LOCA::Abstract::Iterator stepper,
LOCA::StatusTest::CheckType  checkType 
)
virtual

Tests stopping criterion.

See addOp() and orOp() for details.

Implements LOCA::StatusTest::Abstract.

bool LOCA::StatusTest::Combo::isSafe ( Abstract 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).

References isSafe().

Referenced by isSafe().

void LOCA::StatusTest::Combo::orOp ( const LOCA::Abstract::Iterator stepper,
LOCA::StatusTest::CheckType  checkType 
)
protectedvirtual

Use this for checkStatus when this is an OR type combo. Updates LOCA::StatusTest::Combo::status.

If there is a combination of LOCA::StatusTest::Failed and LOCA::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 LOCA::Status::Unconverged. The tests are evaluated in the order that they were added to the combination.

Note
We compute the status of all tests in the combination for the sake of completeness, even if we could determine the status of this combination test without that check.

References LOCA::StatusTest::Minimal, LOCA::StatusTest::None, LOCA::StatusTest::NotFinished, and LOCA::StatusTest::Unevaluated.


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