Belos Package Browser (Single Doxygen Collection) Development
Belos::StatusTestCombo< ScalarType, MV, OP > Class Template Reference

A class for extending the status testing capabilities of Belos via logical combinations. More...

#include <BelosStatusTestCombo.hpp>

Inheritance diagram for Belos::StatusTestCombo< ScalarType, MV, OP >:
Inheritance graph
[legend]

List of all members.

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.
 StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1)
 Single test constructor.
 StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test2)
 Dual test constructor.
StatusTestCombo< ScalarType,
MV, OP > & 
addStatusTest (const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &add_test)
 Add another test to this combination.
virtual ~StatusTestCombo ()
 Destructor.

Status methods

StatusType checkStatus (Iteration< ScalarType, MV, OP > *iSolver)
 Check convergence status of the iterative solver.
StatusType getStatus () const
 Return the result of the most recent checkStatus call.

Reset methods

void reset ()
 Resets all the status tests in this combination to their initial internal state.

Accessor methods

ComboType getComboType () const
 Return the type of combination (OR, AND, or SEQ).
st_vector getStatusTests ()
 Return the vector of status tests.

Print methods

void print (std::ostream &os, int indent=0) const
 Output formatted description of stopping test to output stream.

Internal methods.

void orOp (Iteration< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is an OR type combo. Updates status.
void andOp (Iteration< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is an AND type combo. Updates status.
void seqOp (Iteration< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is a sequential AND type combo. Updates status.
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.

Private data members.

ComboType type_
 The type of combination (OR, AND, or SEQ)
st_vector tests_
 Vector of generic status tests.
StatusType status_
 The current status.

Detailed Description

template<class ScalarType, class MV, class OP>
class Belos::StatusTestCombo< ScalarType, MV, OP >

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:

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


Member Enumeration Documentation

template<class ScalarType, class MV, class OP>
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).

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.

Definition at line 109 of file BelosStatusTestCombo.hpp.


Constructor & Destructor Documentation

template<class ScalarType , class MV , class OP >
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo ( ComboType  t)

Constructor.

Definition at line 221 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
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.

template<class ScalarType , class MV , class OP >
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.

template<class ScalarType, class MV, class OP>
virtual Belos::StatusTestCombo< ScalarType, MV, OP >::~StatusTestCombo ( ) [inline, virtual]

Destructor.

Definition at line 137 of file BelosStatusTestCombo.hpp.


Member Function Documentation

template<class ScalarType , class MV , class OP >
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.

template<class ScalarType , class MV , class OP >
StatusType Belos::StatusTestCombo< ScalarType, MV, OP >::checkStatus ( Iteration< ScalarType, MV, OP > *  iSolver) [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.

template<class ScalarType, class MV, class OP>
StatusType Belos::StatusTestCombo< ScalarType, MV, OP >::getStatus ( ) const [inline, virtual]

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.

template<class ScalarType , class MV , class OP >
void Belos::StatusTestCombo< ScalarType, MV, OP >::reset ( ) [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.

template<class ScalarType, class MV, class OP>
ComboType Belos::StatusTestCombo< ScalarType, MV, OP >::getComboType ( ) const [inline]

Return the type of combination (OR, AND, or SEQ).

Definition at line 171 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
st_vector Belos::StatusTestCombo< ScalarType, MV, OP >::getStatusTests ( ) [inline]

Return the vector of status tests.

Definition at line 174 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
void Belos::StatusTestCombo< ScalarType, MV, OP >::print ( std::ostream &  os,
int  indent = 0 
) const [virtual]

Output formatted description of stopping test to output stream.

Implements Belos::StatusTest< ScalarType, MV, OP >.

Definition at line 383 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
void Belos::StatusTestCombo< ScalarType, MV, OP >::orOp ( Iteration< ScalarType, MV, OP > *  iSolver) [protected]

Use this for checkStatus when this is an OR type combo. Updates status.

Definition at line 314 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
void Belos::StatusTestCombo< ScalarType, MV, OP >::andOp ( Iteration< ScalarType, MV, OP > *  iSolver) [protected]

Use this for checkStatus when this is an AND type combo. Updates status.

Definition at line 330 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
void Belos::StatusTestCombo< ScalarType, MV, OP >::seqOp ( Iteration< ScalarType, MV, OP > *  iSolver) [protected]

Use this for checkStatus when this is a sequential AND type combo. Updates status.

Definition at line 360 of file BelosStatusTestCombo.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::StatusTestCombo< ScalarType, MV, OP >::isSafe ( const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &  test1) [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.


Member Data Documentation

template<class ScalarType, class MV, class OP>
ComboType Belos::StatusTestCombo< ScalarType, MV, OP >::type_ [private]

The type of combination (OR, AND, or SEQ)

Definition at line 209 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
st_vector Belos::StatusTestCombo< ScalarType, MV, OP >::tests_ [private]

Vector of generic status tests.

Definition at line 212 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
StatusType Belos::StatusTestCombo< ScalarType, MV, OP >::status_ [private]

The current status.

Definition at line 215 of file BelosStatusTestCombo.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines