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 "../../linearsolver/taolinearsolver_petsc.h"
  9: #include "petscksp.h"

 11: //#include "taoapp.h"

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


 17: class TaoPetscApplication: public TaoApplication{

 19:  protected:
 20:   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;
 32:   int GetComm(MPI_Comm *comm);
 33:   int Monitor();
 34:   int Monitor2(TaoVec *xx, TaoVec *gl, TaoVec *dx,TaoTruth *flag);

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

 39:   int GetVariableVector(TaoVec **xx);
 40:   int EvaluateObjectiveFunction(TaoVec *xx, double *ff);

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

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


 49:   /* Hessian Evaluation */
 50:   int GetHessianMatrix(TaoMat **HH);
 51:   int EvaluateHessian(TaoVec *xx, TaoMat *HH);

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

 55:   /* Set Variable Bounds */
 56:   int EvaluateVariableBounds(TaoVec *, TaoVec *);

 58:   int GetLinearSolver(TaoMat *, int, TaoLinearSolver **);

 60:   /* Routines below this are very preliminary */
 61:   int GetJacobianMatrix(TaoMat **JJ);
 62:   int EvaluateJacobian(TaoVec *xx, TaoMat *JJ);

 64:   int GetConstraintVector(TaoVec** rr);
 65:   int EvaluateConstraints(TaoVec *xx, TaoVec *RR);
 66:  
 67:   virtual int GetInequalityConstraints(TaoVec**, TaoMat **, TaoVec **);

 69:   // Its really stupid to have these public; fix it later
 70:   TaoVecPetsc *taox;    /* The Variable Vector */
 71:   TaoMatPetsc *taoh;    /* The Hessian Matrix */
 72:   TaoMatPetsc *taoj;    /* The Jacobian Matrix */
 73:   TaoVecPetsc *taofv;
 74:   TaoVecPetsc *taofvll;
 75:   TaoVecPetsc *taofvuu;
 76:   TaoMatPetsc *taoAA;
 77:   TaoLinearSolverPetsc *ksptmp;
 78: };

 80: #endif