Package: getdp / 2.11.3+dfsg1-2

petsc3.9-8610fc15.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
diff --git a/Kernel/LinAlg_PETSC.cpp b/Kernel/LinAlg_PETSC.cpp
index a5e9d3de2a5c29cb1751db6b428789281b2d38ea..8bce8f17089f62d1e5aa53b7c205fdd9cc2a7a9b 100644
--- a/Kernel/LinAlg_PETSC.cpp
+++ b/Kernel/LinAlg_PETSC.cpp
@@ -71,7 +71,7 @@ static void _try(int ierr)
 
 static int SolverInitialized = 0;
 
-#if ((PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 7)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 7))
 #define PetscTruth PetscBool
 #define PetscOptionsGetTruth(A, B, C, D) PetscOptionsGetBool(A, NULL, B, C, D)
 #define PetscOptionsInsertFile(A, B, C) PetscOptionsInsertFile(A, NULL, B, C)
@@ -186,7 +186,7 @@ void _fillseq(Vec &V, Vec &Vseq)
   VecScatterEnd(ctx, V, Vseq, INSERT_VALUES, SCATTER_FORWARD);
 #endif
 
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
   VecScatterDestroy(&ctx);
 #else
   VecScatterDestroy(ctx);
@@ -269,7 +269,7 @@ void LinAlg_CreateMatrix(gMatrix *M, gSolver *Solver, int n, int m)
 void LinAlg_DestroySolver(gSolver *Solver)
 {
   for(int i = 0; i < 10; i++){
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
     if(Solver->ksp[i]) _try(KSPDestroy(&Solver->ksp[i]));
     if(Solver->snes[i]) _try(SNESDestroy(&Solver->snes[i]));
 #else
@@ -281,7 +281,7 @@ void LinAlg_DestroySolver(gSolver *Solver)
 
 void LinAlg_DestroyVector(gVector *V)
 {
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
   _try(VecDestroy(&V->V));
   if(V->haveSeq) _try(VecDestroy(&V->Vseq));
 #else
@@ -292,7 +292,7 @@ void LinAlg_DestroyVector(gVector *V)
 
 void LinAlg_DestroyMatrix(gMatrix *M)
 {
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
   _try(MatDestroy(&M->M));
 #else
   _try(MatDestroy(M->M));
@@ -436,7 +436,7 @@ void LinAlg_PrintVector(FILE *file, gVector *V, bool matlab,
     _try(PetscViewerSetFormat(fd, PETSC_VIEWER_ASCII_MATLAB));
     _try(PetscObjectSetName((PetscObject)V->V, varName));
     _try(VecView(V->V, fd));
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
     _try(PetscViewerDestroy(&fd));
 #else
     _try(PetscViewerDestroy(fd));
@@ -480,7 +480,7 @@ void LinAlg_PrintMatrix(FILE *file, gMatrix *M, bool matlab,
     _try(PetscViewerSetFormat(fd2, PETSC_VIEWER_DEFAULT));
     _try(MatView(M->M, fd2));
 
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 2))
     _try(PetscViewerDestroy(&fd));
     _try(PetscViewerDestroy(&fd2));
 #else
@@ -1276,7 +1276,7 @@ static void _solve(gMatrix *A, gVector *B, gSolver *Solver, gVector *X,
 
   if(!Solver->ksp[kspIndex]) {
     _try(KSPCreate(MyComm, &Solver->ksp[kspIndex]));
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5))
     _try(KSPSetOperators(Solver->ksp[kspIndex], A->M, A->M));
 #else
     _try(KSPSetOperators(Solver->ksp[kspIndex], A->M, A->M, DIFFERENT_NONZERO_PATTERN));
@@ -1289,7 +1289,7 @@ static void _solve(gMatrix *A, gVector *B, gSolver *Solver, gVector *X,
     // native PETSc LU)
     _try(KSPSetType(Solver->ksp[kspIndex], "preonly"));
     _try(PCSetType(pc, PCLU));
-#if (PETSC_VERSION_RELEASE == 0)
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 9))
     _try(PCFactorSetMatSolverType(pc, "mumps"));
 #elif (PETSC_VERSION_MAJOR > 2) && defined(PETSC_HAVE_MUMPS)
     _try(PCFactorSetMatSolverPackage(pc, "mumps"));
@@ -1326,7 +1326,7 @@ static void _solve(gMatrix *A, gVector *B, gSolver *Solver, gVector *X,
       _try(PCGetType(pc, &pctype));
 #endif
 
-#if (PETSC_VERSION_RELEASE == 0)
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 9))
       MatSolverType stype;
       _try(PCFactorGetMatSolverType(pc, &stype));
 #elif (PETSC_VERSION_MAJOR > 2)
@@ -1339,7 +1339,7 @@ static void _solve(gMatrix *A, gVector *B, gSolver *Solver, gVector *X,
     }
   }
   else if(precond){
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5))
     _try(KSPSetReusePreconditioner(Solver->ksp[kspIndex], PETSC_FALSE));
     _try(KSPSetOperators(Solver->ksp[kspIndex], A->M, A->M));
 #else
@@ -1347,7 +1347,7 @@ static void _solve(gMatrix *A, gVector *B, gSolver *Solver, gVector *X,
 #endif
   }
   else{
-#if (PETSC_VERSION_RELEASE == 0 || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5)))
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 5))
     _try(KSPSetReusePreconditioner(Solver->ksp[kspIndex], PETSC_TRUE));
 #endif
   }
@@ -1535,7 +1535,7 @@ static void _solveNL(gMatrix *A, gVector *B, gMatrix *J, gVector *R, gSolver *So
   _try(KSPGetPC(ksp, &pc));
   _try(KSPSetType(ksp, "preonly"));
   _try(PCSetType(pc, PCLU));
-#if (PETSC_VERSION_RELEASE == 0)
+#if (PETSC_VERSION_RELEASE == 0) || ((PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR >= 9))
   _try(PCFactorSetMatSolverType(pc, "mumps"));
 #elif (PETSC_VERSION_MAJOR > 2) && defined(PETSC_HAVE_MUMPS)
   _try(PCFactorSetMatSolverPackage(pc, "mumps"));