184cb2905SBarry Smith /* 2b0a32e0cSBarry Smith PetscViewers are objects where other objects can be looked at or stored. 384cb2905SBarry Smith */ 4a4963045SJacob Faibussowitsch #pragma once 5dfbe8321SBarry Smith 66420c192SJed Brown #include <petscsys.h> 7c619b03eSJed Brown #include <petscviewertypes.h> 80954c5ccSStefano Zampini #include <petscdrawtypes.h> 9e9fa29b7SSatish Balay 10ce78bad3SBarry Smith /* MANSEC = Sys */ 11ac09b921SBarry Smith /* SUBMANSEC = Viewer */ 12ac09b921SBarry Smith 13014dd563SJed Brown PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID; 14e9fa29b7SSatish Balay 1576bdecfbSBarry Smith /*J 1687497f52SBarry Smith PetscViewerType - String with the name of a PETSc `PetscViewer` implementation 17b9617806SBarry Smith 18b9617806SBarry Smith Level: beginner 19b9617806SBarry Smith 20d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewerSetType()`, `PetscViewer`, `PetscViewerRegister()`, `PetscViewerCreate()` 2176bdecfbSBarry Smith J*/ 2219fd82e9SBarry Smith typedef const char *PetscViewerType; 232692d6eeSBarry Smith #define PETSCVIEWERSOCKET "socket" 242692d6eeSBarry Smith #define PETSCVIEWERASCII "ascii" 252692d6eeSBarry Smith #define PETSCVIEWERBINARY "binary" 262692d6eeSBarry Smith #define PETSCVIEWERSTRING "string" 272692d6eeSBarry Smith #define PETSCVIEWERDRAW "draw" 282692d6eeSBarry Smith #define PETSCVIEWERVU "vu" 292692d6eeSBarry Smith #define PETSCVIEWERMATHEMATICA "mathematica" 302692d6eeSBarry Smith #define PETSCVIEWERHDF5 "hdf5" 314061b8bfSJed Brown #define PETSCVIEWERVTK "vtk" 322692d6eeSBarry Smith #define PETSCVIEWERMATLAB "matlab" 33e04113cfSBarry Smith #define PETSCVIEWERSAWS "saws" 348135c375SStefano Zampini #define PETSCVIEWERGLVIS "glvis" 354c02969dSBarry Smith #define PETSCVIEWERADIOS "adios" 361e50132fSMatthew G. Knepley #define PETSCVIEWEREXODUSII "exodusii" 375f34f2dcSJed Brown #define PETSCVIEWERCGNS "cgns" 3822d6dc08SStefano Zampini #define PETSCVIEWERPYTHON "python" 3922d6dc08SStefano Zampini #define PETSCVIEWERPYVISTA "pyvista" 4077ed5343SBarry Smith 41140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList PetscViewerList; 42607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerInitializePackage(void); 434bf303faSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerFinalizePackage(void); 447b2a1423SBarry Smith 45bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char[], PetscErrorCode (*)(PetscViewer)); 4630de9b25SBarry Smith 47014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm, PetscViewer *); 48014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer); 49014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm, FILE *, PetscViewer *); 507b2a1423SBarry Smith 51014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm, const char[], PetscViewer *); 52014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer, FILE *); 53014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *); 54a56f64adSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerADIOSOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *); 55014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer, PetscInt *); 56014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer, PetscInt); 57bc196f7cSDave May PETSC_EXTERN PetscErrorCode PetscViewerBinarySetUseMPIIO(PetscViewer, PetscBool); 58bc196f7cSDave May PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetUseMPIIO(PetscViewer, PetscBool *); 590fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO) 60014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer, MPI_File *); 61014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer, MPI_Offset *); 62014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer, MPI_Offset); 63951e3c8eSBarry Smith #endif 6439802e9eSBarry Smith 65014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm, const char[], int, PetscViewer *); 6689d949e2SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm, char[], size_t, PetscViewer *); 67014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm, const char[], const char[], int, int, int, int, PetscViewer *); 68d1da0b69SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerDrawSetDrawType(PetscViewer, PetscDrawType); 690954c5ccSStefano Zampini 70014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *); 71014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *); 724b0e389bSBarry Smith 738135c375SStefano Zampini /*E 743f423023SBarry Smith PetscViewerGLVisType - indicates what type of `PETSCVIEWERGLVIS` viewer to use 758135c375SStefano Zampini 763f423023SBarry Smith Values: 773f423023SBarry Smith + `PETSC_VIEWER_GLVIS_DUMP` - save the data to a file 783f423023SBarry Smith - `PETSC_VIEWER_GLVIS_SOCKET` - communicate the data to another program via a socket 793f423023SBarry Smith 8016a05f60SBarry Smith Level: beginner 8116a05f60SBarry Smith 823f423023SBarry Smith .seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()` 838135c375SStefano Zampini E*/ 849371c9d4SSatish Balay typedef enum { 859371c9d4SSatish Balay PETSC_VIEWER_GLVIS_DUMP, 869371c9d4SSatish Balay PETSC_VIEWER_GLVIS_SOCKET 879371c9d4SSatish Balay } PetscViewerGLVisType; 888135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisOpen(MPI_Comm, PetscViewerGLVisType, const char *, PetscInt, PetscViewer *); 8977eacf09SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetPrecision(PetscViewer, PetscInt); 908135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetSnapId(PetscViewer, PetscInt); 914cac2994SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetFields(PetscViewer, PetscInt, const char *[], PetscInt[], PetscErrorCode (*)(PetscObject, PetscInt, PetscObject[], void *), PetscObject[], void *, PetscErrorCode (*)(void *)); 928135c375SStefano Zampini 9319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer, PetscViewerType *); 9419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer, PetscViewerType); 95014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer *); 963f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetSubViewer(PetscViewer, MPI_Comm, PetscViewer *); 973f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubViewer(PetscViewer, MPI_Comm, PetscViewer *); 98ae39576cSLois Curfman McInnes 99014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer); 100014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer, PetscViewer); 101fe2efc57SMark PETSC_EXTERN PetscErrorCode PetscViewerViewFromOptions(PetscViewer, PetscObject, const char[]); 102f69a0ea3SMatthew Knepley 103014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer, const char[]); 104014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer, const char[]); 105014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer, const char *[]); 106090de74eSSatish Balay 107e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerReadable(PetscViewer, PetscBool *); 108e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerWritable(PetscViewer, PetscBool *); 109d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckReadable(PetscViewer); 110d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckWritable(PetscViewer); 111e24fdd67SVaclav Hapla 112b9617806SBarry Smith /*E 113b9617806SBarry Smith PetscViewerFormat - Way a viewer presents the object 114b9617806SBarry Smith 1153f423023SBarry Smith Values: 1163f423023SBarry Smith + `PETSC_VIEWER_DEFAULT` - default format for the specific object being viewed 1173f423023SBarry Smith . `PETSC_VIEWER_ASCII_MATLAB` - MATLAB format 118af27ebaaSBarry Smith . `PETSC_VIEWER_ASCII_DENSE` - print matrix as a dense two dimensiona array 119af27ebaaSBarry Smith . `PETSC_VIEWER_ASCII_IMPL` - implementation-specific format (which is in many cases the same as the default) 1203f423023SBarry Smith . `PETSC_VIEWER_ASCII_INFO` - basic information about object 121bd6a2ce3SJunchao Zhang . `PETSC_VIEWER_ASCII_INFO_DETAIL` - more detailed info about object (but still not vector or matrix entries) 122af27ebaaSBarry Smith . `PETSC_VIEWER_ASCII_COMMON` - identical output format for all objects of a particular type 123af27ebaaSBarry Smith . `PETSC_VIEWER_ASCII_INDEX` - (for vectors) prints the vector element number next to each vector entry 124af27ebaaSBarry Smith . `PETSC_VIEWER_ASCII_SYMMODU` - print parallel vectors without indicating the MPI process ranges that own the entries 1253f423023SBarry Smith . `PETSC_VIEWER_ASCII_VTK` - outputs the object to a VTK file (deprecated since v3.14) 126af27ebaaSBarry Smith . `PETSC_VIEWER_NATIVE` - store the object to the binary file in its native format (for example, dense 1273f423023SBarry Smith matrices are stored as dense), `DMDA` vectors are dumped directly to the 1283f423023SBarry Smith file instead of being first put in the natural ordering 1293f423023SBarry Smith . `PETSC_VIEWER_ASCII_LATEX` - output the data in LaTeX 1303f423023SBarry Smith . `PETSC_VIEWER_BINARY_MATLAB` - output additional information that can be used to read the data into MATLAB 1313f423023SBarry Smith . `PETSC_VIEWER_DRAW_BASIC` - views the vector with a simple 1d plot 1323f423023SBarry Smith . `PETSC_VIEWER_DRAW_LG` - views the vector with a line graph 1333f423023SBarry Smith - `PETSC_VIEWER_DRAW_CONTOUR` - views the vector with a contour plot 1343f423023SBarry Smith 13516a05f60SBarry Smith Level: beginner 13616a05f60SBarry Smith 1373f423023SBarry Smith Note: 1383f423023SBarry Smith A variety of specialized formats also exist 1393f423023SBarry Smith 140d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()` 141b9617806SBarry Smith E*/ 142fb9695e5SSatish Balay typedef enum { 143117016b1SBarry Smith PETSC_VIEWER_DEFAULT, 144f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_MATLAB, 1454ebda54eSMatthew Knepley PETSC_VIEWER_ASCII_MATHEMATICA, 146f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_IMPL, 147f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_INFO, 148456192e2SBarry Smith PETSC_VIEWER_ASCII_INFO_DETAIL, 149f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_COMMON, 150f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_SYMMODU, 151f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_INDEX, 152f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_DENSE, 1533c215bfdSMatthew Knepley PETSC_VIEWER_ASCII_MATRIXMARKET, 154493617b5SMatthew Knepley PETSC_VIEWER_ASCII_PCICE, 155cfaaf4edSHong Zhang PETSC_VIEWER_ASCII_PYTHON, 156cfaaf4edSHong Zhang PETSC_VIEWER_ASCII_FACTOR_INFO, 15767ad5babSMatthew G Knepley PETSC_VIEWER_ASCII_LATEX, 158bb1d7374SBarry Smith PETSC_VIEWER_ASCII_XML, 159d0a29bd7SConnor Ward PETSC_VIEWER_ASCII_FLAMEGRAPH, 1608135c375SStefano Zampini PETSC_VIEWER_ASCII_GLVIS, 16138144912Sdeepblu2718 PETSC_VIEWER_ASCII_CSV, 162f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_BASIC, 163f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_LG, 164bb046f40SHong Zhang PETSC_VIEWER_DRAW_LG_XRANGE, 165f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_CONTOUR, 166f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_PORTS, 1674061b8bfSJed Brown PETSC_VIEWER_VTK_VTS, 168a13bc4e3SShao-Ching Huang PETSC_VIEWER_VTK_VTR, 169b263465dSJed Brown PETSC_VIEWER_VTK_VTU, 170a261c58fSBarry Smith PETSC_VIEWER_BINARY_MATLAB, 171f3ef73ceSBarry Smith PETSC_VIEWER_NATIVE, 1728aa4816bSVaclav Hapla PETSC_VIEWER_HDF5_PETSC, 173ffe0aed0SMatthew G. Knepley PETSC_VIEWER_HDF5_VIZ, 1748aa4816bSVaclav Hapla PETSC_VIEWER_HDF5_XDMF, 175cbb4c999SVaclav Hapla PETSC_VIEWER_HDF5_MAT, 176ef5fdb51SBarry Smith PETSC_VIEWER_NOFORMAT, 177eafd5ff0SAlex Lindsay PETSC_VIEWER_LOAD_BALANCE, 1787962402dSFande Kong PETSC_VIEWER_FAILED, 1797962402dSFande Kong PETSC_VIEWER_ALL 180cfaaf4edSHong Zhang } PetscViewerFormat; 181014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[]; 182090de74eSSatish Balay 183edd03b47SJacob Faibussowitsch PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 7, 0, "PetscViewerPushFormat() / PetscViewerPopFormat()", ) PetscErrorCode PetscViewerSetFormat(PetscViewer, PetscViewerFormat); 184014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer, PetscViewerFormat); 185014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer); 186014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer, PetscViewerFormat *); 187014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer); 1884b0e389bSBarry Smith 189648c30bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPushCreateViewerOff(PetscBool); 190648c30bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsPopCreateViewerOff(void); 191648c30bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetCreateViewerOff(PetscBool *); 192648c30bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsCreateViewer(MPI_Comm, PetscOptions, const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *); 193648c30bcSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsCreateViewers(MPI_Comm, PetscOptions, const char[], const char[], PetscInt *, PetscViewer *, PetscViewerFormat *, PetscBool *); 194e83a5d19SLisandro Dalcin #define PetscOptionsViewer(a, b, c, d, e, f) PetscOptionsViewer_Private(PetscOptionsObject, a, b, c, d, e, f) 195ce78bad3SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsViewer_Private(PetscOptionItems, const char[], const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *); 196648c30bcSBarry Smith 197648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscViewerDestroy()", ) static inline PetscErrorCode PetscOptionsRestoreViewer(PetscViewer *viewer) 198648c30bcSBarry Smith { 199648c30bcSBarry Smith return PetscViewerDestroy(viewer); 200648c30bcSBarry Smith } 201648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsCreateViewer()", ) static inline PetscErrorCode PetscOptionsGetViewer(MPI_Comm comm, PetscOptions op, const char a[], const char b[], PetscViewer *v, PetscViewerFormat *f, PetscBool *fg) 202648c30bcSBarry Smith { 203648c30bcSBarry Smith return PetscOptionsCreateViewer(comm, op, a, b, v, f, fg); 204648c30bcSBarry Smith } 205648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsCreateViewers()", ) static inline PetscErrorCode PetscOptionsGetViewers(MPI_Comm comm, PetscOptions op, const char a[], const char b[], PetscInt *n, PetscViewer *v, PetscViewerFormat *f, PetscBool *fg) 206648c30bcSBarry Smith { 207648c30bcSBarry Smith return PetscOptionsCreateViewers(comm, op, a, b, n, v, f, fg); 208648c30bcSBarry Smith } 209648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsGetCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsGetViewerOff(PetscBool *fg) 210648c30bcSBarry Smith { 211648c30bcSBarry Smith return PetscOptionsGetCreateViewerOff(fg); 212648c30bcSBarry Smith } 213648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsPushCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsPushGetViewerOff(PetscBool fg) 214648c30bcSBarry Smith { 215648c30bcSBarry Smith return PetscOptionsPushCreateViewerOff(fg); 216648c30bcSBarry Smith } 217648c30bcSBarry Smith PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsPushCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsPopGetViewerOff(void) 218648c30bcSBarry Smith { 219648c30bcSBarry Smith return PetscOptionsPopCreateViewerOff(); 220648c30bcSBarry Smith } 2212bf49c77SBarry Smith 222ce78bad3SBarry Smith typedef struct { 2239371c9d4SSatish Balay PetscViewer viewer; 2249371c9d4SSatish Balay PetscViewerFormat format; 2259812b6beSJed Brown PetscInt view_interval; 2269371c9d4SSatish Balay void *data; 227*e15058bcSJames Wright PetscCtxDestroyFn *data_destroy; 228ce78bad3SBarry Smith } PetscViewerAndFormat; 229d7cbc13eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatCreate(PetscViewer, PetscViewerFormat, PetscViewerAndFormat **); 230fe01d993SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatDestroy(PetscViewerAndFormat **); 231fe01d993SBarry Smith 23277ed5343SBarry Smith /* 23377ed5343SBarry Smith Operations explicit to a particular class of viewers 23477ed5343SBarry Smith */ 235ed5c6e3eSMatthew Knepley 236014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer, FILE **); 237014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer, PetscFileMode *); 238014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer, PetscFileMode); 239060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType); 2403ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3); 2413ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3); 2421575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushSynchronized(PetscViewer); 2431575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopSynchronized(PetscViewer); 244014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer); 245014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer); 246014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer, PetscBool); 247014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer, PetscInt); 248014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer, PetscInt *); 249014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer, PetscInt); 250014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer, PetscInt); 251060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerASCIIRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType); 252014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer, int *); 253014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer, FILE **); 254060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType); 255f253e43cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer, const void *, PetscInt, PetscDataType); 2563e1d7bceSPierre Jolivet PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadAll(PetscViewer, void *, PetscCount, PetscCount, PetscCount, PetscDataType); 2576497c311SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteAll(PetscViewer, const void *, PetscCount, PetscCount, PetscCount, PetscDataType); 2583ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3); 25936a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer, char[], size_t); 26036a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringGetStringRead(PetscViewer, const char *[], size_t *); 26136a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetOwnString(PetscViewer); 262014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer); 263014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer, PetscBool); 264014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer, PetscBool *); 265014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer, PetscReal); 266014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer, PetscReal *); 267014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer, const char[], const char[], int, int, int, int); 268014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer, int, int); 269014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer, PetscInt, const PetscReal *); 270014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer, PetscInt *, const PetscReal **); 271014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer, const char[], int); 272014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer); 273807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipInfo(PetscViewer, PetscBool); 274807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipInfo(PetscViewer, PetscBool *); 275014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer, PetscBool); 276014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer, PetscBool *); 277014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer, PetscBool); 278014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer, PetscBool *); 279014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer, char ***); 28078fbdcc8SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer, const char *const *); 281c655490fSBarry Smith 282014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer, const char[]); 283ce78bad3SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer, const char *[]); 28477ed5343SBarry Smith 285014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE **); 286014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool); 287014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *); 2883ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3); 289014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer); 29055dcf840SMatthew Knepley 2917e4fd573SVaclav Hapla /*@C 2927e4fd573SVaclav Hapla PetscViewerVUSetMode - Sets the mode in which to open the file. 2937e4fd573SVaclav Hapla 2947e4fd573SVaclav Hapla Not Collective 2957e4fd573SVaclav Hapla 2967e4fd573SVaclav Hapla Input Parameters: 29787497f52SBarry Smith + viewer - The `PetscViewer` 2987e4fd573SVaclav Hapla - mode - The file mode 2997e4fd573SVaclav Hapla 3007e4fd573SVaclav Hapla Level: deprecated 3017e4fd573SVaclav Hapla 3027e4fd573SVaclav Hapla Note: 30387497f52SBarry Smith Use `PetscViewerFileSetMode()` instead. 3047e4fd573SVaclav Hapla 3053f423023SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFileSetMode()` 3067e4fd573SVaclav Hapla @*/ 307edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFileSetMode()", ) static inline PetscErrorCode PetscViewerVUSetMode(PetscViewer viewer, PetscFileMode mode) 308d71ae5a4SJacob Faibussowitsch { 3099371c9d4SSatish Balay return PetscViewerFileSetMode(viewer, mode); 3109371c9d4SSatish Balay } 3117e4fd573SVaclav Hapla 312607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void); 313014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void); 314014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **); 315014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char[]); 316014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer); 317014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int); 3184ebda54eSMatthew Knepley 319014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer); 320014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer); 3214ebda54eSMatthew Knepley 3229371c9d4SSatish Balay typedef enum { 3239371c9d4SSatish Balay PETSC_VTK_INVALID, 3249371c9d4SSatish Balay PETSC_VTK_POINT_FIELD, 3259371c9d4SSatish Balay PETSC_VTK_POINT_VECTOR_FIELD, 3269371c9d4SSatish Balay PETSC_VTK_CELL_FIELD, 3279371c9d4SSatish Balay PETSC_VTK_CELL_VECTOR_FIELD 3289371c9d4SSatish Balay } PetscViewerVTKFieldType; 329e630c359SToby Isaac PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer, PetscObject, PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject, PetscViewer), PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject); 330a8f87f1dSPatrick Sanan PETSC_EXTERN PetscErrorCode PetscViewerVTKGetDM(PetscViewer, PetscObject *); 331014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *); 3324061b8bfSJed Brown 33377ed5343SBarry Smith /* 334d70abbfaSBarry Smith These are all the default viewers that do not have to be explicitly opened 33577ed5343SBarry Smith */ 336014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm); 337014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm, PetscViewer *); 338014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm); 339014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm, PetscViewer *); 340014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm); 341014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm); 342014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm); 343014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_MATLAB_(MPI_Comm); 344a75e6a4aSMatthew G. Knepley PETSC_EXTERN PetscViewer PETSC_VIEWER_HDF5_(MPI_Comm); 3458135c375SStefano Zampini PETSC_EXTERN PetscViewer PETSC_VIEWER_GLVIS_(MPI_Comm); 3461e50132fSMatthew G. Knepley PETSC_EXTERN PetscViewer PETSC_VIEWER_EXODUSII_(MPI_Comm); 34722d6dc08SStefano Zampini PETSC_EXTERN PetscViewer PETSC_VIEWER_PYTHON_(MPI_Comm); 34822d6dc08SStefano Zampini PETSC_EXTERN PetscViewer PETSC_VIEWER_PYVISTA_(MPI_Comm); 349014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE; 3505311e20fSBarry Smith 351f09f0971SVáclav Hapla /*MC 35287497f52SBarry Smith PETSC_VIEWER_STDERR_SELF - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_SELF) 353f09f0971SVáclav Hapla 354f09f0971SVáclav Hapla Level: beginner 355f09f0971SVáclav Hapla M*/ 356b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF) 357f09f0971SVáclav Hapla 358f09f0971SVáclav Hapla /*MC 35987497f52SBarry Smith PETSC_VIEWER_STDERR_WORLD - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_WORLD) 360f09f0971SVáclav Hapla 361f09f0971SVáclav Hapla Level: beginner 362f09f0971SVáclav Hapla M*/ 363b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD) 36430de9b25SBarry Smith 36530de9b25SBarry Smith /*MC 36687497f52SBarry Smith PETSC_VIEWER_STDOUT_WORLD - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_WORLD) 36730de9b25SBarry Smith 36830de9b25SBarry Smith Level: beginner 36930de9b25SBarry Smith M*/ 37030de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 37130de9b25SBarry Smith 37230de9b25SBarry Smith /*MC 37387497f52SBarry Smith PETSC_VIEWER_STDOUT_SELF - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_SELF) 37430de9b25SBarry Smith 37530de9b25SBarry Smith Level: beginner 37630de9b25SBarry Smith M*/ 37730de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 37830de9b25SBarry Smith 37930de9b25SBarry Smith /*MC 38087497f52SBarry Smith PETSC_VIEWER_DRAW_WORLD - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_WORLD) 38130de9b25SBarry Smith 38230de9b25SBarry Smith Level: intermediate 38330de9b25SBarry Smith M*/ 384b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 38530de9b25SBarry Smith 38630de9b25SBarry Smith /*MC 38787497f52SBarry Smith PETSC_VIEWER_DRAW_SELF - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_SELF) 38830de9b25SBarry Smith 38930de9b25SBarry Smith Level: intermediate 39030de9b25SBarry Smith M*/ 39130de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 39230de9b25SBarry Smith 39330de9b25SBarry Smith /*MC 39487497f52SBarry Smith PETSC_VIEWER_SOCKET_WORLD - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_WORLD) 39530de9b25SBarry Smith 39630de9b25SBarry Smith Level: intermediate 39730de9b25SBarry Smith M*/ 398b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 39930de9b25SBarry Smith 40030de9b25SBarry Smith /*MC 40187497f52SBarry Smith PETSC_VIEWER_SOCKET_SELF - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_SELF) 40230de9b25SBarry Smith 40330de9b25SBarry Smith Level: intermediate 40430de9b25SBarry Smith M*/ 405b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 40630de9b25SBarry Smith 40730de9b25SBarry Smith /*MC 40887497f52SBarry Smith PETSC_VIEWER_BINARY_WORLD - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_WORLD) 40930de9b25SBarry Smith 41030de9b25SBarry Smith Level: intermediate 41130de9b25SBarry Smith M*/ 412b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 41330de9b25SBarry Smith 41430de9b25SBarry Smith /*MC 41587497f52SBarry Smith PETSC_VIEWER_BINARY_SELF - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_SELF) 41630de9b25SBarry Smith 41730de9b25SBarry Smith Level: intermediate 41830de9b25SBarry Smith M*/ 419b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 42030de9b25SBarry Smith 421cbb32127SBarry Smith /*MC 42287497f52SBarry Smith PETSC_VIEWER_MATLAB_WORLD - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_WORLD) 423cbb32127SBarry Smith 424cbb32127SBarry Smith Level: intermediate 425cbb32127SBarry Smith M*/ 426cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD) 427cbb32127SBarry Smith 428cbb32127SBarry Smith /*MC 42987497f52SBarry Smith PETSC_VIEWER_MATLAB_SELF - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_SELF) 430cbb32127SBarry Smith 431cbb32127SBarry Smith Level: intermediate 432cbb32127SBarry Smith M*/ 433cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF) 434cbb32127SBarry Smith 4357eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(), PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE) 43665ef3172SBarry Smith 4374a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStart(PetscViewer, PetscInt *, PetscInt *); 4389dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepMain(PetscViewer, PetscInt, PetscInt *, PetscInt); 4399dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndMain(PetscViewer, PetscInt *); 4404a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer, PetscMPIInt, PetscInt *); 4414a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer, PetscInt *); 442edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlStepMain()", ) static inline PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer, PetscInt i, PetscInt *mcnt, PetscInt cnt) 443d71ae5a4SJacob Faibussowitsch { 4449371c9d4SSatish Balay return PetscViewerFlowControlStepMain(viewer, i, mcnt, cnt); 4459371c9d4SSatish Balay } 446edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlEndMain()", ) static inline PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer, PetscInt *mcnt) 447d71ae5a4SJacob Faibussowitsch { 4489371c9d4SSatish Balay return PetscViewerFlowControlEndMain(viewer, mcnt); 4499371c9d4SSatish Balay } 450e03d165dSBarry Smith 45177ed5343SBarry Smith /* 452a5057860SBarry Smith PetscViewer writes to MATLAB .mat file 453cbb32127SBarry Smith */ 454014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer, int, int, const PetscScalar *, const char *); 455014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer, int, int, PetscScalar *, const char *); 456014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer, const char *, void *); 457cbb32127SBarry Smith 458e04113cfSBarry Smith #if defined(PETSC_HAVE_SAWS) 459e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject, PetscViewer); 460bfb97211SBarry Smith #endif 461bfb97211SBarry Smith 46222d6dc08SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerPythonSetType(PetscViewer, const char[]); 46322d6dc08SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerPythonGetType(PetscViewer, const char *[]); 46422d6dc08SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerPythonCreate(MPI_Comm, const char[], PetscViewer *); 46522d6dc08SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerPythonViewObject(PetscViewer, PetscObject); 46622d6dc08SStefano Zampini 467ce78bad3SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerMonitorLGSetUp(PetscViewer, const char[], const char[], const char[], PetscInt, const char *[], int, int, int, int); 468ce78bad3SBarry Smith 469b9617806SBarry Smith /*S 4703f423023SBarry Smith PetscViewers - Abstract collection of `PetscViewer`s. It is stored as an expandable array of viewers. 471b9617806SBarry Smith 472b9617806SBarry Smith Level: intermediate 473b9617806SBarry Smith 474d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`, 475db781477SPatrick Sanan `PetscViewersGetViewer()` 476b9617806SBarry Smith S*/ 47795fbd943SSatish Balay typedef struct _n_PetscViewers *PetscViewers; 478014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersCreate(MPI_Comm, PetscViewers *); 479014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers *); 480014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers, PetscInt, PetscViewer *); 481