Actual source code: taoapp_petsc.h

      1: #ifndef TAOPETSCAPP_H
      2: #define TAOPETSCAPP_H

     5:  #include taoappobject.h
      6: #include "../../vector/taovec_petsc.h"
      7: #include "../../matrix/taomat_petsc.h"
      8: #include "petscksp.h"

     10: //#include "taoapp.h"

     12: typedef struct _p_TAO_SOLVER* TAO_SOLVER;
     13: typedef struct _p_TAOAPPLICATION* TAO_APPLICATION;

     16: class TaoPetscApplication: public TaoApplication{

     18:  protected:

     21:   MPI_Comm comm;
     22:  public:
     23:   TaoPetscApplication(MPI_Comm comm);
     24:   TaoPetscApplication(){};
     25:   int Setup();

     27:   ~TaoPetscApplication();
     28:   int TakeDown();

     30:   TAO_SOLVER tao;
     31:   TAO_APPLICATION papp;

     33:   int Monitor();
     34:   int Monitor2(TaoVec *xx, TaoVec *gl, TaoVec *dx,TaoTruth *flag);

     36:   /* Function Evaluation */
     37:   int InitializeVariables(TaoVec *x);

     39:   TaoVecPetsc *taox;    /* The Variable Vector */
     40:   int GetVariableVector(TaoVec **xx);
     41:   int EvaluateObjectiveFunction(TaoVec *xx, double *ff);

     43:   /* Gradient Evaluation */
     44:   int EvaluateGradient(TaoVec *xx, TaoVec *gg);

     46:   /* Function and Gradient */
     47:   int EvaluateObjectiveAndGradient(TaoVec *xx, double *ff, TaoVec *gg);

     50:   /* Hessian Evaluation */
     51:   TaoMatPetsc *taoh;    /* The Hessian Matrix */
     52:   int GetHessianMatrix(TaoMat **HH);
     53:   int EvaluateHessian(TaoVec *xx, TaoMat *HH);

     55:   int HessianSolve(TaoVec *vv, TaoVec *ww, TaoTruth *flag);

     57:   /* Set Variable Bounds */
     58:   int EvaluateVariableBounds(TaoVec *, TaoVec *);

     60:   KSP ksptmp;
     61:   int GetLinearSolver(TaoMat *, int, TaoLinearSolver **);

     63:   /* Routines below this are very preliminary */
     64:   TaoMatPetsc *taoj;    /* The Jacobian Matrix */
     65:   int GetJacobianMatrix(TaoMat **JJ);
     66:   int EvaluateJacobian(TaoVec *xx, TaoMat *JJ);

     68:   TaoVecPetsc *taofv;
     69:   int GetConstraintVector(TaoVec** rr);
     70:   int EvaluateConstraints(TaoVec *xx, TaoVec *RR);
     71:
     72:   virtual int GetInequalityConstraints(TaoVec**, TaoMat **, TaoVec **);

     74:   TaoVecPetsc *taofvll;
     75:   TaoVecPetsc *taofvuu;
     76:   TaoMatPetsc *taoAA;

     78:   int CreateATDAMatrix(TaoMat *,TaoVec*,TaoVec*, TaoMat**);

     80: };

     82: int TaoAppGetTaoPetscApp(TAO_APPLICATION, TaoPetscApplication**);

     85: #endif