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_EPETRA_GROUP_H
00043 #define NOX_EPETRA_GROUP_H
00044
00045 #include "NOX_Abstract_Group.H"
00046 #include "NOX_Epetra_Vector.H"
00047 #include "NOX_Utils.H"
00048 #include "NOX_Common.H"
00049 #include "NOX_Epetra_LinearSystem.H"
00050 #include "NOX_SharedObjectTemplate.H"
00051 #include "Teuchos_RCP.hpp"
00052
00053
00054 namespace NOX {
00055 namespace Epetra {
00056 class Scaling;
00057 namespace Interface {
00058 class Required;
00059 }
00060 }
00061 namespace Parameter {
00062 class List;
00063 }
00064 }
00065 class Epetra_Vector;
00066 class Epetra_Operator;
00067 class Epetra_RowMatrix;
00068 class AztecOO;
00069 class AztecOOConditionNumber;
00070 class Ifpack_IlukGraph;
00071 class Ifpack_CrsRiluk;
00072
00073 namespace NOX {
00074 namespace Epetra {
00075
00077
00081 class Group : public virtual NOX::Abstract::Group {
00082
00083 public:
00085
00090 Group(Teuchos::ParameterList& printingParams,
00091 const Teuchos::RCP<NOX::Epetra::Interface::Required>& i,
00092 const NOX::Epetra::Vector& initialGuess);
00093
00095 Group(Teuchos::ParameterList& printingParams,
00096 const Teuchos::RCP<NOX::Epetra::Interface::Required>& i,
00097 const NOX::Epetra::Vector& initialGuess,
00098 const Teuchos::RCP<NOX::Epetra::LinearSystem>& linSys);
00099
00102 Group(const NOX::Epetra::Group& source,
00103 NOX::CopyType type = NOX::DeepCopy);
00104
00106 virtual ~Group();
00107
00108 virtual NOX::Abstract::Group& operator=(const NOX::Abstract::Group& source);
00109
00111 virtual NOX::Abstract::Group& operator=(const NOX::Epetra::Group& source);
00112
00115
00116 virtual void setX(const NOX::Epetra::Vector& y);
00117 virtual void setX(const NOX::Abstract::Vector& y);
00118
00119 virtual void computeX(const Group& grp,
00120 const NOX::Epetra::Vector& d,
00121 double step);
00122 virtual void computeX(const NOX::Abstract::Group& grp,
00123 const NOX::Abstract::Vector& d,
00124 double step);
00125
00126 virtual NOX::Abstract::Group::ReturnType computeF();
00127
00128 virtual NOX::Abstract::Group::ReturnType computeJacobian();
00129
00130 virtual NOX::Abstract::Group::ReturnType computeGradient();
00131
00132 virtual NOX::Abstract::Group::ReturnType computeNewton(Teuchos::ParameterList& params);
00133
00135
00142
00143 virtual NOX::Abstract::Group::ReturnType
00144 applyJacobian(const NOX::Epetra::Vector& input, NOX::Epetra::Vector& result) const;
00145 virtual NOX::Abstract::Group::ReturnType
00146 applyJacobian(const NOX::Abstract::Vector& input, NOX::Abstract::Vector& result) const;
00147
00148 virtual NOX::Abstract::Group::ReturnType
00149 applyJacobianTranspose(const NOX::Epetra::Vector& input, NOX::Epetra::Vector& result) const;
00150 virtual NOX::Abstract::Group::ReturnType
00151 applyJacobianTranspose(const NOX::Abstract::Vector& input, NOX::Abstract::Vector& result) const;
00152
00184 virtual NOX::Abstract::Group::ReturnType
00185 applyJacobianInverse(Teuchos::ParameterList ¶ms, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result)
00186 const;
00187 virtual NOX::Abstract::Group::ReturnType
00188 applyJacobianInverse(Teuchos::ParameterList ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result)
00189 const;
00190
00191 virtual NOX::Abstract::Group::ReturnType
00192 applyRightPreconditioning(bool useTranspose,
00193 Teuchos::ParameterList& params,
00194 const NOX::Epetra::Vector& input,
00195 NOX::Epetra::Vector& result) const;
00196
00197 virtual NOX::Abstract::Group::ReturnType
00198 applyRightPreconditioning(bool useTranspose,
00199 Teuchos::ParameterList& params,
00200 const NOX::Abstract::Vector& input,
00201 NOX::Abstract::Vector& result) const;
00202
00204
00212
00213 virtual bool isF() const;
00214 virtual bool isJacobian() const;
00215 virtual bool isGradient() const;
00216 virtual bool isNewton() const;
00217
00223 virtual bool isNormNewtonSolveResidual() const;
00224
00229 virtual bool isPreconditioner() const;
00230
00233 virtual bool isConditionNumber() const;
00234
00236
00242
00243 virtual const NOX::Abstract::Vector& getX() const;
00244
00245 virtual const NOX::Abstract::Vector& getF() const;
00246
00247 virtual double getNormF() const;
00248
00249 virtual const NOX::Abstract::Vector& getGradient() const;
00250
00251 virtual const NOX::Abstract::Vector& getNewton() const;
00252
00259 virtual NOX::Abstract::Group::ReturnType
00260 getNormLastLinearSolveResidual(double & residual) const;
00261
00263
00264 virtual Teuchos::RCP<NOX::Abstract::Group>
00265 clone(CopyType type = DeepCopy) const;
00266
00268 virtual Teuchos::RCP<NOX::Epetra::Interface::Required>
00269 getRequiredInterface();
00270
00272 virtual Teuchos::RCP<const NOX::Epetra::LinearSystem>
00273 getLinearSystem() const;
00274
00276 virtual Teuchos::RCP<NOX::Epetra::LinearSystem> getLinearSystem();
00277
00278
00279
00280
00281
00282
00283
00284 virtual NOX::Abstract::Group::ReturnType
00285 computeJacobianConditionNumber(int maxIters, double tolerance,
00286 int krylovSubspaceSize=100,
00287 bool printOutput=false);
00288
00290 virtual double getJacobianConditionNumber() const;
00291
00292 protected:
00293
00295 virtual void resetIsValid();
00296
00302 virtual bool computeNormNewtonSolveResidual();
00303
00304 protected:
00305
00307 const NOX::Utils utils;
00308
00311
00312 Teuchos::RCP<NOX::Epetra::Vector> xVectorPtr;
00314 NOX::Epetra::Vector& xVector;
00316 Teuchos::RCP<NOX::Epetra::Vector> RHSVectorPtr;
00318 NOX::Epetra::Vector& RHSVector;
00320 Teuchos::RCP<NOX::Epetra::Vector> gradVectorPtr;
00322 NOX::Epetra::Vector& gradVector;
00324 Teuchos::RCP<NOX::Epetra::Vector> NewtonVectorPtr;
00326 NOX::Epetra::Vector& NewtonVector;
00328 mutable Teuchos::RCP<Epetra_Vector> tmpVectorPtr;
00330
00336 bool isValidRHS;
00337 bool isValidJacobian;
00338 bool isValidGrad;
00339 bool isValidNewton;
00340 bool isValidNormNewtonSolveResidual;
00341 mutable bool isValidPreconditioner;
00342 mutable bool isValidSolverJacOp;
00343 bool isValidConditionNumber;
00345
00347 double normNewtonSolveResidual;
00348
00350 double conditionNumber;
00351
00353 Teuchos::RCP<AztecOOConditionNumber> azConditionNumberPtr;
00354
00357
00358 Teuchos::RCP<
00359 NOX::SharedObject<NOX::Epetra::LinearSystem, NOX::Epetra::Group>
00360 > sharedLinearSystemPtr;
00361
00363 NOX::SharedObject<NOX::Epetra::LinearSystem, NOX::Epetra::Group>&
00364 sharedLinearSystem;
00365
00367
00369 Teuchos::RCP<NOX::Epetra::Interface::Required> userInterfacePtr;
00370
00371 };
00372
00373 }
00374 }
00375
00376
00377 #endif