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: Passed, Failed or Undefined.
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
 Returns the maximum number of iterations set in the constructor.
st_vector getStatusTests ()
 Returns 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_
 Type of test.
st_vector tests_
 Vector of generic status tests.
StatusType status_
 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 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 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 89 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 107 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 214 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 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,
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &  test2 
)

Dual test constructor.

Definition at line 230 of file BelosStatusTestCombo.hpp.

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

Destructor.

Definition at line 133 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.

Definition at line 241 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: Passed, Failed or Undefined.

This method checks to see if the convergence criteria are met using the current information from the iterative solver.

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

Definition at line 278 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.

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

Definition at line 146 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 293 of file BelosStatusTestCombo.hpp.

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

Returns the maximum number of iterations set in the constructor.

Definition at line 164 of file BelosStatusTestCombo.hpp.

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

Returns the vector of status tests.

Definition at line 167 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 376 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 307 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 323 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 353 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 259 of file BelosStatusTestCombo.hpp.


Member Data Documentation

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

Type of test.

Definition at line 202 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 205 of file BelosStatusTestCombo.hpp.

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

Status.

Definition at line 208 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