Stokhos
Development
|
Public Types | |
typedef Sacado::MP::Vector < Storage > | ScalarType |
typedef Teuchos::ScalarTraits < ScalarType > | SCT |
typedef SCT::magnitudeType | MagnitudeType |
typedef MultiVecTraits < ScalarType, MV > | MVT |
Enums. | |
enum | ResType { Implicit, Explicit } |
Select how the residual std::vector is produced. More... | |
Public Member Functions | |
Constructors/destructors. | |
StatusTestGenResNorm (MagnitudeType Tolerance, int quorum=-1, bool showMaxResNormOnly=false) | |
Constructor. More... | |
virtual | ~StatusTestGenResNorm () |
Destructor. | |
Form and parameter definition methods. | |
int | defineResForm (ResType TypeOfResidual, NormType TypeOfNorm) |
Define form of the residual, its norm and optional weighting std::vector. More... | |
int | defineScaleForm (ScaleType TypeOfScaling, NormType TypeOfNorm, MagnitudeType ScaleValue=Teuchos::ScalarTraits< MagnitudeType >::one()) |
Define form of the scaling, its norm, its optional weighting std::vector, or, alternatively, define an explicit value. More... | |
NormType | getResNormType () |
int | setTolerance (MagnitudeType tolerance) |
Set the value of the tolerance. More... | |
int | setQuorum (int quorum) |
int | setShowMaxResNormOnly (bool showMaxResNormOnly) |
Set whether the only maximum residual norm is displayed when the print() method is called. | |
Status methods | |
StatusType | checkStatus (Iteration< ScalarType, MV, OP > *iSolver) |
Check convergence status: Passed, Failed, or Undefined. More... | |
StatusType | getStatus () const |
Return the result of the most recent CheckStatus call. | |
Reset methods | |
void | reset () |
Resets the internal configuration to the initial state. | |
Print methods | |
void | print (std::ostream &os, int indent=0) const |
Output formatted description of stopping test to output stream. | |
void | printStatus (std::ostream &os, StatusType type) const |
Print message for each status specific to this stopping test. | |
Methods to access data members. | |
Teuchos::RCP< MV > | getSolution () |
int | getQuorum () const |
bool | getShowMaxResNormOnly () |
Returns whether the only maximum residual norm is displayed when the print() method is called. | |
std::vector< int > | convIndices () |
Returns the std::vector containing the indices of the residuals that passed the test. | |
MagnitudeType | getTolerance () const |
Returns the value of the tolerance, , set in the constructor. | |
const std::vector < MagnitudeType > * | getTestValue () const |
Returns the test value, , computed in most recent call to CheckStatus. | |
const std::vector < MagnitudeType > * | getResNormValue () const |
Returns the residual norm value, , computed in most recent call to CheckStatus. | |
const std::vector < MagnitudeType > * | getScaledNormValue () const |
Returns the scaled norm value, . | |
bool | getLOADetected () const |
const std::vector< int > | getEnsembleIterations () const |
Returns number of ensemble iterations. | |
Misc. | |
StatusType | firstCallCheckStatusSetup (Iteration< ScalarType, MV, OP > *iSolver) |
Call to setup initial scaling std::vector. More... | |
Overridden from Teuchos::Describable | |
std::string | description () const |
Method to return description of the maximum iteration status test. | |
enum Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::ResType |
Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::StatusTestGenResNorm | ( | MagnitudeType | Tolerance, |
int | quorum = -1 , |
||
bool | showMaxResNormOnly = false |
||
) |
Constructor.
The constructor takes a single argument specifying the tolerance ( ). If none of the form definition methods are called, we use as the stopping criterion, where uses the least costly form of the 2-norm of residual available from the iterative method and is the corresponding norm of the initial residual. The least costly form of the 2-norm depends on the chosen iterative method. Most Krylov methods produce the preconditioned residual std::vector in a form that would be exact in infinite precision arithmetic. This std::vector may be different from the true residual either because left preconditioning was used, or because round-off error has introduced significant error, or both.
You can also state the number of vectors that must pass the convergence criteria before the status test passes by using the quorum
argument.
StatusType Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::checkStatus | ( | Iteration< ScalarType, MV, OP > * | iSolver | ) |
Check convergence status: Passed, Failed, or Undefined.
This method checks to see if the convergence criteria are met. Depending on how the residual test is constructed this method will return the appropriate status type.
int Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::defineResForm | ( | ResType | TypeOfResidual, |
NormType | TypeOfNorm | ||
) |
Define form of the residual, its norm and optional weighting std::vector.
This method defines the form of . We specify:
int Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::defineScaleForm | ( | ScaleType | TypeOfScaling, |
NormType | TypeOfNorm, | ||
MagnitudeType | ScaleValue = Teuchos::ScalarTraits< MagnitudeType >::one() |
||
) |
Define form of the scaling, its norm, its optional weighting std::vector, or, alternatively, define an explicit value.
This method defines the form of how the residual is scaled (if at all). It operates in two modes:
User-provided scaling value:
StatusType Belos::StatusTestGenResNorm< Sacado::MP::Vector< Storage >, MV, OP >::firstCallCheckStatusSetup | ( | Iteration< ScalarType, MV, OP > * | iSolver | ) |
Call to setup initial scaling std::vector.
After this function is called getScaledNormValue()
can be called to get the scaling std::vector.
|
inline |
Returns a boolean indicating a loss of accuracy has been detected in computing the residual.
|
inline |
Returns the number of residuals that must pass the convergence test before Passed is returned.
quorum=-1
then all residuals must pass the convergence test before Passed is returned.
|
inline |
Returns the current solution estimate that was computed for the most recent residual test.
|
inline |
Sets the number of residuals that must pass the convergence test before Passed is returned.
quorum=-1
then all residuals must pass the convergence test before Passed is returned.
|
inline |
Set the value of the tolerance.
We allow the tolerance to be reset for cases where, in the process of testing the residual, we find that the initial tolerance was too tight or too lax.