#include "petscksp.h" PetscErrorCode KSPMonitorRegister(const char name[], PetscViewerType vtype, PetscViewerFormat format, PetscErrorCode (*monitor)(KSP, PetscInt, PetscReal, PetscViewerAndFormat *), PetscErrorCode (*create)(PetscViewer, PetscViewerFormat, void *, PetscViewerAndFormat **), PetscErrorCode (*destroy)(PetscViewerAndFormat **))Not Collective
name | - name of a new monitor routine | |
vtype | - A PetscViewerType for the output | |
format | - A PetscViewerFormat for the output | |
monitor | - Monitor routine | |
create | - Creation routine, or NULL | |
destroy | - Destruction routine, or NULL |
KSPMonitorRegister("my_monitor",PETSCVIEWERASCII,PETSC_VIEWER_ASCII_INFO_DETAIL,MyMonitor,NULL,NULL);
Then, your monitor can be chosen with the procedural interface via
KSPMonitorSetFromOptions(ksp,"-ksp_monitor_my_monitor","my_monitor",NULL)or at runtime via the option
-ksp_monitor_my_monitor