--- a/dolfin/la/PETScKrylovSolver.cpp +++ b/dolfin/la/PETScKrylovSolver.cpp @@ -496,7 +496,12 @@ PetscViewerFormat format = PETSC_VIEWER_DEFAULT; PetscViewerAndFormat *vf; PetscViewerAndFormatCreate(viewer,format,&vf); - #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = KSPMonitorSet(_ksp, + (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, + vf, + (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 ierr = KSPMonitorSet(_ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, vf, --- a/dolfin/la/SLEPcEigenSolver.cpp +++ b/dolfin/la/SLEPcEigenSolver.cpp @@ -192,9 +192,15 @@ { PetscViewerAndFormat *vf; PetscViewerAndFormatCreate(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_DEFAULT, &vf); + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + EPSMonitorSet(_eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*, + PetscReal*,PetscInt,void*))EPSMonitorAll,vf, + (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #else EPSMonitorSet(_eps,(PetscErrorCode (*)(EPS,PetscInt,PetscInt,PetscScalar*,PetscScalar*, PetscReal*,PetscInt,void*))EPSMonitorAll,vf, (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); + #endif } } --- a/dolfin/nls/PETScSNESSolver.cpp +++ b/dolfin/nls/PETScSNESSolver.cpp @@ -209,10 +209,17 @@ PetscViewerFormat format = PETSC_VIEWER_DEFAULT; PetscViewerAndFormat *vf; PetscViewerAndFormatCreate(viewer,format,&vf); + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = SNESMonitorSet(_snes, + (PetscErrorCode (*)(SNES,PetscInt,PetscReal,void*)) SNESMonitorDefault, + vf, + (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #else ierr = SNESMonitorSet(_snes, (PetscErrorCode (*)(SNES,PetscInt,PetscReal,void*)) SNESMonitorDefault, vf, (PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); + #endif if (ierr != 0) petsc_error(ierr, __FILE__, "SNESMonitorSet"); } } @@ -516,7 +523,12 @@ PetscViewerAndFormat *vf; ierr = PetscViewerAndFormatCreate(viewer,format,&vf); if (ierr != 0) petsc_error(ierr, __FILE__, "PetscViewerAndFormatCreate"); - #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = KSPMonitorSet(ksp, + (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, + vf, + (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, vf, --- a/dolfin/nls/PETScTAOSolver.cpp +++ b/dolfin/nls/PETScTAOSolver.cpp @@ -257,17 +257,28 @@ #endif // Clear previous monitors + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = TaoMonitorCancel(_tao); + if (ierr != 0) petsc_error(ierr, __FILE__, "TaoMonitorCancel"); + #else ierr = TaoCancelMonitors(_tao); if (ierr != 0) petsc_error(ierr, __FILE__, "TaoCancelMonitors"); + #endif // Set the monitor if (parameters["monitor_convergence"]) { +#if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = TaoMonitorSet(_tao, +#else ierr = TaoSetMonitor(_tao, +#endif #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR <= 8 && PETSC_VERSION_RELEASE == 1 TaoDefaultMonitor, -#else +#elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 25 TaoMonitorDefault, +#else + (PetscErrorCode (*)(Tao, PetscCtx)) TaoMonitorDefault, #endif PETSC_VIEWER_STDOUT_(PetscObjectComm((PetscObject)_tao)), NULL); @@ -599,7 +610,12 @@ PetscViewerFormat format = PETSC_VIEWER_DEFAULT; PetscViewerAndFormat *vf; ierr = PetscViewerAndFormatCreate(viewer,format,&vf); - #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = KSPMonitorSet(ksp, + (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, + vf, + (PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, vf, --- a/dolfin/nls/TAOLinearBoundSolver.cpp +++ b/dolfin/nls/TAOLinearBoundSolver.cpp @@ -428,7 +428,10 @@ PetscViewerFormat format = PETSC_VIEWER_DEFAULT; PetscViewerAndFormat *vf; ierr = PetscViewerAndFormatCreate(viewer,format,&vf); - #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 + #if PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 25 + ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, + vf,(PetscErrorCode (*)(PetscCtxRt))PetscViewerAndFormatDestroy); + #elif PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR >= 15 ierr = KSPMonitorSet(ksp, (PetscErrorCode (*)(KSP,PetscInt,PetscReal,void*)) KSPMonitorTrueResidual, vf,(PetscErrorCode (*)(void**))PetscViewerAndFormatDestroy); #else