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_PETSC_GROUP_H
00043 #define NOX_PETSC_GROUP_H
00044
00045 #include "NOX_Abstract_Group.H"
00046 #include "NOX_Petsc_Vector.H"
00047 #include "NOX_Common.H"
00048
00049 #include "petscsnes.h"
00050 #include "petscksp.h"
00051
00052
00053 namespace Teuchos {
00054 class ParameterList;
00055 }
00056 namespace NOX {
00057 namespace Petsc {
00058 class Interface;
00059 class SharedJacobian;
00060 }
00061 }
00062
00063 namespace NOX {
00064 namespace Petsc {
00065
00067 class Group : virtual public Abstract::Group {
00068
00069 public:
00070
00072 Group(Interface& i, Vec& x, Mat& J);
00073
00076 Group(const Group& source, CopyType type = DeepCopy);
00077
00079 virtual ~Group();
00080
00081 virtual Abstract::Group& operator=(const NOX::Abstract::Group& source);
00083 virtual Abstract::Group& operator=(const Group& source);
00084
00087
00088 virtual void setX(const Vector& y);
00089
00091 virtual void setX(const Abstract::Vector& y);
00092
00093 virtual void computeX(const Group& grp,
00094 const Vector& d,
00095 double step);
00097 virtual void computeX(const Abstract::Group& grp,
00098 const Abstract::Vector& d,
00099 double step);
00100
00101 virtual Abstract::Group::ReturnType computeF();
00102
00103 virtual Abstract::Group::ReturnType computeJacobian();
00104
00105 virtual Abstract::Group::ReturnType computeGradient();
00106
00107 virtual Abstract::Group::ReturnType computeNewton(Teuchos::ParameterList& params);
00108
00110
00117
00118 virtual Abstract::Group::ReturnType
00119 applyJacobian(const Vector& input, Vector& result) const;
00121 virtual Abstract::Group::ReturnType
00122 applyJacobian(const Abstract::Vector& input, Abstract::Vector& result) const;
00123
00124 virtual Abstract::Group::ReturnType
00125 applyJacobianTranspose(const Vector& input, Vector& result) const;
00127 virtual Abstract::Group::ReturnType
00128 applyJacobianTranspose(const Abstract::Vector& input, Abstract::Vector& result) const;
00129
00139 virtual Abstract::Group::ReturnType
00140 applyRightPreconditioning(const Vector& input, Vector& result) const;
00142 virtual Abstract::Group::ReturnType
00143 applyRightPreconditioning(Teuchos::ParameterList&, const Abstract::Vector& input, Abstract::Vector& result) const;
00144
00146
00154
00155 virtual bool isF() const;
00156 virtual bool isJacobian() const;
00157 virtual bool isGradient() const;
00158 virtual bool isNewton() const;
00159 virtual bool isPreconditioner() const;
00160
00162
00168
00169 virtual const Abstract::Vector& getX() const;
00170
00171 virtual const Abstract::Vector& getF() const;
00172
00173 virtual double getNormF() const;
00174
00175 virtual const Abstract::Vector& getGradient() const;
00176
00177 virtual const Abstract::Vector& getNewton() const;
00178
00180
00181 virtual Teuchos::RCP<NOX::Abstract::Group>
00182 clone(CopyType type = DeepCopy) const;
00183
00184 protected:
00185
00187 virtual void resetIsValid();
00188
00189 protected:
00190
00193
00194 Vector xVector;
00196 Vector RHSVector;
00198 Vector gradVector;
00200 Vector NewtonVector;
00202
00208 bool isValidRHS;
00209 bool isValidJacobian;
00210 bool isValidGrad;
00211 bool isValidNewton;
00212 bool isValidPreconditioner;
00214
00216 double normRHS;
00217
00219 SharedJacobian* sharedJacobianPtr;
00220
00222 SharedJacobian& sharedJacobian;
00223
00225 string jacType;
00226
00228 Interface& userInterface;
00229
00230 };
00231
00232 }
00233 }
00234
00235
00236
00237 #endif