File: deprecated-petsc-3.15.patch

package info (click to toggle)
dolfin 2019.2.0~legacy20240219.1c52e83-25
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,016 kB
  • sloc: xml: 104,040; cpp: 102,227; python: 24,356; sh: 472; makefile: 332; javascript: 226
file content (84 lines) | stat: -rw-r--r-- 4,272 bytes parent folder | download | duplicates (3)
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
diff --git a/dolfin/la/PETScKrylovSolver.cpp b/dolfin/la/PETScKrylovSolver.cpp
index e729093..afbde0f 100644
--- a/dolfin/la/PETScKrylovSolver.cpp
+++ b/dolfin/la/PETScKrylovSolver.cpp
@@ -496,10 +496,17 @@ void PETScKrylovSolver::monitor(bool monitor_convergence)
     PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
     PetscViewerAndFormat *vf;
     PetscViewerAndFormatCreate(viewer,format,&vf);
+    #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+    ierr = KSPMonitorSet(_ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+    #else
     ierr = KSPMonitorSet(_ksp,
                          (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                          vf,
                          (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+    #endif
     if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
   }
   else
diff --git a/dolfin/nls/PETScSNESSolver.cpp b/dolfin/nls/PETScSNESSolver.cpp
index 71bca08..9761f74 100644
--- a/dolfin/nls/PETScSNESSolver.cpp
+++ b/dolfin/nls/PETScSNESSolver.cpp
@@ -516,10 +516,17 @@ void PETScSNESSolver::set_linear_solver_parameters()
       PetscViewerAndFormat *vf;
       ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
       if (ierr != 0) petsc_error(ierr, __FILE__, "PetscViewerAndFormatCreate");
+      #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+      ierr = KSPMonitorSet(ksp,
+                           (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                           vf,
+                           (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #else
       ierr = KSPMonitorSet(ksp,
                            (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                            vf,
                            (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+      #endif
       if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
     }
 
diff --git a/dolfin/nls/PETScTAOSolver.cpp b/dolfin/nls/PETScTAOSolver.cpp
index cebb0de..96ecf55 100644
--- a/dolfin/nls/PETScTAOSolver.cpp
+++ b/dolfin/nls/PETScTAOSolver.cpp
@@ -576,10 +576,17 @@ void PETScTAOSolver::set_ksp_options()
         PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
         PetscViewerAndFormat *vf;
         ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+        ierr = KSPMonitorSet(ksp,
+                         (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                         vf,
+                         (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #else
         ierr = KSPMonitorSet(ksp,
                          (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                          vf,
                          (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #endif
         if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
       }
     }
diff --git a/dolfin/nls/TAOLinearBoundSolver.cpp b/dolfin/nls/TAOLinearBoundSolver.cpp
index 0ca775c..78fa1e7 100644
--- a/dolfin/nls/TAOLinearBoundSolver.cpp
+++ b/dolfin/nls/TAOLinearBoundSolver.cpp
@@ -413,8 +413,13 @@ void TAOLinearBoundSolver::set_ksp_options()
         PetscViewerFormat format = PETSC_VIEWER_DEFAULT;
         PetscViewerAndFormat *vf;
         ierr = PetscViewerAndFormatCreate(viewer,format,&vf);
+        #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15
+        ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual,
+                             vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #else
         ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidualNorm,
                              vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy);
+        #endif
         if (ierr != 0) petsc_error(ierr, __FILE__, "KSPMonitorSet");
       }
     }