source: issm/oecreview/Archive/24684-25833/ISSM-25709-25710.diff

Last change on this file was 25834, checked in by Mathieu Morlighem, 4 years ago

CHG: added 24684-25833

File size: 22.8 KB
  • ../trunk-jpl/m4/issm_options.m4

     
    209209        AC_MSG_CHECKING([if system copy of libc has fmemopen])
    210210        SYSTEM_FMEMOPEN=1
    211211        if test "${IS_MAC}" == "yes"; then
    212                 if [[ $(system_profiler SPSoftwareDataType | $(which grep) "System Version:" | sed -e "s/[[:space:]]*System Version: macOS //" | cut -d "." -f 2) -lt 13 ]]; then
     212                if [[ $(system_profiler SPSoftwareDataType | /usr/bin/grep "System Version:" | sed -e "s/[[:space:]]*System Version: macOS //" | cut -d "." -f 2) -lt 13 ]]; then
    213213                        SYSTEM_FMEMOPEN=0
    214214                fi
    215215        fi
     
    377377                        ;;
    378378                        *)
    379379                                MATLABINCL="-I${MATLAB_ROOT}/extern/include"
    380                                 MEXLINK=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep LDFLAGS | sed -e "s/         LDFLAGS            = //g")
    381                                 MEXLIB=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS | sed -e "s/         CXXLIBS            = //g")
    382                                 MEXEXT=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
     380                                MEXLINK=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep LDFLAGS | sed -e "s/         LDFLAGS            = //g")
     381                                MEXLIB=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep CXXLIBS | sed -e "s/         CXXLIBS            = //g")
     382                                MEXEXT=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep LDEXTENSION | sed -e "s/         LDEXTENSION        = //g")
    383383                                dnl version 2014 and up
    384384                                if test -z "${MEXEXT}"; then
    385385                                        echo "#include <mex.h>" > conftest.cpp
     
    386386                                        echo "void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){}" >> conftest.cpp
    387387                                        ${MATLAB_ROOT}/bin/mex -v -lmex conftest.cpp > conftest.tmp 2>&1
    388388                                        rm -f conftest.cpp
    389                                         MEXLINK=$(cat conftest.tmp | grep LDFLAGS | sed -e "s/LDFLAGS ://g")
    390                                         MEXLIB=$(cat conftest.tmp | grep LINKLIBS | sed -e "s/LINKLIBS ://g")
    391                                         MEXEXT=$(cat conftest.tmp | grep LDEXT | sed -e "s/LDEXT ://g" | awk '{print $[1]}')
     389                                        MEXLINK=$(cat conftest.tmp | /usr/bin/grep LDFLAGS | sed -e "s/LDFLAGS ://g")
     390                                        MEXLIB=$(cat conftest.tmp | /usr/bin/grep LINKLIBS | sed -e "s/LINKLIBS ://g")
     391                                        MEXEXT=$(cat conftest.tmp | /usr/bin/grep LDEXT | sed -e "s/LDEXT ://g" | awk '{print $[1]}')
    392392                                        if test -z "${MEXEXT}"; then
    393393                                         cat conftest.tmp
    394394                                        fi
     
    507507                BOOSTINCL="-I${BOOST_ROOT}/include"
    508508                #BOOSTLIB="-L$BOOST_ROOT/lib -lboost_python"
    509509                AC_MSG_CHECKING(for Boost version)
    510                 BOOST_VERSION=`cat ${BOOST_ROOT}/include/boost/version.hpp | grep "#define BOOST_VERSION " | sed 's/.*BOOST_VERSION //'`
     510                BOOST_VERSION=`cat ${BOOST_ROOT}/include/boost/version.hpp | /usr/bin/grep "#define BOOST_VERSION " | sed 's/.*BOOST_VERSION //'`
    511511                BOOST_VERSION_MAJOR=`expr ${BOOST_VERSION} / 100000`
    512512                BOOST_VERSION_MINOR=`expr ${BOOST_VERSION} / 100 % 1000`
    513513                AC_MSG_RESULT([${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}])
     
    547547                dnl
    548548                DAKOTA_VERSION_OUTPUT=`${DAKOTA_ROOT}/bin/dakota -v`
    549549                if test -n "${DAKOTA_VERSION_OUTPUT}"; then
    550                         DAKOTA_VERSION=`echo ${DAKOTA_VERSION_OUTPUT} grep "Dakota version" | sed 's/Dakota version //' | sed 's/ .*//'`
     550                        DAKOTA_VERSION=`echo ${DAKOTA_VERSION_OUTPUT} /usr/bin/grep "Dakota version" | sed 's/Dakota version //' | sed 's/ .*//'`
    551551                elif test -f "${DAKOTA_ROOT}/VERSION"; then
    552                         DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/VERSION | grep 'DAKOTA Version' | sed 's/.*DAKOTA Version //' | sed 's/ .*//'`
     552                        DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/VERSION | /usr/bin/grep 'DAKOTA Version' | sed 's/.*DAKOTA Version //' | sed 's/ .*//'`
    553553                elif test -f "${DAKOTA_ROOT}/../src/src/CommandLineHandler.C"; then
    554                         DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.C | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
     554                        DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.C | /usr/bin/grep 'DAKOTA version' | /usr/bin/grep 'release' | /usr/bin/grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
    555555                elif test -f "${DAKOTA_ROOT}/../src/src/CommandLineHandler.cpp"; then
    556                         DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.cpp | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
     556                        DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.cpp | /usr/bin/grep 'DAKOTA version' | /usr/bin/grep 'release' | /usr/bin/grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
    557557                else
    558558                        AC_MSG_ERROR([Dakota CommandLineHandler.C or CommandLineHandler.cpp file not found to determine DAKOTA_VERSION!]);
    559559                fi
     
    12071207
    12081208        dnl PETSc libraries and header files
    12091209        if test "x${HAVE_PETSC}" == "xyes"; then
    1210                 AC_MSG_CHECKING(for PETSc version)
    12111210                if ! test -f "${PETSC_ROOT}/include/petscversion.h"; then
    12121211                        AC_MSG_ERROR([PETSc not instaled correctly: file (${PETSC_ROOT}/include/petscversion.h) does not exist!]);
    12131212                fi
    1214                 PETSC_MAJOR=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_MAJOR" | sed 's/#define PETSC_VERSION_MAJOR//' | sed 's/ //g'`
    1215                 PETSC_MINOR=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_MINOR" | sed 's/#define PETSC_VERSION_MINOR//' | sed 's/ //g'`
    1216                 AC_DEFINE_UNQUOTED(_PETSC_MAJOR_, $PETSC_MAJOR, [PETSc version major])
    1217                 AC_DEFINE_UNQUOTED(_PETSC_MINOR_, $PETSC_MINOR, [PETSc version minor])
     1213
     1214                AC_MSG_CHECKING(for PETSc version)
     1215                PETSC_MAJOR=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_MAJOR" | sed 's/#define PETSC_VERSION_MAJOR//' | sed 's/ //g'`
     1216                PETSC_MINOR=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_MINOR" | sed 's/#define PETSC_VERSION_MINOR//' | sed 's/ //g'`
     1217                AC_DEFINE_UNQUOTED([_PETSC_MAJOR_], [$PETSC_MAJOR], [PETSc version major])
     1218                AC_DEFINE_UNQUOTED([_PETSC_MINOR_], [$PETSC_MINOR], [PETSc version minor])
    12181219                AC_MSG_RESULT([${PETSC_MAJOR}.${PETSC_MINOR}])
    12191220
    1220                 dnl PETSC_VERSION_DATE_HG=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_DATE_HG" | sed 's/#define PETSC_VERSION_DATE_HG//' | sed 's/ //g' | sed -e 's/\"//g' `
    1221                 PETSC_RELEASE=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_RELEASE" | sed 's/#define PETSC_VERSION_RELEASE//' | sed 's/ //g'`
    1222 
    12231221                AC_MSG_CHECKING(whether PETSc is the development version)
    1224                 dnl if test "x${PETSC_VERSION_DATE_HG}" == "xunknown"; then
     1222                PETSC_RELEASE=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_RELEASE" | sed 's/#define PETSC_VERSION_RELEASE//' | sed 's/ //g'`
    12251223                if test "${PETSC_RELEASE}" == "0"; then
    12261224                        AC_DEFINE([_HAVE_PETSCDEV_], [1], [with PETSc-dev])
    12271225                        AC_MSG_RESULT([yes])
     
    22112209                        AC_SUBST([GRAPHICSLIB])
    22122210                else
    22132211                        if test -f "${PETSC_ROOT}/conf/petscvariables"; then
    2214                                 PETSC_REC_GRAPHICS_LIB=$(cat ${PETSC_ROOT}/conf/petscvariables | grep X_LIB)
     2212                                PETSC_REC_GRAPHICS_LIB=$(cat ${PETSC_ROOT}/conf/petscvariables | /usr/bin/grep X_LIB)
    22152213                                AC_MSG_ERROR([Xlib (graphics library) provided (${GRAPHICS_LIB}) does not exist! PETSc suggests the following library: ${PETSC_REC_GRAPHICS_LIB}]);
    22162214                        fi
    22172215                        AC_MSG_ERROR([Xlib (graphics library) provided (${GRAPHICS_LIB}) does not exist!]);
     
    23502348                AC_DEFINE([_HAVE_GMSH_], [1], [with Gmsh in ISSM src])
    23512349
    23522350                AC_MSG_CHECKING(for Gmsh version)
    2353                 GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f 1`
     2351                GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | /usr/bin/grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f 1`
    23542352                AC_MSG_RESULT([${GMSH_VERSION_MAJOR}])
    23552353                AC_DEFINE_UNQUOTED(_GMSH_VERSION_MAJOR_, $GMSH_VERSION_MAJOR, [Gmsh major version])
    23562354        fi     
  • ../trunk-jpl/src/c/solutionsequences/solutionsequence_schurcg.cpp

     
    1212#include <fstream>
    1313
    1414#ifdef _HAVE_PETSC_
     15#include <petscversion.h>
    1516
    16 
    1717void SchurCGSolver(Vector<IssmDouble>** puf,Mat Kff, Vec pf, Vec uf0,IS isv,IS isp,Parameters* parameters){/*{{{*/
    1818
    1919        Mat                  A, B, BT;                          /* Saddle point block matrices */
     
    4343
    4444        int precond = 0;
    4545
    46         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     46        #if PETSC_VERSION_LT(3,2,0)
    4747        PetscTruth flag,flg;
    4848        #else
    4949        PetscBool flag,flg;
     
    5454        char pc_type[50];
    5555        int maxiter;
    5656
    57         #if _PETSC_MINOR_<7
     57        #if PETSC_VERSION_LT(3,7,0)
    5858        PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
    5959        PetscOptionsGetString(PETSC_NULL,"-pc_type",pc_type,49,&flg);
    6060        PetscOptionsGetReal(PETSC_NULL,"-tol",&TOL,NULL);
     
    8787         * where A is the elliptic submatrix, B^T represents the incompressibility,
    8888         * and I the Schur preconditioner (stored here, because the space was allocated either way)
    8989         *         */
    90         #if _PETSC_MINOR_>8
     90        #if PETSC_VERSION_GT(3,8,0)
    9191        MatCreateSubMatrix(Kff,isv,isv,MAT_INITIAL_MATRIX,&A);
    9292        MatCreateSubMatrix(Kff,isv,isp,MAT_INITIAL_MATRIX,&B);
    9393        MatCreateSubMatrix(Kff,isp,isv,MAT_INITIAL_MATRIX,&BT);
     
    9898        #endif
    9999       
    100100        /* Extract preconditioner matrix on the pressure space*/
    101         #if _PETSC_MINOR_>8
     101        #if PETSC_VERSION_GT(3,8,0)
    102102        MatCreateSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
    103103        #else
    104104        MatGetSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
     
    145145       
    146146        /* Create KSP context */
    147147        KSPCreate(IssmComm::GetComm(),&kspu);
    148         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
     148        #if PETSC_VERSION_GE(3,5,0)
    149149        KSPSetOperators(kspu,A,A);
    150150        #else
    151151        KSPSetOperators(kspu,A,A,DIFFERENT_NONZERO_PATTERN);
     
    263263       
    264264        /* Create KSP context */
    265265        KSPCreate(IssmComm::GetComm(),&kspip);
    266         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
     266        #if PETSC_VERSION_GE(3,5,0)
    267267        KSPSetOperators(kspip,IP,IP);
    268268        #else
    269269        KSPSetOperators(kspip,IP,IP,DIFFERENT_NONZERO_PATTERN);
     
    538538   * To calculate the residual, only the necessary blocks need to be extracted */
    539539
    540540        /*Extract A, B, B^T */
    541         #if _PETSC_MINOR_>8
     541        #if PETSC_VERSION_GT(3,8,0)
    542542        MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isv,MAT_INITIAL_MATRIX,&A);
    543543        MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isp,MAT_INITIAL_MATRIX,&B);
    544544        MatCreateSubMatrix(Kff->pmatrix->matrix,isp,isv,MAT_INITIAL_MATRIX,&BT);
     
    741741                Reduceloadx(pf, Kfs, ys); delete Kfs;
    742742
    743743                /*Create pressure matrix of choice*/
    744                 #if _PETSC_MINOR_<7
     744                #if PETSC_VERSION_LT(3,7,0)
    745745                PetscOptionsGetInt(PETSC_NULL,"-schur_pc",&precond,NULL);
    746746                #else
    747747                PetscOptionsGetInt(NULL,PETSC_NULL,"-schur_pc",&precond,NULL);
     
    774774                /*Obtain index sets for velocity and pressure components */
    775775                IS isv = NULL;
    776776                IS isp = NULL;
    777                 #if _PETSC_MAJOR_==3
     777                #if PETSC_VERSION_MAJOR==3
    778778
    779779                /*Make indices out of doftypes: */
    780780                if(!(df->pvector->vector))_error_("need doftypes for FS solver!\n");
  • ../trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp

     
    88#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    99#endif
    1010
     11#include <petscversion.h>
     12
    1113#include "./PetscSolver.h"
    1214#include "../../../shared/Numerics/Verbosity.h"
    1315#include "../../../shared/MemOps/MemOps.h"
     
    4648        int        iteration_number;
    4749        int        solver_type;
    4850        bool       fromlocalsize    = true;
    49         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     51        #if PETSC_VERSION_LT(3,2,0)
    5052        PetscTruth flag,flg;
    5153        #else
    5254        PetscBool flag,flg;
     
    5860        char ksp_type[50];
    5961
    6062        /*Display message*/
    61         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     63        #if PETSC_VERSION_LT(3,2,0)
    6264        if(VerboseSolver())PetscOptionsPrint(stdout);
    6365        #else
    64                 #if _PETSC_MINOR_<7
     66                #if PETSC_VERSION_LT(3,7,0)
    6567                if(VerboseSolver())PetscOptionsView(PETSC_VIEWER_STDOUT_WORLD);
    6668                #else
    6769                if(VerboseSolver())PetscOptionsView(NULL,PETSC_VIEWER_STDOUT_WORLD);
     
    7779
    7880        /*Initial guess */
    7981        /*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */
    80         #if _PETSC_MINOR_<7
     82        #if PETSC_VERSION_LT(3,7,0)
    8183        PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
    8284        #else
    8385        PetscOptionsGetString(NULL,PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
     
    106108
    107109        /*Prepare solver*/
    108110        KSPCreate(IssmComm::GetComm(),&ksp);
    109         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
     111        #if PETSC_VERSION_GE(3,5,0)
    110112                KSPSetOperators(ksp,Kff,Kff);
    111113        #else
    112114                KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN);
     
    116118        /*Specific solver?: */
    117119        KSPGetPC(ksp,&pc);
    118120        if (solver_type==MUMPSPACKAGE_LU){
    119                 #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=9)
     121                #if PETSC_VERSION_GE(3,9,0)
    120122                PCFactorSetMatSolverType(pc,MATSOLVERMUMPS);
    121123                #else
    122124                PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS);
     
    131133
    132134                /*Set field splits: */
    133135                KSPGetPC(ksp,&pc);
    134                 #if _PETSC_MINOR_==1
     136                #if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR == 1)
    135137                PCFieldSplitSetIS(pc,isv);
    136138                PCFieldSplitSetIS(pc,isp);
    137139                #else
     
    216218                VecRestoreArray(df,&df_local);
    217219
    218220                /*Create indices sets: */
    219                 #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     221                #if PETSC_VERSION_LT(3,2,0)
    220222                ISCreateGeneral(IssmComm::GetComm(),pressure_num,pressure_indices,&isp);
    221223                ISCreateGeneral(IssmComm::GetComm(),velocity_num,velocity_indices,&isv);
    222224                #else
  • ../trunk-jpl/src/c/toolkits/petsc/patches/KSPFree.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
     12#include <petscversion.h>
    1213#include <petscmat.h>
    1314#include <petscvec.h>
    1415#include <petscksp.h>
     
    1516
    1617void KSPFree(KSP* pksp){
    1718
    18         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     19        #if PETSC_VERSION_LT(3,2,0)
    1920        if(*pksp)KSPDestroy(*pksp);
    2021        *pksp=NULL;
    2122        #else
  • ../trunk-jpl/src/c/toolkits/petsc/patches/VecFree.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
     12#include <petscversion.h>
    1213#include <petscmat.h>
    1314#include <petscvec.h>
    1415#include <petscksp.h>
     
    1516
    1617void VecFree(Vec* pvec){
    1718
    18         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     19        #if PETSC_VERSION_LT(3,2,0)
    1920        if(*pvec)VecDestroy(*pvec);
    2021        #else
    2122        if(*pvec)VecDestroy(pvec);
  • ../trunk-jpl/src/c/toolkits/petsc/patches/MatFree.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
     12#include <petscversion.h>
    1213#include <petscmat.h>
    13 #include <petscmat.h>
     14#include <petscvec.h>
    1415#include <petscksp.h>
    1516
    1617void MatFree(Mat* pmat){
    1718
    18         #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     19        #if PETSC_VERSION_LT(3,2,0)
    1920        if(*pmat)MatDestroy(*pmat);
    2021        *pmat=NULL;
    2122        #else
  • ../trunk-jpl/src/c/toolkits/petsc/patches/MatMultPatch.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
     12#include <petscversion.h>
    1213#include <petscmat.h>
    1314#include <petscvec.h>
    1415#include <petscksp.h>
     
    3435                MatGetLocalSize(A,&m,&n);;
    3536                VecRelocalize(&X_rel,X,n,comm);
    3637                MatMult(A,X_rel,AX); ;
    37                 #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     38                #if PETSC_VERSION_LT(3,2,0)
    3839                VecDestroy(X_rel);
    3940                #else
    4041                VecDestroy(&X_rel);
  • ../trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
    12 #include "petscmat.h"
    13 #include "petscvec.h"
    14 #include "petscksp.h"
     12#include <petscversion.h>
     13#include <petscmat.h>
     14#include <petscvec.h>
     15#include <petscksp.h>
    1516
    1617#include "./petscpatches.h"
    1718
     
    2021void PetscOptionsDetermineSolverType(int* psolver_type){
    2122
    2223        char option[100];
    23    #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
     24        #if PETSC_VERSION_LT(3,2,0)
    2425        PetscTruth flag;
    2526        #else
    2627        PetscBool flag;
     
    3031        int solver_type=PETSCPACKAGE;
    3132
    3233        /*retrieve mat_type option: */
    33         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
     34        #if PETSC_VERSION_GE(3,7,0)
    3435        PetscOptionsGetString(NULL,PETSC_NULL,"-mat_type",&option[0],100,&flag);
    3536        #else
    3637        PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag);
     
    5556                solver_type=SUPERLUDISTPACKAGE;
    5657        }
    5758
    58         #if _PETSC_MAJOR_ >= 3
    59                 #if (_PETSC_MINOR_>=7)
     59        #if PETSC_VERSION_MAJOR >= 3
     60                #if PETSC_VERSION_MINOR >= 7
    6061                PetscOptionsGetString(NULL,PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
    6162                #else
    6263                PetscOptionsGetString(PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
     
    6667        }
    6768        #endif
    6869
    69         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
     70        #if PETSC_VERSION_GE(3,7,0)
    7071        PetscOptionsGetString(NULL,PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
    7172        #else
    7273        PetscOptionsGetString(PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
  • ../trunk-jpl/src/c/toolkits/petsc/patches/NewMat.cpp

     
    99#endif
    1010
    1111/*Petsc includes: */
     12#include <petscversion.h>
    1213#include <petscmat.h>
    1314#include <petscvec.h>
    1415#include <petscksp.h>
     
    3637        d_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    3738        o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    3839
    39         #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
     40        #if PETSC_VERSION_GT(3,2,0)
    4041        MatCreateAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
    4142        #else
    4243        MatCreateMPIAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
     
    6465        d_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    6566        o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
    6667
    67         #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
     68        #if PETSC_VERSION_GT(3,2,0)
    6869        if(sparsity==1){
    6970                MatCreateDense(comm,m,n,M,N,NULL,&outmatrix);
    7071        }
     
    8889        int    m,n;
    8990        int    d_nz,o_nz;
    9091
    91         #if _PETSC_MAJOR_ >= 3
    92         #if defined(_HAVE_PETSCDEV_) || _PETSC_MINOR_ >=4
     92        #if PETSC_VERSION_MAJOR >= 3
     93        #if defined(_HAVE_PETSCDEV_) || PETSC_VERSION_MINOR >=4
    9394        MatType type;
    9495        #else
    9596        const MatType type;
  • ../trunk-jpl/src/c/cores/controltao_core.cpp

     
    1010#include "../solutionsequences/solutionsequences.h"
    1111
    1212#if defined (_HAVE_TAO_)
    13 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     13#if defined _HAVE_PETSC_
     14#include <petscversion.h>
     15#if PETSC_VERSION_LT(3,5,0)
    1416#include <tao.h>
    1517#else
    1618#include <petsctao.h>
    1719#endif
     20#endif
    1821
    1922/*Local prototype*/
    20 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     23#if PETSC_VERSION_LT(3,5,0)
    2124int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*);
    2225int IssmMonitor(TaoSolver,void*);
    2326#else
     
    3740        int                 maxsteps,maxiter;
    3841        IssmDouble          gatol,grtol,gttol;
    3942        AppCtx              user;
    40         #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     43        #if PETSC_VERSION_LT(3,5,0)
    4144        TaoSolver           tao = 0;
    4245        #else
    4346        Tao                 tao = 0;
     
    5053        Vector<IssmDouble> *XU           = NULL;
    5154
    5255        /*Initialize TAO*/
    53         #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     56        #if PETSC_VERSION_LT(3,5,0)
    5457        int argc; char **args=NULL;
    5558        PetscGetArgs(&argc,&args);
    5659        ierr = TaoInitialize(&argc,&args,(char*)0,"");
     
    8285        TaoSetMonitor(tao,IssmMonitor,&user,NULL);
    8386        TaoSetMaximumFunctionEvaluations(tao,maxiter);
    8487        TaoSetMaximumIterations(tao,maxsteps);
    85         #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_<7)
     88        #if PETSC_VERSION_LT(3,7,0)
    8689        TaoSetTolerances(tao,0,0,gatol,grtol,gttol);
    8790        #else
    8891        TaoSetTolerances(tao,gatol,grtol,gttol);
     
    127130        xDelete<double>(user.J);
    128131        delete X;
    129132        TaoDestroy(&tao);
    130         #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     133        #if PETSC_VERSION_LT(3,5,0)
    131134        TaoFinalize();
    132135        #endif
    133136        G->pvector->vector = NULL;
     
    134137        delete G;
    135138}
    136139
    137 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     140#if PETSC_VERSION_LT(3,5,0)
    138141int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
    139142#else
    140143int FormFunctionGradient(Tao tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
     
    177180        /*Clean-up and return*/
    178181        return 0;
    179182}
    180 #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
     183#if PETSC_VERSION_LT(3,5,0)
    181184int IssmMonitor(TaoSolver tao, void *userCtx){
    182185#else
    183186int IssmMonitor(Tao tao, void *userCtx){
  • ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.h

     
    4747/* serial output macros: */
    4848#define VALUE pvalue
    4949#define SVALUE psvalue
    50 #define WRAPPER(modulename) extern "C" { int  IssmConfigModule(double* pvalue, char** psvalue, char* string)
     50#define WRAPPER(modulename) extern "C" { int IssmConfigModule(double* pvalue, char** psvalue, char* string)
    5151#endif
    5252
    5353/* serial arg counts: */
  • ../trunk-jpl/externalpackages/petsc/install-3.14-mac.sh

     
    3838        --download-zlib=1 \
    3939        --download-hdf5=1
    4040
    41 
    4241# Compile and install
    43 make
    44 make install
     42if [ $# -eq 0 ]; then
     43        make
     44        make install
     45else
     46        make -j $1
     47        make -j $1 install
     48fi
Note: See TracBrowser for help on using the repository browser.