| 1 |
--- a/dolfin/la/PETScKrylovSolver.cpp |
| 2 |
+++ b/dolfin/la/PETScKrylovSolver.cpp |
| 3 |
@@ -496,7 +496,12 @@ |
| 4 |
PetscViewerFormat format = PETSC_VIEWER_DEFAULT; |
| 5 |
PetscViewerAndFormat *vf; |
| 6 |
PetscViewerAndFormatCreate(viewer,format,&vf); |
| 7 |
- #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 8 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 9 |
+ ierr = KSPMonitorSet(_ksp, |
| 10 |
+ (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 11 |
+ vf, |
| 12 |
+ (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 13 |
+ #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 14 |
ierr = KSPMonitorSet(_ksp, |
| 15 |
(PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 16 |
vf, |
| 17 |
--- a/dolfin/la/SLEPcEigenSolver.cpp |
| 18 |
+++ b/dolfin/la/SLEPcEigenSolver.cpp |
| 19 |
@@ -192,9 +192,15 @@ |
| 20 |
{ |
| 21 |
PetscViewerAndFormat *vf; |
| 22 |
PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_DEFAULT, &vf); |
| 23 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 24 |
+ EPSMonitorSet(_eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*, |
| 25 |
+ PetscReal*,PetscInt,void*))EPSMonitorAll,vf, |
| 26 |
+ (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 27 |
+ #else |
| 28 |
EPSMonitorSet(_eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*, |
| 29 |
PetscReal*,PetscInt,void*))EPSMonitorAll,vf, |
| 30 |
(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); |
| 31 |
+ #endif |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
--- a/dolfin/nls/PETScSNESSolver.cpp |
| 36 |
+++ b/dolfin/nls/PETScSNESSolver.cpp |
| 37 |
@@ -209,10 +209,17 @@ |
| 38 |
PetscViewerFormat format = PETSC_VIEWER_DEFAULT; |
| 39 |
PetscViewerAndFormat *vf; |
| 40 |
PetscViewerAndFormatCreate(viewer,format,&vf); |
| 41 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 42 |
+ ierr = SNESMonitorSet(_snes, |
| 43 |
+ (PetscErrorCode (*)(SNES,PetscInt,PetscReal,void*)) SNESMonitorDefault, |
| 44 |
+ vf, |
| 45 |
+ (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 46 |
+ #else |
| 47 |
ierr = SNESMonitorSet(_snes, |
| 48 |
(PetscErrorCode (*)(SNES,PetscInt,PetscReal,void*)) SNESMonitorDefault, |
| 49 |
vf, |
| 50 |
(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); |
| 51 |
+ #endif |
| 52 |
if (ierr != 0) petsc_error(ierr, __FILE__, "SNESMonitorSet"); |
| 53 |
} |
| 54 |
} |
| 55 |
@@ -516,7 +523,12 @@ |
| 56 |
PetscViewerAndFormat *vf; |
| 57 |
ierr = PetscViewerAndFormatCreate(viewer,format,&vf); |
| 58 |
if (ierr != 0) petsc_error(ierr, __FILE__, "PetscViewerAndFormatCreate"); |
| 59 |
- #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 60 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 61 |
+ ierr = KSPMonitorSet(ksp, |
| 62 |
+ (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 63 |
+ vf, |
| 64 |
+ (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 65 |
+ #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 66 |
ierr = KSPMonitorSet(ksp, |
| 67 |
(PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 68 |
vf, |
| 69 |
--- a/dolfin/nls/PETScTAOSolver.cpp |
| 70 |
+++ b/dolfin/nls/PETScTAOSolver.cpp |
| 71 |
@@ -257,17 +257,28 @@ |
| 72 |
#endif |
| 73 |
|
| 74 |
// Clear previous monitors |
| 75 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 76 |
+ ierr = TaoMonitorCancel(_tao); |
| 77 |
+ if (ierr != 0) petsc_error(ierr, __FILE__, "TaoMonitorCancel"); |
| 78 |
+ #else |
| 79 |
ierr = TaoCancelMonitors(_tao); |
| 80 |
if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCancelMonitors"); |
| 81 |
+ #endif |
| 82 |
|
| 83 |
// Set the monitor |
| 84 |
if (parameters["monitor_convergence"]) |
| 85 |
{ |
| 86 |
+#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 87 |
+ ierr = TaoMonitorSet(_tao, |
| 88 |
+#else |
| 89 |
ierr = TaoSetMonitor(_tao, |
| 90 |
+#endif |
| 91 |
#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 8 && PETSC_VERSION_RELEASE == 1 |
| 92 |
TaoDefaultMonitor, |
| 93 |
-#else |
| 94 |
+#elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 25 |
| 95 |
TaoMonitorDefault, |
| 96 |
+#else |
| 97 |
+ (PetscErrorCode (*)(Tao, PetscCtx)) TaoMonitorDefault, |
| 98 |
#endif |
| 99 |
PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_tao)), |
| 100 |
NULL); |
| 101 |
@@ -599,7 +610,12 @@ |
| 102 |
PetscViewerFormat format = PETSC_VIEWER_DEFAULT; |
| 103 |
PetscViewerAndFormat *vf; |
| 104 |
ierr = PetscViewerAndFormatCreate(viewer,format,&vf); |
| 105 |
- #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 106 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 107 |
+ ierr = KSPMonitorSet(ksp, |
| 108 |
+ (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 109 |
+ vf, |
| 110 |
+ (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 111 |
+ #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 112 |
ierr = KSPMonitorSet(ksp, |
| 113 |
(PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 114 |
vf, |
| 115 |
--- a/dolfin/nls/TAOLinearBoundSolver.cpp |
| 116 |
+++ b/dolfin/nls/TAOLinearBoundSolver.cpp |
| 117 |
@@ -428,7 +428,10 @@ |
| 118 |
PetscViewerFormat format = PETSC_VIEWER_DEFAULT; |
| 119 |
PetscViewerAndFormat *vf; |
| 120 |
ierr = PetscViewerAndFormatCreate(viewer,format,&vf); |
| 121 |
- #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 122 |
+ #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 |
| 123 |
+ ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 124 |
+ vf,(PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); |
| 125 |
+ #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 |
| 126 |
ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, |
| 127 |
vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); |
| 128 |
#else |