Changeset 18225


Ignore:
Timestamp:
07/07/14 20:28:55 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: TAO is now provided by petsc 3.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/cores/controltao_core.cpp

    r18128 r18225  
    1010#include "../solutionsequences/solutionsequences.h"
    1111
    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)
    1314#include <tao.h>
     15#else
     16#include <petsctao.h>
     17#endif
    1418
    1519/*Local prototype*/
     20#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    1621int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*);
    1722int IssmMonitor(TaoSolver,void*);
     23#else
     24int FormFunctionGradient(Tao,Vec,IssmDouble*,Vec,void*);
     25int IssmMonitor(Tao,void*);
     26#endif
    1827typedef struct {
    1928        FemModel* femmodel;
     
    2938        IssmDouble          fatol,frtol,gatol,grtol,gttol;
    3039        AppCtx              user;
     40        #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    3141        TaoSolver           tao = 0;
     42        #else
     43        Tao                 tao = 0;
     44        #endif
    3245        int                *control_list = NULL;
    3346        char               *algorithm    = NULL;
     
    3851
    3952        /*Initialize TAO*/
     53        #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    4054        int argc; char **args=NULL;
    4155        PetscGetArgs(&argc,&args);
    4256        ierr = TaoInitialize(&argc,&args,(char*)0,"");
    4357        if(ierr) _error_("Could not initialize Tao");
     58        #endif
    4459
    4560        /*Recover some parameters*/
     
    111126        delete X;
    112127        TaoDestroy(&tao);
     128        #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    113129        TaoFinalize();
    114 }
     130        #endif
     131}
     132
     133#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    115134int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
     135#else
     136int FormFunctionGradient(Tao tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
     137#endif
    116138
    117139        /*Retreive arguments*/
     
    152174        return 0;
    153175}
     176#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
    154177int IssmMonitor(TaoSolver tao, void *userCtx){
     178#else
     179int IssmMonitor(Tao tao, void *userCtx){
     180#endif
    155181
    156182        int         its,num_responses;
Note: See TracChangeset for help on using the changeset viewer.