15c6c1daeSBarry Smith 2af0996ceSBarry Smith #include <petsc/private/viewerimpl.h> /*I "petscsys.h" I*/ 35c6c1daeSBarry Smith 49371c9d4SSatish Balay 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_VTK", "ASCII_VTK_CELL", "ASCII_VTK_COORDS", "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}; 55c6c1daeSBarry Smith 65c6c1daeSBarry Smith /*@C 7811af0c4SBarry Smith PetscViewerSetFormat - Sets the format for a `PetscViewer`. 85c6c1daeSBarry Smith 9c3339decSBarry Smith Logically Collective 105c6c1daeSBarry Smith 11811af0c4SBarry Smith This routine is deprecated, you should use `PetscViewerPushFormat()`/`PetscViewerPopFormat()` 126a9046bcSBarry Smith 135c6c1daeSBarry Smith Input Parameters: 14811af0c4SBarry Smith + viewer - the `PetscViewer` 155c6c1daeSBarry Smith - format - the format 165c6c1daeSBarry Smith 173f423023SBarry Smith Level: deprecated 185c6c1daeSBarry Smith 193f423023SBarry Smith Note: 203f423023SBarry Smith See `PetscViewerFormat` for available values 21f55353a2SBarry Smith 22d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewerGetFormat()`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`, 23c2e3fba1SPatrick Sanan `PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()` 245c6c1daeSBarry Smith @*/ 25d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerSetFormat(PetscViewer viewer, PetscViewerFormat format) 26d71ae5a4SJacob Faibussowitsch { 275c6c1daeSBarry Smith PetscFunctionBegin; 285c6c1daeSBarry Smith if (!viewer) viewer = PETSC_VIEWER_STDOUT_SELF; 295c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 305c6c1daeSBarry Smith PetscValidLogicalCollectiveEnum(viewer, format, 2); 315c6c1daeSBarry Smith viewer->format = format; 323ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 335c6c1daeSBarry Smith } 345c6c1daeSBarry Smith 355c6c1daeSBarry Smith /*@C 36811af0c4SBarry Smith PetscViewerPushFormat - Sets the format for a `PetscViewer`. 375c6c1daeSBarry Smith 38c3339decSBarry Smith Logically Collective 395c6c1daeSBarry Smith 405c6c1daeSBarry Smith Input Parameters: 41811af0c4SBarry Smith + viewer - the `PetscViewer` 425c6c1daeSBarry Smith - format - the format 435c6c1daeSBarry Smith 445c6c1daeSBarry Smith Level: intermediate 455c6c1daeSBarry Smith 463f423023SBarry Smith Note: 473f423023SBarry Smith See `PetscViewerFormat` for available values 485c6c1daeSBarry Smith 4901311c95SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, 50db781477SPatrick Sanan `PetscViewerSetFormat()`, `PetscViewerPopFormat()` 515c6c1daeSBarry Smith @*/ 52d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerPushFormat(PetscViewer viewer, PetscViewerFormat format) 53d71ae5a4SJacob Faibussowitsch { 545c6c1daeSBarry Smith PetscFunctionBegin; 555c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 565c6c1daeSBarry Smith PetscValidLogicalCollectiveEnum(viewer, format, 2); 5708401ef6SPierre Jolivet PetscCheck(viewer->iformat <= PETSCVIEWERFORMATPUSHESMAX - 1, PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Too many PetscViewerPushFormat(), perhaps you forgot PetscViewerPopFormat()?"); 585c6c1daeSBarry Smith 595c6c1daeSBarry Smith viewer->formats[viewer->iformat++] = viewer->format; 605c6c1daeSBarry Smith viewer->format = format; 613ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 625c6c1daeSBarry Smith } 635c6c1daeSBarry Smith 645c6c1daeSBarry Smith /*@C 653f423023SBarry Smith PetscViewerPopFormat - Resets the format for a `PetscViewer` to the value it had before the previous call to `PetscViewerPushFormat()` 665c6c1daeSBarry Smith 67c3339decSBarry Smith Logically Collective 685c6c1daeSBarry Smith 695c6c1daeSBarry Smith Input Parameters: 70811af0c4SBarry Smith . viewer - the `PetscViewer` 715c6c1daeSBarry Smith 725c6c1daeSBarry Smith Level: intermediate 735c6c1daeSBarry Smith 7401311c95SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFormat`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, 75db781477SPatrick Sanan `PetscViewerSetFormat()`, `PetscViewerPushFormat()` 765c6c1daeSBarry Smith @*/ 77d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerPopFormat(PetscViewer viewer) 78d71ae5a4SJacob Faibussowitsch { 795c6c1daeSBarry Smith PetscFunctionBegin; 805c6c1daeSBarry Smith PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 1); 813ba16761SJacob Faibussowitsch if (viewer->iformat <= 0) PetscFunctionReturn(PETSC_SUCCESS); 825c6c1daeSBarry Smith 835c6c1daeSBarry Smith viewer->format = viewer->formats[--viewer->iformat]; 843ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 855c6c1daeSBarry Smith } 865c6c1daeSBarry Smith 87569e28a7SMatthew G. Knepley /*@C 88811af0c4SBarry Smith PetscViewerGetFormat - Gets the current format for `PetscViewer`. 89569e28a7SMatthew G. Knepley 90*20f4b53cSBarry Smith Not Collective 91569e28a7SMatthew G. Knepley 92569e28a7SMatthew G. Knepley Input Parameter: 93811af0c4SBarry Smith . viewer - the `PetscViewer` 94569e28a7SMatthew G. Knepley 95569e28a7SMatthew G. Knepley Output Parameter: 96d8d19677SJose E. Roman . format - the format 97569e28a7SMatthew G. Knepley 98569e28a7SMatthew G. Knepley Level: intermediate 99569e28a7SMatthew G. Knepley 1003f423023SBarry Smith Note: 1013f423023SBarry Smith See `PetscViewerFormat` for available values 102569e28a7SMatthew G. Knepley 1033f423023SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`, 104c2e3fba1SPatrick Sanan `PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()` 105569e28a7SMatthew G. Knepley @*/ 106d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscViewerGetFormat(PetscViewer viewer, PetscViewerFormat *format) 107d71ae5a4SJacob Faibussowitsch { 1085c6c1daeSBarry Smith PetscFunctionBegin; 1095c6c1daeSBarry Smith *format = viewer->format; 1103ba16761SJacob Faibussowitsch PetscFunctionReturn(PETSC_SUCCESS); 1115c6c1daeSBarry Smith } 112