Actual source code: tao_app_impl.h

  1: #ifndef PETSCAPP_H
  2: #define PETSCAPP_H

  4: #include "petscksp.h"

  6: // typedef struct _p_TAO_SOLVER* TAO_SOLVER;
  7: typedef struct _p_TAOAPPLICATION* TAO_APPLICATION;

  9: #ifndef MAX_TAO_MONITORS
 10: #define MAX_TAO_MONITORS 5
 11: #endif

 13: #ifndef MAX_TAO_USER_DESTROY
 14: #define MAX_TAO_USER_DESTROY 50
 15: #endif

 17: #define MAX_TAO_KEY_LENGTH 100
 18: #define MAX_TAOAPP_ADDON 10

 20: typedef struct{
 21:   int id;
 22:   char key[MAX_TAO_KEY_LENGTH];
 23:   void *ctx;
 24: } TaoAppAddOn;

 26: struct _p_TAOAPPLICATION {

 28:   PETSCHEADER(int);

 30:   int nAddOn;
 31:   TaoAppAddOn  TaoAppCtx[MAX_TAO_KEY_LENGTH];

 33:   /* --------------------------  Monitoring  ------------------------------------*/
 34:   double grtol;
 35:   int   numbermonitors;                            /* number of monitors */
 36:   int   (*monitor[MAX_TAO_MONITORS])(struct _p_TAOAPPLICATION*,void*); /* monitor routine */
 37:   void  *monitorcontext[MAX_TAO_MONITORS];         /* monitor context */

 39:   int   numberoptioncheckers;                            /* number of monitors */
 40:   int   (*checkoptions[MAX_TAO_MONITORS])(struct _p_TAOAPPLICATION*); /* monitor routine */

 42:   /* Vector of Variables */
 43:   Vec V;

 45:   /* Objective Function */
 46:   void *usrfctx;
 47:   int  (*computeumfunction)(TAO_APPLICATION,Vec,double*,void*);
 48:   int nfeval;

 50:   /* Gradient Evaluation */
 51:   void *usrgctx;
 52:   int  (*computegradient)(TAO_APPLICATION,Vec,Vec,void*);
 53:   Vec G;
 54:   int ngeval;

 56:   /* Function and Gradient */
 57:   void *usrfgctx;
 58:   int  (*computefunctiongradient)(TAO_APPLICATION,Vec,double*,Vec,void*); 

 60:   /* Hessian Evaluation */
 61:   void *usrhctx;
 62:   int  (*computehessian)(TAO_APPLICATION,Vec,Mat*,Mat*,MatStructure*,void*);
 63:   Mat H,HP;
 64:   int nheval;

 66:   /* ApproximateHessian */
 67:   void *usrhhhctx;
 68:   int  (*hessiansolve)(TAO_APPLICATION,Vec,Vec,PetscTruth*,void*); 
 69:   int nlsolve;

 71:   /* Set Variable Bounds */
 72:   int  (*computebounds)(TAO_APPLICATION,Vec,Vec,void*);
 73:   void *boundctx;

 75:   /* Routines below this are very preliminary */
 76:   void *usrjctx;
 77:   int  (*computejacobian)(TAO_APPLICATION,Vec,Mat*,Mat*, MatStructure*,void*);
 78:   Mat  J,JP;

 80:   void *usrfvctx;
 81:   int  (*computevfunc)(TAO_APPLICATION,Vec,Vec,void*);
 82:   Vec R;

 84:   /* Routines called when destroying this structure */
 85:   int   numberdestroyers;
 86:   int   (*userdestroy[MAX_TAO_USER_DESTROY])(void*);
 87:   void  *userctxdestroy[MAX_TAO_USER_DESTROY];

 89:   KSP ksp;
 90: };

 92: #endif