Changeset 18225
- Timestamp:
- 07/07/14 20:28:55 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/cores/controltao_core.cpp
r18128 r18225 10 10 #include "../solutionsequences/solutionsequences.h" 11 11 12 #if defined (_HAVE_TAO_) && defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 1) 12 #if defined (_HAVE_TAO_) 13 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 13 14 #include <tao.h> 15 #else 16 #include <petsctao.h> 17 #endif 14 18 15 19 /*Local prototype*/ 20 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 16 21 int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*); 17 22 int IssmMonitor(TaoSolver,void*); 23 #else 24 int FormFunctionGradient(Tao,Vec,IssmDouble*,Vec,void*); 25 int IssmMonitor(Tao,void*); 26 #endif 18 27 typedef struct { 19 28 FemModel* femmodel; … … 29 38 IssmDouble fatol,frtol,gatol,grtol,gttol; 30 39 AppCtx user; 40 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 31 41 TaoSolver tao = 0; 42 #else 43 Tao tao = 0; 44 #endif 32 45 int *control_list = NULL; 33 46 char *algorithm = NULL; … … 38 51 39 52 /*Initialize TAO*/ 53 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 40 54 int argc; char **args=NULL; 41 55 PetscGetArgs(&argc,&args); 42 56 ierr = TaoInitialize(&argc,&args,(char*)0,""); 43 57 if(ierr) _error_("Could not initialize Tao"); 58 #endif 44 59 45 60 /*Recover some parameters*/ … … 111 126 delete X; 112 127 TaoDestroy(&tao); 128 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 113 129 TaoFinalize(); 114 } 130 #endif 131 } 132 133 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 115 134 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){ 135 #else 136 int FormFunctionGradient(Tao tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){ 137 #endif 116 138 117 139 /*Retreive arguments*/ … … 152 174 return 0; 153 175 } 176 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5) 154 177 int IssmMonitor(TaoSolver tao, void *userCtx){ 178 #else 179 int IssmMonitor(Tao tao, void *userCtx){ 180 #endif 155 181 156 182 int its,num_responses;
Note:
See TracChangeset
for help on using the changeset viewer.