#include <NOX_StatusTest_NormF.H>
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. |
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 , and NOX::StatusTest::Unconverged otherwise. Here
represents the norm of
and
represents the tolerance, as described below.
Let denote an optional scale factor defined as
sType
in the constructor is NOX::NormF::Scaled, and
Then is defined as follows:
nType
in the constructor is Abstract::Vector::TWO, then
nType
in the constructor is Abstract::Vector::ONE, then
nType
in the constructor is Abstract::Vector::INF, then
We set as follows, based on the value of
tolerance
in the constructor.
Here is the
(as defined above) associated with the initial guess.
Definition at line 110 of file NOX_StatusTest_NormF.H.
Type that determines whether to scale the norm by the problem size.
Definition at line 115 of file NOX_StatusTest_NormF.H.
Type that determines whether the norm is absolute or relative to the intial guess.
Definition at line 123 of file NOX_StatusTest_NormF.H.
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] |
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] |
Output formatted description of stopping test to output stream.
Implements NOX::StatusTest::Generic.
Definition at line 209 of file NOX_StatusTest_NormF.C.
References Absolute, NOX::Abstract::Vector::MaxNorm, normF, normType, NOX::Abstract::Vector::OneNorm, Scaled, scaleType, NOX::Utils::sciformat(), status, toleranceType, trueTolerance, and NOX::Abstract::Vector::TwoNorm.
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.
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.
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().
ScaleType NOX::StatusTest::NormF::scaleType [private] |
Scaling to use.
Definition at line 220 of file NOX_StatusTest_NormF.H.
Referenced by computeNorm(), and print().
double NOX::StatusTest::NormF::specifiedTolerance [private] |
Tolerance required for convergence.
Definition at line 226 of file NOX_StatusTest_NormF.H.
Referenced by getSpecifiedTolerance(), relativeSetup(), and reset().
double NOX::StatusTest::NormF::initialTolerance [private] |
Initial tolerance.
Definition at line 229 of file NOX_StatusTest_NormF.H.
Referenced by getInitialTolerance(), relativeSetup(), and reset().
double NOX::StatusTest::NormF::trueTolerance [private] |
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().
double NOX::StatusTest::NormF::normF [private] |
Norm of F to be compared to trueTolerance.
Definition at line 235 of file NOX_StatusTest_NormF.H.
Referenced by checkStatus(), getNormF(), and print().
NOX::Utils NOX::StatusTest::NormF::utils [private] |
Ostream used to print errors.
Definition at line 238 of file NOX_StatusTest_NormF.H.
Referenced by NormF(), and relativeSetup().