xref: /petsc/include/petscviewer.h (revision 9812b6beaca2f2d41c6c1e490e18f5c703427107)
184cb2905SBarry Smith /*
2b0a32e0cSBarry Smith      PetscViewers are objects where other objects can be looked at or stored.
384cb2905SBarry Smith */
46524c165SJacob Faibussowitsch #ifndef PETSCVIEWER_H
526bd1501SBarry Smith #define PETSCVIEWER_H
6dfbe8321SBarry Smith 
76420c192SJed Brown #include <petscsys.h>
8c619b03eSJed Brown #include <petscviewertypes.h>
90954c5ccSStefano Zampini #include <petscdrawtypes.h>
10e9fa29b7SSatish Balay 
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 
20db781477SPatrick Sanan .seealso: `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"
3877ed5343SBarry Smith 
39140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList PetscViewerList;
40607a6623SBarry Smith PETSC_EXTERN PetscErrorCode    PetscViewerInitializePackage(void);
417b2a1423SBarry Smith 
42bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char[], PetscErrorCode (*)(PetscViewer));
4330de9b25SBarry Smith 
44014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm, PetscViewer *);
45014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
46014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm, FILE *, PetscViewer *);
477b2a1423SBarry Smith 
48014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm, const char[], PetscViewer *);
49014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer, FILE *);
50014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
51a56f64adSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerADIOSOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
52014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer, PetscInt *);
53014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer, PetscInt);
54bc196f7cSDave May PETSC_EXTERN PetscErrorCode PetscViewerBinarySetUseMPIIO(PetscViewer, PetscBool);
55bc196f7cSDave May PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetUseMPIIO(PetscViewer, PetscBool *);
560fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
57014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer, MPI_File *);
58014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer, MPI_Offset *);
59014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer, MPI_Offset);
60951e3c8eSBarry Smith #endif
6139802e9eSBarry Smith 
62014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm, const char[], int, PetscViewer *);
6389d949e2SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm, char[], size_t, PetscViewer *);
64014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm, const char[], const char[], int, int, int, int, PetscViewer *);
65d1da0b69SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerDrawSetDrawType(PetscViewer, PetscDrawType);
661f49e1f7SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDrawType(PetscViewer, PetscDrawType *);
67f55236e4SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerDrawSetTitle(PetscViewer, const char[]);
68f55236e4SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerDrawGetTitle(PetscViewer, const char *[]);
690954c5ccSStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDraw(PetscViewer, PetscInt, PetscDraw *);
700954c5ccSStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerDrawBaseAdd(PetscViewer, PetscInt);
710954c5ccSStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerDrawBaseSet(PetscViewer, PetscInt);
720954c5ccSStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDrawLG(PetscViewer, PetscInt, PetscDrawLG *);
730954c5ccSStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDrawAxis(PetscViewer, PetscInt, PetscDrawAxis *);
740954c5ccSStefano Zampini 
75014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
76014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
77014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
784b0e389bSBarry Smith 
798135c375SStefano Zampini /*E
808135c375SStefano Zampini     PetscViewerGLVisType - indicates what type of GLVis viewer to use
818135c375SStefano Zampini 
828135c375SStefano Zampini     Level: beginner
838135c375SStefano Zampini 
84db781477SPatrick Sanan .seealso: `PetscViewerGLVisOpen()`
858135c375SStefano Zampini E*/
869371c9d4SSatish Balay typedef enum {
879371c9d4SSatish Balay   PETSC_VIEWER_GLVIS_DUMP,
889371c9d4SSatish Balay   PETSC_VIEWER_GLVIS_SOCKET
899371c9d4SSatish Balay } PetscViewerGLVisType;
908135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisOpen(MPI_Comm, PetscViewerGLVisType, const char *, PetscInt, PetscViewer *);
9177eacf09SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetPrecision(PetscViewer, PetscInt);
928135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetSnapId(PetscViewer, PetscInt);
934cac2994SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetFields(PetscViewer, PetscInt, const char *[], PetscInt[], PetscErrorCode (*)(PetscObject, PetscInt, PetscObject[], void *), PetscObject[], void *, PetscErrorCode (*)(void *));
948135c375SStefano Zampini 
9519fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer, PetscViewerType *);
9619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer, PetscViewerType);
97014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer *);
983f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
993f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
100ae39576cSLois Curfman McInnes 
101014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
102014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer, PetscViewer);
103fe2efc57SMark PETSC_EXTERN PetscErrorCode PetscViewerViewFromOptions(PetscViewer, PetscObject, const char[]);
104f69a0ea3SMatthew Knepley 
105014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer, const char[]);
106014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer, const char[]);
107014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer, const char *[]);
108090de74eSSatish Balay 
109e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerReadable(PetscViewer, PetscBool *);
110e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerWritable(PetscViewer, PetscBool *);
111d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckReadable(PetscViewer);
112d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckWritable(PetscViewer);
113e24fdd67SVaclav Hapla 
1148ec8862eSJed Brown #define PETSC_VIEWER_ASCII_VTK_ATTR        PETSC_VIEWER_ASCII_VTK PETSC_DEPRECATED_ENUM("Legacy VTK deprecated; use PetscViewerVTKOpen() with XML (.vtr .vts .vtu) format (since 3.14)")
1158ec8862eSJed Brown #define PETSC_VIEWER_ASCII_VTK_CELL_ATTR   PETSC_VIEWER_ASCII_VTK_CELL PETSC_DEPRECATED_ENUM("Legacy VTK deprecated; use PetscViewerVTKOpen() with XML (.vtr .vts .vtu) format (since 3.14)")
1168ec8862eSJed Brown #define PETSC_VIEWER_ASCII_VTK_COORDS_ATTR PETSC_VIEWER_ASCII_VTK_COORDS PETSC_DEPRECATED_ENUM("Legacy VTK deprecated; use PetscViewerVTKOpen() with XML (.vtr .vts .vtu) format (since 3.14)")
117b9617806SBarry Smith /*E
118b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
119b9617806SBarry Smith 
120b9617806SBarry Smith    Level: beginner
121b9617806SBarry Smith 
122db781477SPatrick Sanan .seealso: `PetscViewer`, `PetscViewerType`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()`
123b9617806SBarry Smith E*/
124fb9695e5SSatish Balay typedef enum {
125117016b1SBarry Smith   PETSC_VIEWER_DEFAULT,
126f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
1274ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
128f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
129f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
130456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
131f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
132f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
133f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
134f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
1353c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
1368ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_DEPRECATED,
1378ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_ATTR = PETSC_VIEWER_ASCII_VTK_DEPRECATED,
1388ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_CELL_DEPRECATED,
1398ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_CELL_ATTR = PETSC_VIEWER_ASCII_VTK_CELL_DEPRECATED,
1408ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_COORDS_DEPRECATED,
1418ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_COORDS_ATTR = PETSC_VIEWER_ASCII_VTK_COORDS_DEPRECATED,
142493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
143cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
144cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
14567ad5babSMatthew G Knepley   PETSC_VIEWER_ASCII_LATEX,
146bb1d7374SBarry Smith   PETSC_VIEWER_ASCII_XML,
147d0a29bd7SConnor Ward   PETSC_VIEWER_ASCII_FLAMEGRAPH,
1488135c375SStefano Zampini   PETSC_VIEWER_ASCII_GLVIS,
14938144912Sdeepblu2718   PETSC_VIEWER_ASCII_CSV,
150f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
151f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
152bb046f40SHong Zhang   PETSC_VIEWER_DRAW_LG_XRANGE,
153f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
154f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
1554061b8bfSJed Brown   PETSC_VIEWER_VTK_VTS,
156a13bc4e3SShao-Ching Huang   PETSC_VIEWER_VTK_VTR,
157b263465dSJed Brown   PETSC_VIEWER_VTK_VTU,
158a261c58fSBarry Smith   PETSC_VIEWER_BINARY_MATLAB,
159f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
1608aa4816bSVaclav Hapla   PETSC_VIEWER_HDF5_PETSC,
161ffe0aed0SMatthew G. Knepley   PETSC_VIEWER_HDF5_VIZ,
1628aa4816bSVaclav Hapla   PETSC_VIEWER_HDF5_XDMF,
163cbb4c999SVaclav Hapla   PETSC_VIEWER_HDF5_MAT,
164ef5fdb51SBarry Smith   PETSC_VIEWER_NOFORMAT,
165eafd5ff0SAlex Lindsay   PETSC_VIEWER_LOAD_BALANCE,
1667962402dSFande Kong   PETSC_VIEWER_FAILED,
1677962402dSFande Kong   PETSC_VIEWER_ALL
168cfaaf4edSHong Zhang } PetscViewerFormat;
169014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[];
170090de74eSSatish Balay 
17125ef9dfeSBarry Smith PETSC_EXTERN                PETSC_DEPRECATED_FUNCTION("Use PetscViewerPushFormat()/PetscViewerPopFormat()") PetscErrorCode PetscViewerSetFormat(PetscViewer, PetscViewerFormat);
172014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer, PetscViewerFormat);
173014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
174014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer, PetscViewerFormat *);
175014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
1764b0e389bSBarry Smith 
177eb55bdffSLawrence Mitchell PETSC_EXTERN PetscErrorCode PetscOptionsPushGetViewerOff(PetscBool);
178a30ec4eaSSatish Balay PETSC_EXTERN PetscErrorCode PetscOptionsPopGetViewerOff(void);
179eb55bdffSLawrence Mitchell PETSC_EXTERN PetscErrorCode PetscOptionsGetViewerOff(PetscBool *);
18016413a6aSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetViewer(MPI_Comm, PetscOptions, const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
181e83a5d19SLisandro Dalcin #define PetscOptionsViewer(a, b, c, d, e, f) PetscOptionsViewer_Private(PetscOptionsObject, a, b, c, d, e, f)
1824416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsViewer_Private(PetscOptionItems *, const char[], const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
1832bf49c77SBarry Smith 
1849371c9d4SSatish Balay typedef struct {
1859371c9d4SSatish Balay   PetscViewer       viewer;
1869371c9d4SSatish Balay   PetscViewerFormat format;
1879371c9d4SSatish Balay   PetscDrawLG       lg;
188*9812b6beSJed Brown   PetscInt          view_interval;
1899371c9d4SSatish Balay   void             *data;
1909371c9d4SSatish Balay } PetscViewerAndFormat;
191d7cbc13eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatCreate(PetscViewer, PetscViewerFormat, PetscViewerAndFormat **);
192fe01d993SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatDestroy(PetscViewerAndFormat **);
193fe01d993SBarry Smith 
19477ed5343SBarry Smith /*
19577ed5343SBarry Smith    Operations explicit to a particular class of viewers
19677ed5343SBarry Smith */
197ed5c6e3eSMatthew Knepley 
198014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer, FILE **);
199014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer, PetscFileMode *);
200014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer, PetscFileMode);
201060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
2023ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
2033ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
2041575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushSynchronized(PetscViewer);
2051575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopSynchronized(PetscViewer);
206014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
207014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
208014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer, PetscBool);
209014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer, PetscInt);
210014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer, PetscInt *);
211014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer, PetscInt);
212014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer, PetscInt);
213060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerASCIIRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
214014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer, int *);
215014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer, FILE **);
216060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
217f253e43cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer, const void *, PetscInt, PetscDataType);
2185972f5f3SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadAll(PetscViewer, void *, PetscInt, PetscInt, PetscInt, PetscDataType);
2195972f5f3SLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteAll(PetscViewer, const void *, PetscInt, PetscInt, PetscInt, PetscDataType);
2203ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
22136a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer, char[], size_t);
22236a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringGetStringRead(PetscViewer, const char *[], size_t *);
22336a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetOwnString(PetscViewer);
224014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
225014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer, PetscBool);
226014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer, PetscBool *);
227014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer, PetscReal);
228014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer, PetscReal *);
229014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer, const char[], const char[], int, int, int, int);
230014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer, int, int);
231014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer, PetscInt, const PetscReal *);
232014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer, PetscInt *, const PetscReal **);
233014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer, const char[], int);
234014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
235807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipInfo(PetscViewer, PetscBool);
236807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipInfo(PetscViewer, PetscBool *);
237014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer, PetscBool);
238014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer, PetscBool *);
239014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer, PetscBool);
240014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer, PetscBool *);
241014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer, char ***);
24278fbdcc8SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer, const char *const *);
243c655490fSBarry Smith 
244014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer, const char[]);
245014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer, const char **);
24677ed5343SBarry Smith 
247014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE **);
248014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool);
249014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *);
2503ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
251014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
25255dcf840SMatthew Knepley 
2537e4fd573SVaclav Hapla /*@C
2547e4fd573SVaclav Hapla   PetscViewerVUSetMode - Sets the mode in which to open the file.
2557e4fd573SVaclav Hapla 
2567e4fd573SVaclav Hapla   Not Collective
2577e4fd573SVaclav Hapla 
2587e4fd573SVaclav Hapla   Input Parameters:
25987497f52SBarry Smith + viewer - The `PetscViewer`
2607e4fd573SVaclav Hapla - mode   - The file mode
2617e4fd573SVaclav Hapla 
2627e4fd573SVaclav Hapla   Level: deprecated
2637e4fd573SVaclav Hapla 
2647e4fd573SVaclav Hapla   Note:
26587497f52SBarry Smith   Use `PetscViewerFileSetMode()` instead.
2667e4fd573SVaclav Hapla 
267db781477SPatrick Sanan .seealso: `PetscViewerFileSetMode()`
2687e4fd573SVaclav Hapla @*/
269d71ae5a4SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION("Use PetscViewerFileSetMode (since v3.15)") static inline PetscErrorCode PetscViewerVUSetMode(PetscViewer viewer, PetscFileMode mode)
270d71ae5a4SJacob Faibussowitsch {
2719371c9d4SSatish Balay   return PetscViewerFileSetMode(viewer, mode);
2729371c9d4SSatish Balay }
2737e4fd573SVaclav Hapla 
274607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void);
275014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
276014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
277014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char[]);
278014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
279014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
2804ebda54eSMatthew Knepley 
281014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **);
282014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char[]);
283014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
284014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **);
285014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char[]);
286014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
2874ebda54eSMatthew Knepley 
2889371c9d4SSatish Balay typedef enum {
2899371c9d4SSatish Balay   PETSC_VTK_INVALID,
2909371c9d4SSatish Balay   PETSC_VTK_POINT_FIELD,
2919371c9d4SSatish Balay   PETSC_VTK_POINT_VECTOR_FIELD,
2929371c9d4SSatish Balay   PETSC_VTK_CELL_FIELD,
2939371c9d4SSatish Balay   PETSC_VTK_CELL_VECTOR_FIELD
2949371c9d4SSatish Balay } PetscViewerVTKFieldType;
295e630c359SToby Isaac PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer, PetscObject, PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject, PetscViewer), PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject);
296a8f87f1dSPatrick Sanan PETSC_EXTERN PetscErrorCode PetscViewerVTKGetDM(PetscViewer, PetscObject *);
297014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
2984061b8bfSJed Brown 
29977ed5343SBarry Smith /*
300d70abbfaSBarry Smith      These are all the default viewers that do not have to be explicitly opened
30177ed5343SBarry Smith */
302014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
303014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm, PetscViewer *);
304014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
305014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm, PetscViewer *);
306014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
307014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
308014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
309014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
310a75e6a4aSMatthew G. Knepley PETSC_EXTERN PetscViewer    PETSC_VIEWER_HDF5_(MPI_Comm);
3118135c375SStefano Zampini PETSC_EXTERN PetscViewer    PETSC_VIEWER_GLVIS_(MPI_Comm);
3121e50132fSMatthew G. Knepley PETSC_EXTERN PetscViewer    PETSC_VIEWER_EXODUSII_(MPI_Comm);
313014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
3145311e20fSBarry Smith 
315f09f0971SVáclav Hapla /*MC
31687497f52SBarry Smith   PETSC_VIEWER_STDERR_SELF  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_SELF)
317f09f0971SVáclav Hapla 
318f09f0971SVáclav Hapla   Level: beginner
319f09f0971SVáclav Hapla M*/
320b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
321f09f0971SVáclav Hapla 
322f09f0971SVáclav Hapla /*MC
32387497f52SBarry Smith   PETSC_VIEWER_STDERR_WORLD  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_WORLD)
324f09f0971SVáclav Hapla 
325f09f0971SVáclav Hapla   Level: beginner
326f09f0971SVáclav Hapla M*/
327b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
32830de9b25SBarry Smith 
32930de9b25SBarry Smith /*MC
33087497f52SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_WORLD)
33130de9b25SBarry Smith 
33230de9b25SBarry Smith   Level: beginner
33330de9b25SBarry Smith M*/
33430de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
33530de9b25SBarry Smith 
33630de9b25SBarry Smith /*MC
33787497f52SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_SELF)
33830de9b25SBarry Smith 
33930de9b25SBarry Smith   Level: beginner
34030de9b25SBarry Smith M*/
34130de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
34230de9b25SBarry Smith 
34330de9b25SBarry Smith /*MC
34487497f52SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_WORLD)
34530de9b25SBarry Smith 
34630de9b25SBarry Smith   Level: intermediate
34730de9b25SBarry Smith M*/
348b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
34930de9b25SBarry Smith 
35030de9b25SBarry Smith /*MC
35187497f52SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_SELF)
35230de9b25SBarry Smith 
35330de9b25SBarry Smith   Level: intermediate
35430de9b25SBarry Smith M*/
35530de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
35630de9b25SBarry Smith 
35730de9b25SBarry Smith /*MC
35887497f52SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_WORLD)
35930de9b25SBarry Smith 
36030de9b25SBarry Smith   Level: intermediate
36130de9b25SBarry Smith M*/
362b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
36330de9b25SBarry Smith 
36430de9b25SBarry Smith /*MC
36587497f52SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_SELF)
36630de9b25SBarry Smith 
36730de9b25SBarry Smith   Level: intermediate
36830de9b25SBarry Smith M*/
369b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
37030de9b25SBarry Smith 
37130de9b25SBarry Smith /*MC
37287497f52SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_WORLD)
37330de9b25SBarry Smith 
37430de9b25SBarry Smith   Level: intermediate
37530de9b25SBarry Smith M*/
376b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
37730de9b25SBarry Smith 
37830de9b25SBarry Smith /*MC
37987497f52SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_SELF)
38030de9b25SBarry Smith 
38130de9b25SBarry Smith   Level: intermediate
38230de9b25SBarry Smith M*/
383b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
38430de9b25SBarry Smith 
385cbb32127SBarry Smith /*MC
38687497f52SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_WORLD)
387cbb32127SBarry Smith 
388cbb32127SBarry Smith   Level: intermediate
389cbb32127SBarry Smith M*/
390cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
391cbb32127SBarry Smith 
392cbb32127SBarry Smith /*MC
39387497f52SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_SELF)
394cbb32127SBarry Smith 
395cbb32127SBarry Smith   Level: intermediate
396cbb32127SBarry Smith M*/
397cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
398cbb32127SBarry Smith 
3997eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(), PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
40065ef3172SBarry Smith 
4014a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStart(PetscViewer, PetscInt *, PetscInt *);
4029dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepMain(PetscViewer, PetscInt, PetscInt *, PetscInt);
4039dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndMain(PetscViewer, PetscInt *);
4044a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer, PetscMPIInt, PetscInt *);
4054a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer, PetscInt *);
406037ce8faSAidan Hamilton PETSC_DEPRECATED_FUNCTION("Use PetscViewerFlowControlStepMain (since v3.15)") static inline PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer, PetscInt i, PetscInt *mcnt, PetscInt cnt)
407d71ae5a4SJacob Faibussowitsch {
4089371c9d4SSatish Balay   return PetscViewerFlowControlStepMain(viewer, i, mcnt, cnt);
4099371c9d4SSatish Balay }
410037ce8faSAidan Hamilton PETSC_DEPRECATED_FUNCTION("Use PetscViewerFlowControlEndMain (since v3.15)") static inline PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer, PetscInt *mcnt)
411d71ae5a4SJacob Faibussowitsch {
4129371c9d4SSatish Balay   return PetscViewerFlowControlEndMain(viewer, mcnt);
4139371c9d4SSatish Balay }
414e03d165dSBarry Smith 
41577ed5343SBarry Smith /*
416a5057860SBarry Smith    PetscViewer writes to MATLAB .mat file
417cbb32127SBarry Smith */
418014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer, int, int, const PetscScalar *, const char *);
419014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer, int, int, PetscScalar *, const char *);
420014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer, const char *, void *);
421cbb32127SBarry Smith 
422e04113cfSBarry Smith #if defined(PETSC_HAVE_SAWS)
423e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject, PetscViewer);
424bfb97211SBarry Smith #endif
425bfb97211SBarry Smith 
426b9617806SBarry Smith /*S
42787497f52SBarry Smith      PetscViewers - Abstract collection of `PetscViewer`s. It is just an expandable array of viewers.
428b9617806SBarry Smith 
429b9617806SBarry Smith    Level: intermediate
430b9617806SBarry Smith 
431db781477SPatrick Sanan .seealso: `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`,
432db781477SPatrick Sanan           `PetscViewersGetViewer()`
433b9617806SBarry Smith S*/
43495fbd943SSatish Balay typedef struct _n_PetscViewers *PetscViewers;
435014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersCreate(MPI_Comm, PetscViewers *);
436014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersDestroy(PetscViewers *);
437014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersGetViewer(PetscViewers, PetscInt, PetscViewer *);
438d132466eSBarry Smith 
439cb5b572fSBarry Smith #endif
440