00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef NOX_THYRA_GROUP_H
00043 #define NOX_THYRA_GROUP_H
00044
00045 #include "Teuchos_RCP.hpp"
00046 #include "Thyra_ModelEvaluator.hpp"
00047 #include "NOX_Abstract_Group.H"
00048 #include "NOX_Common.H"
00049 #include "NOX_Thyra_Vector.H"
00050 #include "NOX_SharedObjectTemplate.H"
00051
00052
00053 namespace NOX {
00054 namespace Parameter {
00055 class List;
00056 }
00057 }
00058
00059 namespace Thyra {
00060 template <class T> class ModelEvaluator;
00061 template <class T> class MultiVectorBase;
00062 template <class RangeScalar, class DomainScalar> class LinearOpWithSolveBase;
00063 }
00064
00065 namespace NOX {
00066
00067 namespace Thyra {
00068
00070 class Group : public virtual NOX::Abstract::Group {
00071
00072 public:
00073
00075 Group(const NOX::Thyra::Vector& initial_guess,
00076 const Teuchos::RCP< const ::Thyra::ModelEvaluator<double> >& model);
00077
00079 Group(const NOX::Thyra::Group& source, NOX::CopyType type = DeepCopy);
00080
00082 ~Group();
00083
00084 NOX::Abstract::Group& operator=(const NOX::Abstract::Group& source);
00085
00087 NOX::Abstract::Group& operator=(const NOX::Thyra::Group& source);
00088
00090 Teuchos::RCP<const ::Thyra::VectorBase<double> > get_current_x() const;
00091
00093 Teuchos::RCP< ::Thyra::LinearOpWithSolveBase<double> >
00094 getNonconstJacobian();
00095
00097 Teuchos::RCP<const ::Thyra::LinearOpWithSolveBase<double> > getJacobian() const;
00098
00101
00102 void setX(const NOX::Abstract::Vector& y);
00104 void setX(const NOX::Thyra::Vector& y);
00105
00106 void computeX(const NOX::Abstract::Group& grp,
00107 const NOX::Abstract::Vector& d,
00108 double step);
00110 void computeX(const NOX::Thyra::Group& grp,
00111 const NOX::Thyra::Vector& d,
00112 double step);
00113
00114 NOX::Abstract::Group::ReturnType computeF();
00115
00116 NOX::Abstract::Group::ReturnType computeJacobian();
00117
00118 NOX::Abstract::Group::ReturnType computeGradient();
00119
00120 NOX::Abstract::Group::ReturnType
00121 computeNewton(Teuchos::ParameterList& params);
00122
00124
00131
00132 NOX::Abstract::Group::ReturnType
00133 applyJacobian(const NOX::Abstract::Vector& input,
00134 NOX::Abstract::Vector& result) const;
00135
00136 NOX::Abstract::Group::ReturnType
00137 applyJacobian(const NOX::Thyra::Vector& input,
00138 NOX::Thyra::Vector& result) const;
00139
00140 NOX::Abstract::Group::ReturnType
00141 applyJacobianMultiVector(const NOX::Abstract::MultiVector& input,
00142 NOX::Abstract::MultiVector& result) const;
00143
00144 NOX::Abstract::Group::ReturnType
00145 applyJacobianTranspose(const NOX::Abstract::Vector& input,
00146 NOX::Abstract::Vector& result) const;
00147
00148 NOX::Abstract::Group::ReturnType
00149 applyJacobianTranspose(const NOX::Thyra::Vector& input,
00150 NOX::Thyra::Vector& result) const;
00151
00152 NOX::Abstract::Group::ReturnType
00153 applyJacobianTransposeMultiVector(
00154 const NOX::Abstract::MultiVector& input,
00155 NOX::Abstract::MultiVector& result) const;
00156
00157 NOX::Abstract::Group::ReturnType
00158 applyJacobianInverse(Teuchos::ParameterList& params,
00159 const NOX::Abstract::Vector& input,
00160 NOX::Abstract::Vector& result) const;
00161
00162 NOX::Abstract::Group::ReturnType
00163 applyJacobianInverse(Teuchos::ParameterList& params,
00164 const NOX::Thyra::Vector& input,
00165 NOX::Thyra::Vector& result) const;
00166
00167 NOX::Abstract::Group::ReturnType
00168 applyJacobianInverseMultiVector(
00169 Teuchos::ParameterList& params,
00170 const NOX::Abstract::MultiVector& input,
00171 NOX::Abstract::MultiVector& result) const;
00172
00174
00182
00183 bool isF() const;
00184 bool isJacobian() const;
00185 bool isGradient() const;
00186 bool isNewton() const;
00187
00189
00195
00196 const NOX::Abstract::Vector& getX() const;
00197
00198 const NOX::Abstract::Vector& getF() const;
00199
00200 double getNormF() const;
00201
00202 const NOX::Abstract::Vector& getGradient() const;
00203
00204 const NOX::Abstract::Vector& getNewton() const;
00205
00207
00208 virtual Teuchos::RCP<NOX::Abstract::Group>
00209 clone(NOX::CopyType type = NOX::DeepCopy) const;
00210
00212 void print() const;
00213
00214 protected:
00215
00217 void resetIsValidFlags();
00218
00220 NOX::Abstract::Group::ReturnType
00221 applyJacobianInverseMultiVector(
00222 Teuchos::ParameterList& p,
00223 const ::Thyra::MultiVectorBase<double>& input,
00224 ::Thyra::MultiVectorBase<double>& result) const;
00225
00226 ::Thyra::ESolveMeasureNormType
00227 getThyraNormType(const string& name) const;
00228
00229 protected:
00230
00232 Teuchos::RCP< const ::Thyra::ModelEvaluator<double> > model_;
00233
00239 bool is_valid_f_;
00240 bool is_valid_jacobian_;
00241 bool is_valid_newton_dir_;
00242 bool is_valid_gradient_dir_;
00244
00246 Teuchos::RCP<NOX::Thyra::Vector> x_vec_;
00247
00249 Teuchos::RCP<NOX::Thyra::Vector> f_vec_;
00250
00252 Teuchos::RCP<NOX::Thyra::Vector> newton_vec_;
00253
00255 Teuchos::RCP<NOX::Thyra::Vector> gradient_vec_;
00256
00258 Teuchos::RCP<
00259 NOX::SharedObject<
00260 ::Thyra::LinearOpWithSolveBase<double>,
00261 NOX::Thyra::Group
00262 >
00263 > shared_jacobian_;
00264
00266 ::Thyra::ModelEvaluatorBase::InArgs<double> in_args_;
00267
00269 ::Thyra::ModelEvaluatorBase::OutArgs<double> out_args_;
00270
00271 };
00272
00273 }
00274 }
00275
00276
00277 #endif