1af0996ceSBarry Smith #include <petsc/private/viewerimpl.h> /*I "petscsys.h" I*/ 25c6c1daeSBarry Smith 3ce78bad3SBarry Smith const char *const PetscViewerFormats[] = {"DEFAULT", "ASCII_MATLAB", "ASCII_MATHEMATICA", "ASCII_IMPL", "ASCII_INFO", "ASCII_INFO_DETAIL", "ASCII_COMMON", "ASCII_SYMMODU", "ASCII_INDEX", "ASCII_DENSE", "ASCII_MATRIXMARKET", "ASCII_PCICE", "ASCII_PYTHON", "ASCII_FACTOR_INFO", "ASCII_LATEX", "ASCII_XML", "ASCII_FLAMEGRAPH", "ASCII_GLVIS", "ASCII_CSV", "DRAW_BASIC", "DRAW_LG", "DRAW_LG_XRANGE", "DRAW_CONTOUR", "DRAW_PORTS", "VTK_VTS", "VTK_VTR", "VTK_VTU", "BINARY_MATLAB", "NATIVE", "HDF5_PETSC", "HDF5_VIZ", "HDF5_XDMF", "HDF5_MAT", "NOFORMAT", "LOAD_BALANCE", "FAILED", "ALL", "PetscViewerFormat", "PETSC_VIEWER_", NULL}; 45c6c1daeSBarry Smith 55c6c1daeSBarry Smith /*@C 6811af0c4SBarry Smith PetscViewerSetFormat - Sets the format for a `PetscViewer`. 75c6c1daeSBarry Smith 8ffeef943SBarry Smith Logically Collective, No Fortran Support 95c6c1daeSBarry Smith 10811af0c4SBarry Smith This routine is deprecated, you should use `PetscViewerPushFormat()`/`PetscViewerPopFormat()` 116a9046bcSBarry Smith 125c6c1daeSBarry Smith Input Parameters: 13811af0c4SBarry Smith + viewer - the `PetscViewer` 145c6c1daeSBarry Smith - format - the format 155c6c1daeSBarry Smith 163f423023SBarry Smith Level: deprecated 175c6c1daeSBarry Smith 183f423023SBarry Smith Note: 193f423023SBarry Smith See `PetscViewerFormat` for available values 20f55353a2SBarry Smith 21d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewerGetFormat()`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`, 22c2e3fba1SPatrick Sanan `PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()` 235c6c1daeSBarry Smith @*/ 24d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerSetFormat(PetscViewer viewer, PetscViewerFormat format) 25d71ae5a4SJacob Faibussowitsch { 265c6c1daeSBarry Smith PetscFunctionBegin; 275c6c1daeSBarry Smith if (!viewer) viewer = PETSC_VIEWER_STDOUT_SELF; 285c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 295c6c1daeSBarry Smith PetscValidLogicalCollectiveEnum(viewer, format, 2); 305c6c1daeSBarry Smith viewer->format = format; 313ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 325c6c1daeSBarry Smith } 335c6c1daeSBarry Smith 345d83a8b1SBarry Smith /*@ 35811af0c4SBarry Smith PetscViewerPushFormat - Sets the format for a `PetscViewer`. 365c6c1daeSBarry Smith 37c3339decSBarry Smith Logically Collective 385c6c1daeSBarry Smith 395c6c1daeSBarry Smith Input Parameters: 40811af0c4SBarry Smith + viewer - the `PetscViewer` 415c6c1daeSBarry Smith - format - the format 425c6c1daeSBarry Smith 435c6c1daeSBarry Smith Level: intermediate 445c6c1daeSBarry Smith 453f423023SBarry Smith Note: 463f423023SBarry Smith See `PetscViewerFormat` for available values 475c6c1daeSBarry Smith 4801311c95SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, 49db781477SPatrick Sanan `PetscViewerSetFormat()`, `PetscViewerPopFormat()` 505c6c1daeSBarry Smith @*/ 51d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerPushFormat(PetscViewer viewer, PetscViewerFormat format) 52d71ae5a4SJacob Faibussowitsch { 535c6c1daeSBarry Smith PetscFunctionBegin; 545c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 555c6c1daeSBarry Smith PetscValidLogicalCollectiveEnum(viewer, format, 2); 5608401ef6SPierre Jolivet PetscCheck(viewer->iformat <= PETSCVIEWERFORMATPUSHESMAX - 1, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Too many PetscViewerPushFormat(), perhaps you forgot PetscViewerPopFormat()?"); 575c6c1daeSBarry Smith 585c6c1daeSBarry Smith viewer->formats[viewer->iformat++] = viewer->format; 595c6c1daeSBarry Smith viewer->format = format; 603ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 615c6c1daeSBarry Smith } 625c6c1daeSBarry Smith 635d83a8b1SBarry Smith /*@ 643f423023SBarry Smith PetscViewerPopFormat - Resets the format for a `PetscViewer` to the value it had before the previous call to `PetscViewerPushFormat()` 655c6c1daeSBarry Smith 66c3339decSBarry Smith Logically Collective 675c6c1daeSBarry Smith 682fe279fdSBarry Smith Input Parameter: 69811af0c4SBarry Smith . viewer - the `PetscViewer` 705c6c1daeSBarry Smith 715c6c1daeSBarry Smith Level: intermediate 725c6c1daeSBarry Smith 7301311c95SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, 74db781477SPatrick Sanan `PetscViewerSetFormat()`, `PetscViewerPushFormat()` 755c6c1daeSBarry Smith @*/ 76d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerPopFormat(PetscViewer viewer) 77d71ae5a4SJacob Faibussowitsch { 785c6c1daeSBarry Smith PetscFunctionBegin; 795c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 803ba16761SJacob Faibussowitsch if (viewer->iformat <= 0) PetscFunctionReturn(PETSC_SUCCESS); 815c6c1daeSBarry Smith 825c6c1daeSBarry Smith viewer->format = viewer->formats[--viewer->iformat]; 833ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 845c6c1daeSBarry Smith } 855c6c1daeSBarry Smith 865d83a8b1SBarry Smith /*@ 87811af0c4SBarry Smith PetscViewerGetFormat - Gets the current format for `PetscViewer`. 88569e28a7SMatthew G. Knepley 8920f4b53cSBarry Smith Not Collective 90569e28a7SMatthew G. Knepley 91569e28a7SMatthew G. Knepley Input Parameter: 92811af0c4SBarry Smith . viewer - the `PetscViewer` 93569e28a7SMatthew G. Knepley 94569e28a7SMatthew G. Knepley Output Parameter: 95d8d19677SJose E. Roman . format - the format 96569e28a7SMatthew G. Knepley 97569e28a7SMatthew G. Knepley Level: intermediate 98569e28a7SMatthew G. Knepley 993f423023SBarry Smith Note: 1003f423023SBarry Smith See `PetscViewerFormat` for available values 101569e28a7SMatthew G. Knepley 1023f423023SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`, 103c2e3fba1SPatrick Sanan `PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()` 104569e28a7SMatthew G. Knepley @*/ 105d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerGetFormat(PetscViewer viewer, PetscViewerFormat *format) 106d71ae5a4SJacob Faibussowitsch { 1075c6c1daeSBarry Smith PetscFunctionBegin; 108*bdeea4fcSStefano Zampini PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 1095c6c1daeSBarry Smith *format = viewer->format; 1103ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 1115c6c1daeSBarry Smith } 112