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
RevLine 
[25834]1Index: ../trunk-jpl/m4/issm_options.m4
2===================================================================
3--- ../trunk-jpl/m4/issm_options.m4 (revision 25709)
4+++ ../trunk-jpl/m4/issm_options.m4 (revision 25710)
5@@ -209,7 +209,7 @@
6 AC_MSG_CHECKING([if system copy of libc has fmemopen])
7 SYSTEM_FMEMOPEN=1
8 if test "${IS_MAC}" == "yes"; then
9- if [[ $(system_profiler SPSoftwareDataType | $(which grep) "System Version:" | sed -e "s/[[:space:]]*System Version: macOS //" | cut -d "." -f 2) -lt 13 ]]; then
10+ if [[ $(system_profiler SPSoftwareDataType | /usr/bin/grep "System Version:" | sed -e "s/[[:space:]]*System Version: macOS //" | cut -d "." -f 2) -lt 13 ]]; then
11 SYSTEM_FMEMOPEN=0
12 fi
13 fi
14@@ -377,9 +377,9 @@
15 ;;
16 *)
17 MATLABINCL="-I${MATLAB_ROOT}/extern/include"
18- MEXLINK=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep LDFLAGS | sed -e "s/ LDFLAGS = //g")
19- MEXLIB=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep CXXLIBS | sed -e "s/ CXXLIBS = //g")
20- MEXEXT=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | grep LDEXTENSION | sed -e "s/ LDEXTENSION = //g")
21+ MEXLINK=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep LDFLAGS | sed -e "s/ LDFLAGS = //g")
22+ MEXLIB=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep CXXLIBS | sed -e "s/ CXXLIBS = //g")
23+ MEXEXT=$(${MATLAB_ROOT}/bin/mex -v 2>&1 < /dev/null | /usr/bin/grep LDEXTENSION | sed -e "s/ LDEXTENSION = //g")
24 dnl version 2014 and up
25 if test -z "${MEXEXT}"; then
26 echo "#include <mex.h>" > conftest.cpp
27@@ -386,9 +386,9 @@
28 echo "void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){}" >> conftest.cpp
29 ${MATLAB_ROOT}/bin/mex -v -lmex conftest.cpp > conftest.tmp 2>&1
30 rm -f conftest.cpp
31- MEXLINK=$(cat conftest.tmp | grep LDFLAGS | sed -e "s/LDFLAGS ://g")
32- MEXLIB=$(cat conftest.tmp | grep LINKLIBS | sed -e "s/LINKLIBS ://g")
33- MEXEXT=$(cat conftest.tmp | grep LDEXT | sed -e "s/LDEXT ://g" | awk '{print $[1]}')
34+ MEXLINK=$(cat conftest.tmp | /usr/bin/grep LDFLAGS | sed -e "s/LDFLAGS ://g")
35+ MEXLIB=$(cat conftest.tmp | /usr/bin/grep LINKLIBS | sed -e "s/LINKLIBS ://g")
36+ MEXEXT=$(cat conftest.tmp | /usr/bin/grep LDEXT | sed -e "s/LDEXT ://g" | awk '{print $[1]}')
37 if test -z "${MEXEXT}"; then
38 cat conftest.tmp
39 fi
40@@ -507,7 +507,7 @@
41 BOOSTINCL="-I${BOOST_ROOT}/include"
42 #BOOSTLIB="-L$BOOST_ROOT/lib -lboost_python"
43 AC_MSG_CHECKING(for Boost version)
44- BOOST_VERSION=`cat ${BOOST_ROOT}/include/boost/version.hpp | grep "#define BOOST_VERSION " | sed 's/.*BOOST_VERSION //'`
45+ BOOST_VERSION=`cat ${BOOST_ROOT}/include/boost/version.hpp | /usr/bin/grep "#define BOOST_VERSION " | sed 's/.*BOOST_VERSION //'`
46 BOOST_VERSION_MAJOR=`expr ${BOOST_VERSION} / 100000`
47 BOOST_VERSION_MINOR=`expr ${BOOST_VERSION} / 100 % 1000`
48 AC_MSG_RESULT([${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}])
49@@ -547,13 +547,13 @@
50 dnl
51 DAKOTA_VERSION_OUTPUT=`${DAKOTA_ROOT}/bin/dakota -v`
52 if test -n "${DAKOTA_VERSION_OUTPUT}"; then
53- DAKOTA_VERSION=`echo ${DAKOTA_VERSION_OUTPUT} grep "Dakota version" | sed 's/Dakota version //' | sed 's/ .*//'`
54+ DAKOTA_VERSION=`echo ${DAKOTA_VERSION_OUTPUT} /usr/bin/grep "Dakota version" | sed 's/Dakota version //' | sed 's/ .*//'`
55 elif test -f "${DAKOTA_ROOT}/VERSION"; then
56- DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/VERSION | grep 'DAKOTA Version' | sed 's/.*DAKOTA Version //' | sed 's/ .*//'`
57+ DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/VERSION | /usr/bin/grep 'DAKOTA Version' | sed 's/.*DAKOTA Version //' | sed 's/ .*//'`
58 elif test -f "${DAKOTA_ROOT}/../src/src/CommandLineHandler.C"; then
59- DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.C | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
60+ 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/ .*//' `
61 elif test -f "${DAKOTA_ROOT}/../src/src/CommandLineHandler.cpp"; then
62- DAKOTA_VERSION=`cat ${DAKOTA_ROOT}/../src/src/CommandLineHandler.cpp | grep 'DAKOTA version' | grep 'release' | grep -v // | sed 's/.*DAKOTA version //' | sed 's/ .*//' `
63+ 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/ .*//' `
64 else
65 AC_MSG_ERROR([Dakota CommandLineHandler.C or CommandLineHandler.cpp file not found to determine DAKOTA_VERSION!]);
66 fi
67@@ -1207,21 +1207,19 @@
68
69 dnl PETSc libraries and header files
70 if test "x${HAVE_PETSC}" == "xyes"; then
71- AC_MSG_CHECKING(for PETSc version)
72 if ! test -f "${PETSC_ROOT}/include/petscversion.h"; then
73 AC_MSG_ERROR([PETSc not instaled correctly: file (${PETSC_ROOT}/include/petscversion.h) does not exist!]);
74 fi
75- PETSC_MAJOR=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_MAJOR" | sed 's/#define PETSC_VERSION_MAJOR//' | sed 's/ //g'`
76- PETSC_MINOR=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_MINOR" | sed 's/#define PETSC_VERSION_MINOR//' | sed 's/ //g'`
77- AC_DEFINE_UNQUOTED(_PETSC_MAJOR_, $PETSC_MAJOR, [PETSc version major])
78- AC_DEFINE_UNQUOTED(_PETSC_MINOR_, $PETSC_MINOR, [PETSc version minor])
79+
80+ AC_MSG_CHECKING(for PETSc version)
81+ PETSC_MAJOR=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_MAJOR" | sed 's/#define PETSC_VERSION_MAJOR//' | sed 's/ //g'`
82+ PETSC_MINOR=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_MINOR" | sed 's/#define PETSC_VERSION_MINOR//' | sed 's/ //g'`
83+ AC_DEFINE_UNQUOTED([_PETSC_MAJOR_], [$PETSC_MAJOR], [PETSc version major])
84+ AC_DEFINE_UNQUOTED([_PETSC_MINOR_], [$PETSC_MINOR], [PETSc version minor])
85 AC_MSG_RESULT([${PETSC_MAJOR}.${PETSC_MINOR}])
86
87- 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' `
88- PETSC_RELEASE=`cat ${PETSC_ROOT}/include/petscversion.h | grep "#define PETSC_VERSION_RELEASE" | sed 's/#define PETSC_VERSION_RELEASE//' | sed 's/ //g'`
89-
90 AC_MSG_CHECKING(whether PETSc is the development version)
91- dnl if test "x${PETSC_VERSION_DATE_HG}" == "xunknown"; then
92+ PETSC_RELEASE=`cat ${PETSC_ROOT}/include/petscversion.h | /usr/bin/grep "#define PETSC_VERSION_RELEASE" | sed 's/#define PETSC_VERSION_RELEASE//' | sed 's/ //g'`
93 if test "${PETSC_RELEASE}" == "0"; then
94 AC_DEFINE([_HAVE_PETSCDEV_], [1], [with PETSc-dev])
95 AC_MSG_RESULT([yes])
96@@ -2211,7 +2209,7 @@
97 AC_SUBST([GRAPHICSLIB])
98 else
99 if test -f "${PETSC_ROOT}/conf/petscvariables"; then
100- PETSC_REC_GRAPHICS_LIB=$(cat ${PETSC_ROOT}/conf/petscvariables | grep X_LIB)
101+ PETSC_REC_GRAPHICS_LIB=$(cat ${PETSC_ROOT}/conf/petscvariables | /usr/bin/grep X_LIB)
102 AC_MSG_ERROR([Xlib (graphics library) provided (${GRAPHICS_LIB}) does not exist! PETSc suggests the following library: ${PETSC_REC_GRAPHICS_LIB}]);
103 fi
104 AC_MSG_ERROR([Xlib (graphics library) provided (${GRAPHICS_LIB}) does not exist!]);
105@@ -2350,7 +2348,7 @@
106 AC_DEFINE([_HAVE_GMSH_], [1], [with Gmsh in ISSM src])
107
108 AC_MSG_CHECKING(for Gmsh version)
109- GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f 1`
110+ GMSH_VERSION_MAJOR=`${GMSH_ROOT}/bin/gmsh -info | /usr/bin/grep "Version" | sed -e "s/Version@<:@@<:@:blank:@:>@@:>@*:@<:@@<:@:blank:@:>@@:>@//" | cut -d "." -f 1`
111 AC_MSG_RESULT([${GMSH_VERSION_MAJOR}])
112 AC_DEFINE_UNQUOTED(_GMSH_VERSION_MAJOR_, $GMSH_VERSION_MAJOR, [Gmsh major version])
113 fi
114Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_schurcg.cpp
115===================================================================
116--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_schurcg.cpp (revision 25709)
117+++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_schurcg.cpp (revision 25710)
118@@ -12,8 +12,8 @@
119 #include <fstream>
120
121 #ifdef _HAVE_PETSC_
122+#include <petscversion.h>
123
124-
125 void SchurCGSolver(Vector<IssmDouble>** puf,Mat Kff, Vec pf, Vec uf0,IS isv,IS isp,Parameters* parameters){/*{{{*/
126
127 Mat A, B, BT; /* Saddle point block matrices */
128@@ -43,7 +43,7 @@
129
130 int precond = 0;
131
132- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
133+ #if PETSC_VERSION_LT(3,2,0)
134 PetscTruth flag,flg;
135 #else
136 PetscBool flag,flg;
137@@ -54,7 +54,7 @@
138 char pc_type[50];
139 int maxiter;
140
141- #if _PETSC_MINOR_<7
142+ #if PETSC_VERSION_LT(3,7,0)
143 PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
144 PetscOptionsGetString(PETSC_NULL,"-pc_type",pc_type,49,&flg);
145 PetscOptionsGetReal(PETSC_NULL,"-tol",&TOL,NULL);
146@@ -87,7 +87,7 @@
147 * where A is the elliptic submatrix, B^T represents the incompressibility,
148 * and I the Schur preconditioner (stored here, because the space was allocated either way)
149 * */
150- #if _PETSC_MINOR_>8
151+ #if PETSC_VERSION_GT(3,8,0)
152 MatCreateSubMatrix(Kff,isv,isv,MAT_INITIAL_MATRIX,&A);
153 MatCreateSubMatrix(Kff,isv,isp,MAT_INITIAL_MATRIX,&B);
154 MatCreateSubMatrix(Kff,isp,isv,MAT_INITIAL_MATRIX,&BT);
155@@ -98,7 +98,7 @@
156 #endif
157
158 /* Extract preconditioner matrix on the pressure space*/
159- #if _PETSC_MINOR_>8
160+ #if PETSC_VERSION_GT(3,8,0)
161 MatCreateSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
162 #else
163 MatGetSubMatrix(Kff,isp,isp,MAT_INITIAL_MATRIX,&IP);
164@@ -145,7 +145,7 @@
165
166 /* Create KSP context */
167 KSPCreate(IssmComm::GetComm(),&kspu);
168- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
169+ #if PETSC_VERSION_GE(3,5,0)
170 KSPSetOperators(kspu,A,A);
171 #else
172 KSPSetOperators(kspu,A,A,DIFFERENT_NONZERO_PATTERN);
173@@ -263,7 +263,7 @@
174
175 /* Create KSP context */
176 KSPCreate(IssmComm::GetComm(),&kspip);
177- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
178+ #if PETSC_VERSION_GE(3,5,0)
179 KSPSetOperators(kspip,IP,IP);
180 #else
181 KSPSetOperators(kspip,IP,IP,DIFFERENT_NONZERO_PATTERN);
182@@ -538,7 +538,7 @@
183 * To calculate the residual, only the necessary blocks need to be extracted */
184
185 /*Extract A, B, B^T */
186- #if _PETSC_MINOR_>8
187+ #if PETSC_VERSION_GT(3,8,0)
188 MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isv,MAT_INITIAL_MATRIX,&A);
189 MatCreateSubMatrix(Kff->pmatrix->matrix,isv,isp,MAT_INITIAL_MATRIX,&B);
190 MatCreateSubMatrix(Kff->pmatrix->matrix,isp,isv,MAT_INITIAL_MATRIX,&BT);
191@@ -741,7 +741,7 @@
192 Reduceloadx(pf, Kfs, ys); delete Kfs;
193
194 /*Create pressure matrix of choice*/
195- #if _PETSC_MINOR_<7
196+ #if PETSC_VERSION_LT(3,7,0)
197 PetscOptionsGetInt(PETSC_NULL,"-schur_pc",&precond,NULL);
198 #else
199 PetscOptionsGetInt(NULL,PETSC_NULL,"-schur_pc",&precond,NULL);
200@@ -774,7 +774,7 @@
201 /*Obtain index sets for velocity and pressure components */
202 IS isv = NULL;
203 IS isp = NULL;
204- #if _PETSC_MAJOR_==3
205+ #if PETSC_VERSION_MAJOR==3
206
207 /*Make indices out of doftypes: */
208 if(!(df->pvector->vector))_error_("need doftypes for FS solver!\n");
209Index: ../trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp
210===================================================================
211--- ../trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp (revision 25709)
212+++ ../trunk-jpl/src/c/toolkits/petsc/objects/PetscSolver.cpp (revision 25710)
213@@ -8,6 +8,8 @@
214 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
215 #endif
216
217+#include <petscversion.h>
218+
219 #include "./PetscSolver.h"
220 #include "../../../shared/Numerics/Verbosity.h"
221 #include "../../../shared/MemOps/MemOps.h"
222@@ -46,7 +48,7 @@
223 int iteration_number;
224 int solver_type;
225 bool fromlocalsize = true;
226- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
227+ #if PETSC_VERSION_LT(3,2,0)
228 PetscTruth flag,flg;
229 #else
230 PetscBool flag,flg;
231@@ -58,10 +60,10 @@
232 char ksp_type[50];
233
234 /*Display message*/
235- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
236+ #if PETSC_VERSION_LT(3,2,0)
237 if(VerboseSolver())PetscOptionsPrint(stdout);
238 #else
239- #if _PETSC_MINOR_<7
240+ #if PETSC_VERSION_LT(3,7,0)
241 if(VerboseSolver())PetscOptionsView(PETSC_VIEWER_STDOUT_WORLD);
242 #else
243 if(VerboseSolver())PetscOptionsView(NULL,PETSC_VIEWER_STDOUT_WORLD);
244@@ -77,7 +79,7 @@
245
246 /*Initial guess */
247 /*Now, check that we are not giving an initial guess to the solver, if we are running a direct solver: */
248- #if _PETSC_MINOR_<7
249+ #if PETSC_VERSION_LT(3,7,0)
250 PetscOptionsGetString(PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
251 #else
252 PetscOptionsGetString(NULL,PETSC_NULL,"-ksp_type",ksp_type,49,&flg);
253@@ -106,7 +108,7 @@
254
255 /*Prepare solver*/
256 KSPCreate(IssmComm::GetComm(),&ksp);
257- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=5)
258+ #if PETSC_VERSION_GE(3,5,0)
259 KSPSetOperators(ksp,Kff,Kff);
260 #else
261 KSPSetOperators(ksp,Kff,Kff,DIFFERENT_NONZERO_PATTERN);
262@@ -116,7 +118,7 @@
263 /*Specific solver?: */
264 KSPGetPC(ksp,&pc);
265 if (solver_type==MUMPSPACKAGE_LU){
266- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=9)
267+ #if PETSC_VERSION_GE(3,9,0)
268 PCFactorSetMatSolverType(pc,MATSOLVERMUMPS);
269 #else
270 PCFactorSetMatSolverPackage(pc,MATSOLVERMUMPS);
271@@ -131,7 +133,7 @@
272
273 /*Set field splits: */
274 KSPGetPC(ksp,&pc);
275- #if _PETSC_MINOR_==1
276+ #if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR == 1)
277 PCFieldSplitSetIS(pc,isv);
278 PCFieldSplitSetIS(pc,isp);
279 #else
280@@ -216,7 +218,7 @@
281 VecRestoreArray(df,&df_local);
282
283 /*Create indices sets: */
284- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
285+ #if PETSC_VERSION_LT(3,2,0)
286 ISCreateGeneral(IssmComm::GetComm(),pressure_num,pressure_indices,&isp);
287 ISCreateGeneral(IssmComm::GetComm(),velocity_num,velocity_indices,&isv);
288 #else
289Index: ../trunk-jpl/src/c/toolkits/petsc/patches/KSPFree.cpp
290===================================================================
291--- ../trunk-jpl/src/c/toolkits/petsc/patches/KSPFree.cpp (revision 25709)
292+++ ../trunk-jpl/src/c/toolkits/petsc/patches/KSPFree.cpp (revision 25710)
293@@ -9,6 +9,7 @@
294 #endif
295
296 /*Petsc includes: */
297+#include <petscversion.h>
298 #include <petscmat.h>
299 #include <petscvec.h>
300 #include <petscksp.h>
301@@ -15,7 +16,7 @@
302
303 void KSPFree(KSP* pksp){
304
305- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
306+ #if PETSC_VERSION_LT(3,2,0)
307 if(*pksp)KSPDestroy(*pksp);
308 *pksp=NULL;
309 #else
310Index: ../trunk-jpl/src/c/toolkits/petsc/patches/VecFree.cpp
311===================================================================
312--- ../trunk-jpl/src/c/toolkits/petsc/patches/VecFree.cpp (revision 25709)
313+++ ../trunk-jpl/src/c/toolkits/petsc/patches/VecFree.cpp (revision 25710)
314@@ -9,6 +9,7 @@
315 #endif
316
317 /*Petsc includes: */
318+#include <petscversion.h>
319 #include <petscmat.h>
320 #include <petscvec.h>
321 #include <petscksp.h>
322@@ -15,7 +16,7 @@
323
324 void VecFree(Vec* pvec){
325
326- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
327+ #if PETSC_VERSION_LT(3,2,0)
328 if(*pvec)VecDestroy(*pvec);
329 #else
330 if(*pvec)VecDestroy(pvec);
331Index: ../trunk-jpl/src/c/toolkits/petsc/patches/MatFree.cpp
332===================================================================
333--- ../trunk-jpl/src/c/toolkits/petsc/patches/MatFree.cpp (revision 25709)
334+++ ../trunk-jpl/src/c/toolkits/petsc/patches/MatFree.cpp (revision 25710)
335@@ -9,13 +9,14 @@
336 #endif
337
338 /*Petsc includes: */
339+#include <petscversion.h>
340 #include <petscmat.h>
341-#include <petscmat.h>
342+#include <petscvec.h>
343 #include <petscksp.h>
344
345 void MatFree(Mat* pmat){
346
347- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
348+ #if PETSC_VERSION_LT(3,2,0)
349 if(*pmat)MatDestroy(*pmat);
350 *pmat=NULL;
351 #else
352Index: ../trunk-jpl/src/c/toolkits/petsc/patches/MatMultPatch.cpp
353===================================================================
354--- ../trunk-jpl/src/c/toolkits/petsc/patches/MatMultPatch.cpp (revision 25709)
355+++ ../trunk-jpl/src/c/toolkits/petsc/patches/MatMultPatch.cpp (revision 25710)
356@@ -9,6 +9,7 @@
357 #endif
358
359 /*Petsc includes: */
360+#include <petscversion.h>
361 #include <petscmat.h>
362 #include <petscvec.h>
363 #include <petscksp.h>
364@@ -34,7 +35,7 @@
365 MatGetLocalSize(A,&m,&n);;
366 VecRelocalize(&X_rel,X,n,comm);
367 MatMult(A,X_rel,AX); ;
368- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
369+ #if PETSC_VERSION_LT(3,2,0)
370 VecDestroy(X_rel);
371 #else
372 VecDestroy(&X_rel);
373Index: ../trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp
374===================================================================
375--- ../trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp (revision 25709)
376+++ ../trunk-jpl/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp (revision 25710)
377@@ -9,9 +9,10 @@
378 #endif
379
380 /*Petsc includes: */
381-#include "petscmat.h"
382-#include "petscvec.h"
383-#include "petscksp.h"
384+#include <petscversion.h>
385+#include <petscmat.h>
386+#include <petscvec.h>
387+#include <petscksp.h>
388
389 #include "./petscpatches.h"
390
391@@ -20,7 +21,7 @@
392 void PetscOptionsDetermineSolverType(int* psolver_type){
393
394 char option[100];
395- #if _PETSC_MAJOR_ < 3 || (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 2)
396+ #if PETSC_VERSION_LT(3,2,0)
397 PetscTruth flag;
398 #else
399 PetscBool flag;
400@@ -30,7 +31,7 @@
401 int solver_type=PETSCPACKAGE;
402
403 /*retrieve mat_type option: */
404- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
405+ #if PETSC_VERSION_GE(3,7,0)
406 PetscOptionsGetString(NULL,PETSC_NULL,"-mat_type",&option[0],100,&flag);
407 #else
408 PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag);
409@@ -55,8 +56,8 @@
410 solver_type=SUPERLUDISTPACKAGE;
411 }
412
413- #if _PETSC_MAJOR_ >= 3
414- #if (_PETSC_MINOR_>=7)
415+ #if PETSC_VERSION_MAJOR >= 3
416+ #if PETSC_VERSION_MINOR >= 7
417 PetscOptionsGetString(NULL,PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
418 #else
419 PetscOptionsGetString(PETSC_NULL,"-pc_factor_mat_solver_package",&option[0],100,&flag);
420@@ -66,7 +67,7 @@
421 }
422 #endif
423
424- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_>=7)
425+ #if PETSC_VERSION_GE(3,7,0)
426 PetscOptionsGetString(NULL,PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
427 #else
428 PetscOptionsGetString(PETSC_NULL,"-issm_option_solver",&option[0],100,&flag);
429Index: ../trunk-jpl/src/c/toolkits/petsc/patches/NewMat.cpp
430===================================================================
431--- ../trunk-jpl/src/c/toolkits/petsc/patches/NewMat.cpp (revision 25709)
432+++ ../trunk-jpl/src/c/toolkits/petsc/patches/NewMat.cpp (revision 25710)
433@@ -9,6 +9,7 @@
434 #endif
435
436 /*Petsc includes: */
437+#include <petscversion.h>
438 #include <petscmat.h>
439 #include <petscvec.h>
440 #include <petscksp.h>
441@@ -36,7 +37,7 @@
442 d_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
443 o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
444
445- #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
446+ #if PETSC_VERSION_GT(3,2,0)
447 MatCreateAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
448 #else
449 MatCreateMPIAIJ(comm,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix);
450@@ -64,7 +65,7 @@
451 d_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
452 o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
453
454- #if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ > 2
455+ #if PETSC_VERSION_GT(3,2,0)
456 if(sparsity==1){
457 MatCreateDense(comm,m,n,M,N,NULL,&outmatrix);
458 }
459@@ -88,8 +89,8 @@
460 int m,n;
461 int d_nz,o_nz;
462
463- #if _PETSC_MAJOR_ >= 3
464- #if defined(_HAVE_PETSCDEV_) || _PETSC_MINOR_ >=4
465+ #if PETSC_VERSION_MAJOR >= 3
466+ #if defined(_HAVE_PETSCDEV_) || PETSC_VERSION_MINOR >=4
467 MatType type;
468 #else
469 const MatType type;
470Index: ../trunk-jpl/src/c/cores/controltao_core.cpp
471===================================================================
472--- ../trunk-jpl/src/c/cores/controltao_core.cpp (revision 25709)
473+++ ../trunk-jpl/src/c/cores/controltao_core.cpp (revision 25710)
474@@ -10,14 +10,17 @@
475 #include "../solutionsequences/solutionsequences.h"
476
477 #if defined (_HAVE_TAO_)
478-#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
479+#if defined _HAVE_PETSC_
480+#include <petscversion.h>
481+#if PETSC_VERSION_LT(3,5,0)
482 #include <tao.h>
483 #else
484 #include <petsctao.h>
485 #endif
486+#endif
487
488 /*Local prototype*/
489-#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
490+#if PETSC_VERSION_LT(3,5,0)
491 int FormFunctionGradient(TaoSolver,Vec,IssmDouble*,Vec,void*);
492 int IssmMonitor(TaoSolver,void*);
493 #else
494@@ -37,7 +40,7 @@
495 int maxsteps,maxiter;
496 IssmDouble gatol,grtol,gttol;
497 AppCtx user;
498- #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
499+ #if PETSC_VERSION_LT(3,5,0)
500 TaoSolver tao = 0;
501 #else
502 Tao tao = 0;
503@@ -50,7 +53,7 @@
504 Vector<IssmDouble> *XU = NULL;
505
506 /*Initialize TAO*/
507- #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
508+ #if PETSC_VERSION_LT(3,5,0)
509 int argc; char **args=NULL;
510 PetscGetArgs(&argc,&args);
511 ierr = TaoInitialize(&argc,&args,(char*)0,"");
512@@ -82,7 +85,7 @@
513 TaoSetMonitor(tao,IssmMonitor,&user,NULL);
514 TaoSetMaximumFunctionEvaluations(tao,maxiter);
515 TaoSetMaximumIterations(tao,maxsteps);
516- #if (_PETSC_MAJOR_==3) && (_PETSC_MINOR_<7)
517+ #if PETSC_VERSION_LT(3,7,0)
518 TaoSetTolerances(tao,0,0,gatol,grtol,gttol);
519 #else
520 TaoSetTolerances(tao,gatol,grtol,gttol);
521@@ -127,7 +130,7 @@
522 xDelete<double>(user.J);
523 delete X;
524 TaoDestroy(&tao);
525- #if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
526+ #if PETSC_VERSION_LT(3,5,0)
527 TaoFinalize();
528 #endif
529 G->pvector->vector = NULL;
530@@ -134,7 +137,7 @@
531 delete G;
532 }
533
534-#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
535+#if PETSC_VERSION_LT(3,5,0)
536 int FormFunctionGradient(TaoSolver tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
537 #else
538 int FormFunctionGradient(Tao tao, Vec Xpetsc, IssmDouble *fcn,Vec G,void *uservoid){
539@@ -177,7 +180,7 @@
540 /*Clean-up and return*/
541 return 0;
542 }
543-#if defined (_HAVE_PETSC_) && (_PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 5)
544+#if PETSC_VERSION_LT(3,5,0)
545 int IssmMonitor(TaoSolver tao, void *userCtx){
546 #else
547 int IssmMonitor(Tao tao, void *userCtx){
548Index: ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.h
549===================================================================
550--- ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.h (revision 25709)
551+++ ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.h (revision 25710)
552@@ -47,7 +47,7 @@
553 /* serial output macros: */
554 #define VALUE pvalue
555 #define SVALUE psvalue
556-#define WRAPPER(modulename) extern "C" { int IssmConfigModule(double* pvalue, char** psvalue, char* string)
557+#define WRAPPER(modulename) extern "C" { int IssmConfigModule(double* pvalue, char** psvalue, char* string)
558 #endif
559
560 /* serial arg counts: */
561Index: ../trunk-jpl/externalpackages/petsc/install-3.14-mac.sh
562===================================================================
563--- ../trunk-jpl/externalpackages/petsc/install-3.14-mac.sh (revision 25709)
564+++ ../trunk-jpl/externalpackages/petsc/install-3.14-mac.sh (revision 25710)
565@@ -38,7 +38,11 @@
566 --download-zlib=1 \
567 --download-hdf5=1
568
569-
570 # Compile and install
571-make
572-make install
573+if [ $# -eq 0 ]; then
574+ make
575+ make install
576+else
577+ make -j $1
578+ make -j $1 install
579+fi
Note: See TracBrowser for help on using the repository browser.