NOX::StatusTest::NormF Class Reference

Various convergence tests based on the norm of the residual. More...

#include <NOX_StatusTest_NormF.H>

Inheritance diagram for NOX::StatusTest::NormF:

Inheritance graph
[legend]
Collaboration diagram for NOX::StatusTest::NormF:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ScaleType { Unscaled, Scaled }
 Type that determines whether to scale the norm by the problem size. More...
enum  ToleranceType { Relative, Absolute }
 Type that determines whether the norm is absolute or relative to the intial guess. More...

Public Member Functions

 NormF (double tolerance, NOX::Abstract::Vector::NormType ntype, ScaleType stype=Scaled, const NOX::Utils *u=NULL)
 Constructor for absolute norm.
 NormF (double tolerance, ScaleType stype=Scaled, const NOX::Utils *u=NULL)
 Constructor for absolute norm.
 NormF (NOX::Abstract::Group &initialGuess, double tolerance, NOX::Abstract::Vector::NormType ntype, ScaleType stype=Scaled, const NOX::Utils *u=NULL)
 Constructor with initial guess (for relative norms).
 NormF (NOX::Abstract::Group &initialGuess, double tolerance, ScaleType stype=Scaled, const NOX::Utils *u=NULL)
 Constructor with initial guess (for relative norms).
virtual ~NormF ()
 Destructor.
virtual NOX::StatusTest::StatusType checkStatus (const NOX::Solver::Generic &problem, NOX::StatusTest::CheckType checkType)
 Test the stopping criterion
virtual NOX::StatusTest::StatusType getStatus () const
 Return the result of the most recent checkStatus call.
virtual ostream & print (ostream &stream, int indent=0) const
 Output formatted description of stopping test to output stream.
virtual void reset (double tolerance)
 Resets the user specified absolute or relative tolerance.
virtual void reset (NOX::Abstract::Group &initialGuess, double tolerance)
 Resets the user specified relative tolerance.
virtual double getNormF () const
 Returns the value of the F-norm computed in the last call to checkStatus.
virtual double getTrueTolerance () const
 Returns the true tolerance.
virtual double getSpecifiedTolerance () const
 Returns the specified tolerance set in the constructor.
virtual double getInitialTolerance () const
 Returns the initial tolerance.

Private Member Functions

double computeNorm (const NOX::Abstract::Group &grp)
 Calculate the norm of F for the given group according to the scaling type, norm type, and tolerance type.
void relativeSetup (NOX::Abstract::Group &initialGuess)

Private Attributes

NOX::StatusTest::StatusType status
 Status
NOX::Abstract::Vector::NormType normType
 Type of norm to use.
ScaleType scaleType
 Scaling to use.
ToleranceType toleranceType
 Tolerance type (i.e., relative or absolute).
double specifiedTolerance
 Tolerance required for convergence.
double initialTolerance
 Initial tolerance.
double trueTolerance
 True tolerance value, i.e., specifiedTolerance / initialTolerance.
double normF
 Norm of F to be compared to trueTolerance.
NOX::Utils utils
 Ostream used to print errors.


Detailed Description

Various convergence tests based on the norm of the residual.

Use the constructor to define the test based on the type of scaling (see ScaleType) and the type of Tolerance (see Tolerance).

If checkStatus is called with the type set to NOX::StatusTest::None, then the status is set to NOX::StatusTest::Unevaluated and returned. (Also normF is set to 0.0.)

If checkStatus is called on a problem where the solution group does not have F evaluated (i.e., problem.getSolutionGroup().isF() is false), then the status is set to NOX::StatusTest::Unconverged and returned. (Also normF is set to -1.0.)

Finally, we return NOX::StatusTest::Converged if $\alpha < \beta$, and NOX::StatusTest::Unconverged otherwise. Here $\alpha$ represents the norm of $F(x)$ and $\beta$ represents the tolerance, as described below.

Let $\gamma$ denote an optional scale factor defined as

Then $\alpha$ is defined as follows:

We set $\beta$ as follows, based on the value of tolerance in the constructor.

Definition at line 110 of file NOX_StatusTest_NormF.H.


Member Enumeration Documentation

Type that determines whether to scale the norm by the problem size.

Enumerator:
Unscaled  No norm scaling.
Scaled  Scale the norm by the length of the vector.

Definition at line 115 of file NOX_StatusTest_NormF.H.

Type that determines whether the norm is absolute or relative to the intial guess.

Enumerator:
Relative  Relative to starting guess.
Absolute  Absolute.

Definition at line 123 of file NOX_StatusTest_NormF.H.


Constructor & Destructor Documentation

NOX::StatusTest::NormF::NormF ( double  tolerance,
NOX::Abstract::Vector::NormType  ntype,
ScaleType  stype = Scaled,
const NOX::Utils u = NULL 
)

Constructor for absolute norm.

This constructor defaults to the Absolute tolerance type.

Definition at line 50 of file NOX_StatusTest_NormF.C.

References NOX::StatusTest::Unevaluated, and utils.

NOX::StatusTest::NormF::NormF ( double  tolerance,
ScaleType  stype = Scaled,
const NOX::Utils u = NULL 
)

Constructor for absolute norm.

This constructor defaults to the Absolute ToleranceType and TWO NormType.

Definition at line 67 of file NOX_StatusTest_NormF.C.

References utils.

NOX::StatusTest::NormF::NormF ( NOX::Abstract::Group initialGuess,
double  tolerance,
NOX::Abstract::Vector::NormType  ntype,
ScaleType  stype = Scaled,
const NOX::Utils u = NULL 
)

Constructor with initial guess (for relative norms).

This constructor defaults to the Relative tolerance type.

Definition at line 83 of file NOX_StatusTest_NormF.C.

References relativeSetup(), and utils.

NOX::StatusTest::NormF::NormF ( NOX::Abstract::Group initialGuess,
double  tolerance,
ScaleType  stype = Scaled,
const NOX::Utils u = NULL 
)

Constructor with initial guess (for relative norms).

This constructor defaults to the Relative ToleranceType and TWO NormType.

Definition at line 104 of file NOX_StatusTest_NormF.C.

References relativeSetup(), and utils.

NOX::StatusTest::NormF::~NormF (  )  [virtual]

Destructor.

Definition at line 121 of file NOX_StatusTest_NormF.C.


Member Function Documentation

NOX::StatusTest::StatusType NOX::StatusTest::NormF::checkStatus ( const NOX::Solver::Generic problem,
NOX::StatusTest::CheckType  checkType 
) [virtual]

Test the stopping criterion

The test can (and should, if possible) be skipped if checkType is NOX::StatusType::None. If the test is skipped, then the status should be set to NOX::StatusTest::Unevaluated.

Implements NOX::StatusTest::Generic.

Definition at line 187 of file NOX_StatusTest_NormF.C.

References computeNorm(), NOX::StatusTest::Converged, NOX::Solver::Generic::getSolutionGroup(), NOX::StatusTest::None, normF, status, trueTolerance, NOX::StatusTest::Unconverged, and NOX::StatusTest::Unevaluated.

NOX::StatusTest::StatusType NOX::StatusTest::NormF::getStatus (  )  const [virtual]

Return the result of the most recent checkStatus call.

Implements NOX::StatusTest::Generic.

Definition at line 204 of file NOX_StatusTest_NormF.C.

References status.

ostream & NOX::StatusTest::NormF::print ( ostream &  stream,
int  indent = 0 
) const [virtual]

void NOX::StatusTest::NormF::reset ( double  tolerance  )  [virtual]

Resets the user specified absolute or relative tolerance.

Definition at line 140 of file NOX_StatusTest_NormF.C.

References Absolute, initialTolerance, specifiedTolerance, toleranceType, and trueTolerance.

void NOX::StatusTest::NormF::reset ( NOX::Abstract::Group initialGuess,
double  tolerance 
) [virtual]

Resets the user specified relative tolerance.

Definition at line 150 of file NOX_StatusTest_NormF.C.

References relativeSetup(), and specifiedTolerance.

double NOX::StatusTest::NormF::getNormF (  )  const [virtual]

Returns the value of the F-norm computed in the last call to checkStatus.

Definition at line 252 of file NOX_StatusTest_NormF.C.

References normF.

double NOX::StatusTest::NormF::getTrueTolerance (  )  const [virtual]

Returns the true tolerance.

Definition at line 257 of file NOX_StatusTest_NormF.C.

References trueTolerance.

double NOX::StatusTest::NormF::getSpecifiedTolerance (  )  const [virtual]

Returns the specified tolerance set in the constructor.

Definition at line 262 of file NOX_StatusTest_NormF.C.

References specifiedTolerance.

double NOX::StatusTest::NormF::getInitialTolerance (  )  const [virtual]

Returns the initial tolerance.

Definition at line 267 of file NOX_StatusTest_NormF.C.

References initialTolerance.

double NOX::StatusTest::NormF::computeNorm ( const NOX::Abstract::Group grp  )  [private]

Calculate the norm of F for the given group according to the scaling type, norm type, and tolerance type.

Note:
Returns -1.0 if F(x) has not been calculated for the given grp (i.e., grp.isF() is false).

Definition at line 157 of file NOX_StatusTest_NormF.C.

References NOX::Abstract::Group::getF(), NOX::Abstract::Group::getNormF(), NOX::Abstract::Group::getX(), NOX::Abstract::Group::isF(), NOX::Abstract::Vector::length(), NOX::Abstract::Vector::norm(), normType, Scaled, scaleType, and NOX::Abstract::Vector::TwoNorm.

Referenced by checkStatus(), and relativeSetup().

void NOX::StatusTest::NormF::relativeSetup ( NOX::Abstract::Group initialGuess  )  [private]

In the case of a relative norm calculation, initializes trueTolerance based on the F-value at the initial guess.

Definition at line 125 of file NOX_StatusTest_NormF.C.

References NOX::Abstract::Group::computeF(), computeNorm(), NOX::Utils::err(), initialTolerance, NOX::Abstract::Group::Ok, specifiedTolerance, trueTolerance, and utils.

Referenced by NormF(), and reset().


Member Data Documentation

Status

Definition at line 214 of file NOX_StatusTest_NormF.H.

Referenced by checkStatus(), getStatus(), and print().

Type of norm to use.

Definition at line 217 of file NOX_StatusTest_NormF.H.

Referenced by computeNorm(), and print().

Scaling to use.

Definition at line 220 of file NOX_StatusTest_NormF.H.

Referenced by computeNorm(), and print().

Tolerance type (i.e., relative or absolute).

Definition at line 223 of file NOX_StatusTest_NormF.H.

Referenced by print(), and reset().

Tolerance required for convergence.

Definition at line 226 of file NOX_StatusTest_NormF.H.

Referenced by getSpecifiedTolerance(), relativeSetup(), and reset().

Initial tolerance.

Definition at line 229 of file NOX_StatusTest_NormF.H.

Referenced by getInitialTolerance(), relativeSetup(), and reset().

True tolerance value, i.e., specifiedTolerance / initialTolerance.

Definition at line 232 of file NOX_StatusTest_NormF.H.

Referenced by checkStatus(), getTrueTolerance(), print(), relativeSetup(), and reset().

Norm of F to be compared to trueTolerance.

Definition at line 235 of file NOX_StatusTest_NormF.H.

Referenced by checkStatus(), getNormF(), and print().

Ostream used to print errors.

Definition at line 238 of file NOX_StatusTest_NormF.H.

Referenced by NormF(), and relativeSetup().


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

Generated on Thu Dec 17 11:03:10 2009 for Nonlinear Solver Project by  doxygen 1.5.9