#include <NOX_Thyra_Group.H>
Public Member Functions | |
Group (const NOX::Thyra::Vector &initial_guess, const Teuchos::RCP< const ::Thyra::ModelEvaluator< double > > &model) | |
Constructor. | |
Group (const NOX::Thyra::Group &source, NOX::CopyType type=DeepCopy) | |
Copy constructor. | |
~Group () | |
Destructor. | |
NOX::Abstract::Group & | operator= (const NOX::Abstract::Group &source) |
Copies the source group into this group. | |
NOX::Abstract::Group & | operator= (const NOX::Thyra::Group &source) |
See above. | |
Teuchos::RCP< const ::Thyra::VectorBase< double > > | get_current_x () const |
| |
Teuchos::RCP < ::Thyra::LinearOpWithSolveBase < double > > | getNonconstJacobian () |
| |
Teuchos::RCP< const ::Thyra::LinearOpWithSolveBase < double > > | getJacobian () const |
| |
virtual Teuchos::RCP < NOX::Abstract::Group > | clone (NOX::CopyType type=NOX::DeepCopy) const |
Create a new Group of the same derived type as this one by cloning this one, and return a ref count pointer to the new group. | |
void | print () const |
Print out the group. | |
"Compute" functions. | |
void | setX (const NOX::Abstract::Vector &y) |
Set the solution vector x to y. | |
void | setX (const NOX::Thyra::Vector &y) |
See above. | |
void | computeX (const NOX::Abstract::Group &grp, const NOX::Abstract::Vector &d, double step) |
Compute x = grp.x + step * d. | |
void | computeX (const NOX::Thyra::Group &grp, const NOX::Thyra::Vector &d, double step) |
See above. | |
NOX::Abstract::Group::ReturnType | computeF () |
Compute and store F(x). | |
NOX::Abstract::Group::ReturnType | computeJacobian () |
Compute and store Jacobian. | |
NOX::Abstract::Group::ReturnType | computeGradient () |
Compute and store gradient. | |
NOX::Abstract::Group::ReturnType | computeNewton (Teuchos::ParameterList ¶ms) |
Compute the Newton direction, using parameters for the linear solve. | |
Jacobian operations. | |
Operations using the Jacobian matrix. These may not be defined in matrix-free scenarios. | |
NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Applies Jacobian to the given input vector and puts the answer in the result. | |
NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Thyra::Vector &input, NOX::Thyra::Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobianMultiVector (const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
applyJacobian for multiple right-hand sides | |
NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Applies Jacobian-Transpose to the given input vector and puts the answer in the result. | |
NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Thyra::Vector &input, NOX::Thyra::Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobianTransposeMultiVector (const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
applyJacobianTranspose for multiple right-hand sides | |
NOX::Abstract::Group::ReturnType | applyJacobianInverse (Teuchos::ParameterList ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result. | |
NOX::Abstract::Group::ReturnType | applyJacobianInverse (Teuchos::ParameterList ¶ms, const NOX::Thyra::Vector &input, NOX::Thyra::Vector &result) const |
NOX::Abstract::Group::ReturnType | applyJacobianInverseMultiVector (Teuchos::ParameterList ¶ms, const NOX::Abstract::MultiVector &input, NOX::Abstract::MultiVector &result) const |
applyJacobianInverse for multiple right-hand sides | |
"Is" functions | |
Checks to see if various objects have been computed. Returns true if the corresponding "compute" function has been called since the last update to the solution vector (via instantiation or computeX). | |
bool | isF () const |
Return true if F is valid. | |
bool | isJacobian () const |
Return true if the Jacobian is valid. | |
bool | isGradient () const |
Return true if the gradient is valid. | |
bool | isNewton () const |
Return true if the Newton direction is valid. | |
"Get" functions | |
Note that these function do not check whether or not the vectors are valid. Must use the "Is" functions for that purpose. | |
const NOX::Abstract::Vector & | getX () const |
Return solution vector. | |
const NOX::Abstract::Vector & | getF () const |
Return F(x). | |
double | getNormF () const |
Return 2-norm of F(x). | |
const NOX::Abstract::Vector & | getGradient () const |
Return gradient. | |
const NOX::Abstract::Vector & | getNewton () const |
Return Newton direction. | |
Protected Member Functions | |
void | resetIsValidFlags () |
resets the isValid flags to false | |
NOX::Abstract::Group::ReturnType | applyJacobianInverseMultiVector (Teuchos::ParameterList &p, const ::Thyra::MultiVectorBase< double > &input,::Thyra::MultiVectorBase< double > &result) const |
Apply Jacobian inverse using Thyra objects. | |
::Thyra::ESolveMeasureNormType | getThyraNormType (const string &name) const |
Protected Attributes | |
Teuchos::RCP< const ::Thyra::ModelEvaluator < double > > | model_ |
Problem interface. | |
Teuchos::RCP< NOX::Thyra::Vector > | x_vec_ |
Solution vector. | |
Teuchos::RCP< NOX::Thyra::Vector > | f_vec_ |
Residual vector. | |
Teuchos::RCP< NOX::Thyra::Vector > | newton_vec_ |
Newton direction vector. | |
Teuchos::RCP< NOX::Thyra::Vector > | gradient_vec_ |
Gradient direction vector. | |
Teuchos::RCP < NOX::SharedObject < ::Thyra::LinearOpWithSolveBase < double >, NOX::Thyra::Group > > | shared_jacobian_ |
Shared Jacobian operator. | |
::Thyra::ModelEvaluatorBase::InArgs < double > | in_args_ |
Residual InArgs. | |
::Thyra::ModelEvaluatorBase::OutArgs < double > | out_args_ |
Residual OutArgs. | |
IsValid flags | |
True if the current solution is up-to-date with respect to the currect solution vector. | |
bool | is_valid_f_ |
bool | is_valid_jacobian_ |
bool | is_valid_newton_dir_ |
bool | is_valid_gradient_dir_ |
Definition at line 70 of file NOX_Thyra_Group.H.
NOX::Thyra::Group::Group | ( | const NOX::Thyra::Vector & | initial_guess, | |
const Teuchos::RCP< const ::Thyra::ModelEvaluator< double > > & | model | |||
) |
Constructor.
Definition at line 51 of file NOX_Thyra_Group.C.
References NOX::DeepCopy, f_vec_, gradient_vec_, in_args_, model_, newton_vec_, out_args_, resetIsValidFlags(), NOX::ShapeCopy, shared_jacobian_, and x_vec_.
NOX::Thyra::Group::Group | ( | const NOX::Thyra::Group & | source, | |
NOX::CopyType | type = DeepCopy | |||
) |
Copy constructor.
Definition at line 69 of file NOX_Thyra_Group.C.
References NOX::DeepCopy, f_vec_, gradient_vec_, in_args_, isJacobian(), model_, newton_vec_, out_args_, resetIsValidFlags(), NOX::ShapeCopy, shared_jacobian_, and x_vec_.
NOX::Thyra::Group::~Group | ( | ) | [virtual] |
Destructor.
Reimplemented from NOX::Abstract::Group.
Reimplemented in LOCA::Thyra::Group.
Definition at line 105 of file NOX_Thyra_Group.C.
NOX::Abstract::Group & NOX::Thyra::Group::operator= | ( | const NOX::Abstract::Group & | source | ) | [virtual] |
Copies the source group into this group.
Implements NOX::Abstract::Group.
Reimplemented in LOCA::Thyra::Group.
Definition at line 124 of file NOX_Thyra_Group.C.
NOX::Abstract::Group & NOX::Thyra::Group::operator= | ( | const NOX::Thyra::Group & | source | ) |
See above.
Reimplemented in LOCA::Thyra::Group.
Definition at line 129 of file NOX_Thyra_Group.C.
References f_vec_, gradient_vec_, isF(), isGradient(), isJacobian(), isNewton(), newton_vec_, shared_jacobian_, and x_vec_.
Teuchos::RCP< const ::Thyra::VectorBase< double > > NOX::Thyra::Group::get_current_x | ( | ) | const |
Teuchos::RCP<::Thyra::LinearOpWithSolveBase< double > > NOX::Thyra::Group::getNonconstJacobian | ( | ) |
Teuchos::RCP< const ::Thyra::LinearOpWithSolveBase< double > > NOX::Thyra::Group::getJacobian | ( | ) | const |
void NOX::Thyra::Group::setX | ( | const NOX::Abstract::Vector & | y | ) | [virtual] |
Set the solution vector x to y.
Throw an error if the copy fails.
Implements NOX::Abstract::Group.
Definition at line 183 of file NOX_Thyra_Group.C.
void NOX::Thyra::Group::setX | ( | const NOX::Thyra::Vector & | y | ) |
See above.
Definition at line 189 of file NOX_Thyra_Group.C.
References resetIsValidFlags(), and x_vec_.
void NOX::Thyra::Group::computeX | ( | const NOX::Abstract::Group & | grp, | |
const NOX::Abstract::Vector & | d, | |||
double | step | |||
) | [virtual] |
Compute x = grp.x + step * d.
Let denote this group's solution vector. Let
denote the result of grp.getX(). Then set
Throw an error if the copy fails.
Implements NOX::Abstract::Group.
Definition at line 196 of file NOX_Thyra_Group.C.
void NOX::Thyra::Group::computeX | ( | const NOX::Thyra::Group & | grp, | |
const NOX::Thyra::Vector & | d, | |||
double | step | |||
) |
See above.
Definition at line 209 of file NOX_Thyra_Group.C.
References resetIsValidFlags(), and x_vec_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::computeF | ( | ) | [virtual] |
Compute and store F(x).
Implements NOX::Abstract::Group.
Reimplemented in LOCA::Thyra::Group.
Definition at line 217 of file NOX_Thyra_Group.C.
References f_vec_, NOX::Abstract::Group::Failed, in_args_, isF(), model_, NOX::Abstract::Group::Ok, out_args_, and x_vec_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::computeJacobian | ( | ) | [virtual] |
Compute and store Jacobian.
Recall that
The Jacobian is denoted by and defined by
Reimplemented from NOX::Abstract::Group.
Reimplemented in LOCA::Thyra::Group.
Definition at line 237 of file NOX_Thyra_Group.C.
References NOX::Abstract::Group::Failed, in_args_, isJacobian(), model_, NOX::Abstract::Group::Ok, out_args_, shared_jacobian_, and x_vec_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::computeGradient | ( | ) | [virtual] |
Compute and store gradient.
We can pose the nonlinear equation problem as an optimization problem as follows:
In that case, the gradient (of ) is defined as
Reimplemented from NOX::Abstract::Group.
Definition at line 256 of file NOX_Thyra_Group.C.
References NOX::Abstract::Group::Failed, NOX::Abstract::Group::Ok, and shared_jacobian_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::computeNewton | ( | Teuchos::ParameterList & | params | ) | [virtual] |
Compute the Newton direction, using parameters for the linear solve.
The Newton direction is the solution, s, of
The parameters are from the "Linear %Solver" sublist of the "Direction" sublist that is passed to solver during construction.
The "Tolerance" parameter may be added/modified in the sublist of "Linear Solver" parameters that is passed into this function. The solution should be such that
params
Reimplemented from NOX::Abstract::Group.
Definition at line 267 of file NOX_Thyra_Group.C.
References applyJacobianInverse(), f_vec_, and newton_vec_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobian | ( | const NOX::Abstract::Vector & | input, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Applies Jacobian to the given input vector and puts the answer in the result.
Computes
where is the Jacobian,
is the input vector, and
is the result vector.
Reimplemented from NOX::Abstract::Group.
Definition at line 277 of file NOX_Thyra_Group.C.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianMultiVector | ( | const NOX::Abstract::MultiVector & | input, | |
NOX::Abstract::MultiVector & | result | |||
) | const [virtual] |
applyJacobian for multiple right-hand sides
The default implementation here calls applyJacobian() for each right hand side serially but should be overloaded if a block method is available.
Reimplemented from NOX::Abstract::Group.
Definition at line 302 of file NOX_Thyra_Group.C.
References NOX::Thyra::MultiVector::getThyraMultiVector(), isJacobian(), NOX::Abstract::Group::Ok, and shared_jacobian_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianTranspose | ( | const NOX::Abstract::Vector & | input, | |
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Applies Jacobian-Transpose to the given input vector and puts the answer in the result.
Computes
where is the Jacobian,
is the input vector, and
is the result vector.
Reimplemented from NOX::Abstract::Group.
Definition at line 326 of file NOX_Thyra_Group.C.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianTransposeMultiVector | ( | const NOX::Abstract::MultiVector & | input, | |
NOX::Abstract::MultiVector & | result | |||
) | const [virtual] |
applyJacobianTranspose for multiple right-hand sides
The default implementation here calls applyJacobianTranspose() for each right hand side serially but should be overloaded if a block method is available.
Reimplemented from NOX::Abstract::Group.
Definition at line 353 of file NOX_Thyra_Group.C.
References NOX::Abstract::Group::Failed, NOX::Thyra::MultiVector::getThyraMultiVector(), isJacobian(), NOX::Abstract::Group::Ok, and shared_jacobian_.
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianInverse | ( | Teuchos::ParameterList & | params, | |
const NOX::Abstract::Vector & | input, | |||
NOX::Abstract::Vector & | result | |||
) | const [virtual] |
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result.
Computes
where is the Jacobian,
is the input vector, and
is the result vector.
The "Tolerance" parameter specifies that the solution should be such that
params
Reimplemented from NOX::Abstract::Group.
Definition at line 380 of file NOX_Thyra_Group.C.
Referenced by computeNewton().
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianInverseMultiVector | ( | Teuchos::ParameterList & | params, | |
const NOX::Abstract::MultiVector & | input, | |||
NOX::Abstract::MultiVector & | result | |||
) | const [virtual] |
applyJacobianInverse for multiple right-hand sides
The default implementation here calls applyJacobianInverse() for each right hand side serially but should be overloaded if a block solver is available.
Reimplemented from NOX::Abstract::Group.
Definition at line 399 of file NOX_Thyra_Group.C.
References NOX::Thyra::MultiVector::getThyraMultiVector().
Referenced by LOCA::Thyra::Group::applyShiftedMatrixInverseMultiVector().
bool NOX::Thyra::Group::isF | ( | ) | const [virtual] |
Return true if F is valid.
Implements NOX::Abstract::Group.
Definition at line 413 of file NOX_Thyra_Group.C.
Referenced by computeF(), LOCA::Thyra::Group::computeF(), getNormF(), and operator=().
bool NOX::Thyra::Group::isJacobian | ( | ) | const [virtual] |
Return true if the Jacobian is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 418 of file NOX_Thyra_Group.C.
References shared_jacobian_.
Referenced by applyJacobianMultiVector(), applyJacobianTransposeMultiVector(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), Group(), and operator=().
bool NOX::Thyra::Group::isGradient | ( | ) | const [virtual] |
Return true if the gradient is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 428 of file NOX_Thyra_Group.C.
Referenced by operator=().
bool NOX::Thyra::Group::isNewton | ( | ) | const [virtual] |
Return true if the Newton direction is valid.
Reimplemented from NOX::Abstract::Group.
Definition at line 423 of file NOX_Thyra_Group.C.
Referenced by operator=().
const NOX::Abstract::Vector & NOX::Thyra::Group::getX | ( | ) | const [virtual] |
Return solution vector.
Implements NOX::Abstract::Group.
Definition at line 433 of file NOX_Thyra_Group.C.
References x_vec_.
const NOX::Abstract::Vector & NOX::Thyra::Group::getF | ( | ) | const [virtual] |
Return F(x).
Implements NOX::Abstract::Group.
Definition at line 438 of file NOX_Thyra_Group.C.
References f_vec_.
double NOX::Thyra::Group::getNormF | ( | ) | const [virtual] |
Return 2-norm of F(x).
In other words,
Implements NOX::Abstract::Group.
Definition at line 443 of file NOX_Thyra_Group.C.
const NOX::Abstract::Vector & NOX::Thyra::Group::getGradient | ( | ) | const [virtual] |
Return gradient.
Implements NOX::Abstract::Group.
Definition at line 460 of file NOX_Thyra_Group.C.
References gradient_vec_.
const NOX::Abstract::Vector & NOX::Thyra::Group::getNewton | ( | ) | const [virtual] |
Return Newton direction.
Implements NOX::Abstract::Group.
Definition at line 455 of file NOX_Thyra_Group.C.
References newton_vec_.
Teuchos::RCP< NOX::Abstract::Group > NOX::Thyra::Group::clone | ( | NOX::CopyType | type = NOX::DeepCopy |
) | const [virtual] |
Create a new Group of the same derived type as this one by cloning this one, and return a ref count pointer to the new group.
If type is NOX::DeepCopy, then we need to create an exact replica of "this". Otherwise, if type is NOX::ShapeCopy, we need only replicate the shape of "this" (only the memory is allocated, the values are not copied into the vectors and Jacobian). Returns NULL if clone is not supported.
Implements NOX::Abstract::Group.
Reimplemented in LOCA::Thyra::Group.
Definition at line 117 of file NOX_Thyra_Group.C.
void NOX::Thyra::Group::print | ( | ) | const |
void NOX::Thyra::Group::resetIsValidFlags | ( | ) | [protected] |
resets the isValid flags to false
Definition at line 108 of file NOX_Thyra_Group.C.
Referenced by computeX(), Group(), LOCA::Thyra::Group::setParam(), LOCA::Thyra::Group::setParams(), and setX().
NOX::Abstract::Group::ReturnType NOX::Thyra::Group::applyJacobianInverseMultiVector | ( | Teuchos::ParameterList & | p, | |
const ::Thyra::MultiVectorBase< double > & | input, | |||
::Thyra::MultiVectorBase< double > & | result | |||
) | const [protected] |
Apply Jacobian inverse using Thyra objects.
Definition at line 473 of file NOX_Thyra_Group.C.
References NOX::Abstract::Group::Failed, NOX::Abstract::Group::NotConverged, NOX::Abstract::Group::Ok, and shared_jacobian_.
Teuchos::RCP< const ::Thyra::ModelEvaluator<double> > NOX::Thyra::Group::model_ [protected] |
Problem interface.
Definition at line 232 of file NOX_Thyra_Group.H.
Referenced by LOCA::Thyra::Group::computeDfDpMulti(), computeF(), LOCA::Thyra::Group::computeF(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), LOCA::Thyra::Group::computeShiftedMatrix(), Group(), and LOCA::Thyra::Group::Group().
Teuchos::RCP<NOX::Thyra::Vector> NOX::Thyra::Group::x_vec_ [protected] |
Solution vector.
Definition at line 246 of file NOX_Thyra_Group.H.
Referenced by LOCA::Thyra::Group::computeDfDpMulti(), computeF(), LOCA::Thyra::Group::computeF(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), LOCA::Thyra::Group::computeShiftedMatrix(), computeX(), get_current_x(), getX(), Group(), operator=(), LOCA::Thyra::Group::printSolution(), and setX().
Teuchos::RCP<NOX::Thyra::Vector> NOX::Thyra::Group::f_vec_ [protected] |
Residual vector.
Definition at line 249 of file NOX_Thyra_Group.H.
Referenced by computeF(), LOCA::Thyra::Group::computeF(), computeNewton(), getF(), getNormF(), Group(), and operator=().
Teuchos::RCP<NOX::Thyra::Vector> NOX::Thyra::Group::newton_vec_ [protected] |
Newton direction vector.
Definition at line 252 of file NOX_Thyra_Group.H.
Referenced by computeNewton(), getNewton(), Group(), and operator=().
Teuchos::RCP<NOX::Thyra::Vector> NOX::Thyra::Group::gradient_vec_ [protected] |
Gradient direction vector.
Definition at line 255 of file NOX_Thyra_Group.H.
Referenced by getGradient(), Group(), and operator=().
Teuchos::RCP< NOX::SharedObject< ::Thyra::LinearOpWithSolveBase<double>, NOX::Thyra::Group > > NOX::Thyra::Group::shared_jacobian_ [protected] |
Shared Jacobian operator.
Definition at line 263 of file NOX_Thyra_Group.H.
Referenced by applyJacobianInverseMultiVector(), applyJacobianMultiVector(), applyJacobianTransposeMultiVector(), LOCA::Thyra::Group::applyShiftedMatrix(), LOCA::Thyra::Group::applyShiftedMatrixMultiVector(), computeGradient(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), LOCA::Thyra::Group::computeShiftedMatrix(), getJacobian(), getNonconstJacobian(), Group(), isJacobian(), and operator=().
::Thyra::ModelEvaluatorBase::InArgs<double> NOX::Thyra::Group::in_args_ [protected] |
Residual InArgs.
Definition at line 266 of file NOX_Thyra_Group.H.
Referenced by LOCA::Thyra::Group::computeDfDpMulti(), computeF(), LOCA::Thyra::Group::computeF(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), LOCA::Thyra::Group::computeShiftedMatrix(), and Group().
::Thyra::ModelEvaluatorBase::OutArgs<double> NOX::Thyra::Group::out_args_ [protected] |
Residual OutArgs.
Definition at line 269 of file NOX_Thyra_Group.H.
Referenced by LOCA::Thyra::Group::computeDfDpMulti(), computeF(), LOCA::Thyra::Group::computeF(), computeJacobian(), LOCA::Thyra::Group::computeJacobian(), LOCA::Thyra::Group::computeShiftedMatrix(), and Group().