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.

Public Types

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

Public Member Functions

Constructors / Destructor
 StatusTestCombo (ComboType t)
 Constructor.
 StatusTestCombo (ComboType t, StatusTest< ScalarType, MV, OP > &test1)
 Single test constructor.
 StatusTestCombo (ComboType t, StatusTest< ScalarType, MV, OP > &test1, StatusTest< ScalarType, MV, OP > &test2)
 Dual test constructor.
StatusTestCombo< ScalarType,
MV, OP > & 
AddStatusTest (StatusTest< ScalarType, MV, OP > &add_test)
 Add another test to this combination.
virtual ~StatusTestCombo ()
 Destructor.
Status methods
StatusType CheckStatus (IterativeSolver< ScalarType, MV, OP > *iSolver)
 Check convergence status of the iterative solver: Unconverged, Converged, Failed.
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.
Attribute methods
bool ResidualVectorRequired () const
 Indicates if residual vector is required by this convergence test.
Print methods
ostream & Print (ostream &os, int indent=0) const
 Output formatted description of stopping test to output stream.

Protected Member Functions

Internal methods.
void OrOp (IterativeSolver< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is an OR type combo. Updates status.
void AndOp (IterativeSolver< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is an AND type combo. Updates status.
void SeqOp (IterativeSolver< ScalarType, MV, OP > *iSolver)
 Use this for checkStatus when this is a sequential AND type combo. Updates status.
bool IsSafe (StatusTest< ScalarType, MV, OP > &test1)
 Check whether or not it is safe to add a to the list of tests.

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

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

Enumeration values:
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 94 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 205 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo ComboType  t,
StatusTest< ScalarType, MV, OP > &  test1
 

Single test constructor.

Definition at line 212 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
Belos::StatusTestCombo< ScalarType, MV, OP >::StatusTestCombo ComboType  t,
StatusTest< ScalarType, MV, OP > &  test1,
StatusTest< ScalarType, MV, OP > &  test2
 

Dual test constructor.

Definition at line 220 of file BelosStatusTestCombo.hpp.

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

Destructor.

Definition at line 117 of file BelosStatusTestCombo.hpp.


Member Function Documentation

template<class ScalarType, class MV, class OP>
StatusTestCombo< ScalarType, MV, OP > & Belos::StatusTestCombo< ScalarType, MV, OP >::AddStatusTest StatusTest< ScalarType, MV, OP > &  add_test  ) 
 

Add another test to this combination.

Definition at line 229 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
StatusType Belos::StatusTestCombo< ScalarType, MV, OP >::CheckStatus IterativeSolver< ScalarType, MV, OP > *  iSolver  )  [virtual]
 

Check convergence status of the iterative solver: Unconverged, Converged, Failed.

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 284 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 130 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 299 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 148 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
bool Belos::StatusTestCombo< ScalarType, MV, OP >::ResidualVectorRequired  )  const [virtual]
 

Indicates if residual vector is required by this convergence test.

If this method returns true, then one or more of the StatusTest objects that make up this combined test requires the norm of the true residual vector to perform its test.

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

Definition at line 266 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
ostream & Belos::StatusTestCombo< ScalarType, MV, OP >::Print 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 394 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
void Belos::StatusTestCombo< ScalarType, MV, OP >::OrOp IterativeSolver< ScalarType, MV, OP > *  iSolver  )  [protected]
 

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

Definition at line 313 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
void Belos::StatusTestCombo< ScalarType, MV, OP >::AndOp IterativeSolver< ScalarType, MV, OP > *  iSolver  )  [protected]
 

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

Definition at line 338 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
void Belos::StatusTestCombo< ScalarType, MV, OP >::SeqOp IterativeSolver< ScalarType, MV, OP > *  iSolver  )  [protected]
 

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

Definition at line 371 of file BelosStatusTestCombo.hpp.

template<class ScalarType, class MV, class OP>
bool Belos::StatusTestCombo< ScalarType, MV, OP >::IsSafe 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 247 of file BelosStatusTestCombo.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Sep 18 12:30:13 2008 for Belos by doxygen 1.3.9.1