Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
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]

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. More...
 
 StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1)
 Single test constructor. More...
 
 StatusTestCombo (ComboType t, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test1, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &test2)
 Dual test constructor. More...
 
StatusTestCombo< ScalarType,
MV, OP > & 
addStatusTest (const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &add_test)
 Add another test to this combination. More...
 
virtual ~StatusTestCombo ()
 Destructor. More...
 
Status methods
StatusType checkStatus (Iteration< ScalarType, MV, OP > *iSolver)
 Check convergence status of the iterative solver. More...
 
StatusType getStatus () const
 Return the result of the most recent checkStatus call. More...
 
Reset methods
void reset ()
 Resets all the status tests in this combination to their initial internal state. More...
 
Accessor methods
ComboType getComboType () const
 Return the type of combination (OR, AND, or SEQ). More...
 
st_vector getStatusTests ()
 Return the vector of status tests. More...
 
Print methods
void print (std::ostream &os, int indent=0) const
 Output formatted description of stopping test to output stream. More...
 
- Public Member Functions inherited from Belos::StatusTest< ScalarType, MV, OP >
 StatusTest ()
 Constructor. More...
 
virtual ~StatusTest ()
 Destructor. More...
 
virtual void printStatus (std::ostream &os, StatusType type) const
 Output the result of the most recent CheckStatus call. More...
 
- Public Member Functions inherited from Teuchos::Describable
virtual std::string description () const
 
virtual void describe (FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
 
void describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
 
virtual ~Describable ()
 
 LabeledObject ()
 
virtual ~LabeledObject ()
 
virtual void setObjectLabel (const std::string &objectLabel)
 
virtual std::string getObjectLabel () const
 
DescribableStreamManipulatorState describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default)
 
std::ostream & operator<< (std::ostream &os, const DescribableStreamManipulatorState &d)
 

Protected Member Functions

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

Additional Inherited Members

- Static Public Attributes inherited from Teuchos::Describable
static const EVerbosityLevel verbLevel_default
 

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

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
inlinevirtual

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.


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

Generated on Fri Jun 5 2020 10:21:03 for Belos by doxygen 1.8.5