xref: /petsc/include/petscviewer.h (revision 6dd63270497ad23dcf16ae500a87ff2b2a0b7474)
1 /*
2      PetscViewers are objects where other objects can be looked at or stored.
3 */
4 #pragma once
5 
6 #include <petscsys.h>
7 #include <petscviewertypes.h>
8 #include <petscdrawtypes.h>
9 
10 /* MANSEC = Sys */
11 /* SUBMANSEC = Viewer */
12 
13 PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID;
14 
15 /*J
16    PetscViewerType - String with the name of a PETSc `PetscViewer` implementation
17 
18    Level: beginner
19 
20 .seealso: [](sec_viewers), `PetscViewerSetType()`, `PetscViewer`, `PetscViewerRegister()`, `PetscViewerCreate()`
21 J*/
22 typedef const char *PetscViewerType;
23 #define PETSCVIEWERSOCKET      "socket"
24 #define PETSCVIEWERASCII       "ascii"
25 #define PETSCVIEWERBINARY      "binary"
26 #define PETSCVIEWERSTRING      "string"
27 #define PETSCVIEWERDRAW        "draw"
28 #define PETSCVIEWERVU          "vu"
29 #define PETSCVIEWERMATHEMATICA "mathematica"
30 #define PETSCVIEWERHDF5        "hdf5"
31 #define PETSCVIEWERVTK         "vtk"
32 #define PETSCVIEWERMATLAB      "matlab"
33 #define PETSCVIEWERSAWS        "saws"
34 #define PETSCVIEWERGLVIS       "glvis"
35 #define PETSCVIEWERADIOS       "adios"
36 #define PETSCVIEWEREXODUSII    "exodusii"
37 #define PETSCVIEWERCGNS        "cgns"
38 #define PETSCVIEWERPYTHON      "python"
39 #define PETSCVIEWERPYVISTA     "pyvista"
40 
41 PETSC_EXTERN PetscFunctionList PetscViewerList;
42 PETSC_EXTERN PetscErrorCode    PetscViewerInitializePackage(void);
43 PETSC_EXTERN PetscErrorCode    PetscViewerFinalizePackage(void);
44 
45 PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char[], PetscErrorCode (*)(PetscViewer));
46 
47 PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm, PetscViewer *);
48 PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
49 PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm, FILE *, PetscViewer *);
50 
51 PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm, const char[], PetscViewer *);
52 PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer, FILE *);
53 PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
54 PETSC_EXTERN PetscErrorCode PetscViewerADIOSOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
55 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer, PetscInt *);
56 PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer, PetscInt);
57 PETSC_EXTERN PetscErrorCode PetscViewerBinarySetUseMPIIO(PetscViewer, PetscBool);
58 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetUseMPIIO(PetscViewer, PetscBool *);
59 #if defined(PETSC_HAVE_MPIIO)
60 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer, MPI_File *);
61 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer, MPI_Offset *);
62 PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer, MPI_Offset);
63 #endif
64 
65 PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm, const char[], int, PetscViewer *);
66 PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm, char[], size_t, PetscViewer *);
67 PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm, const char[], const char[], int, int, int, int, PetscViewer *);
68 PETSC_EXTERN PetscErrorCode PetscViewerDrawSetDrawType(PetscViewer, PetscDrawType);
69 
70 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
71 PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
72 
73 /*E
74     PetscViewerGLVisType - indicates what type of `PETSCVIEWERGLVIS` viewer to use
75 
76     Values:
77 +   `PETSC_VIEWER_GLVIS_DUMP`   - save the data to a file
78 -   `PETSC_VIEWER_GLVIS_SOCKET` - communicate the data to another program via a socket
79 
80     Level: beginner
81 
82 .seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`
83 E*/
84 typedef enum {
85   PETSC_VIEWER_GLVIS_DUMP,
86   PETSC_VIEWER_GLVIS_SOCKET
87 } PetscViewerGLVisType;
88 PETSC_EXTERN PetscErrorCode PetscViewerGLVisOpen(MPI_Comm, PetscViewerGLVisType, const char *, PetscInt, PetscViewer *);
89 PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetPrecision(PetscViewer, PetscInt);
90 PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetSnapId(PetscViewer, PetscInt);
91 PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetFields(PetscViewer, PetscInt, const char *[], PetscInt[], PetscErrorCode (*)(PetscObject, PetscInt, PetscObject[], void *), PetscObject[], void *, PetscErrorCode (*)(void *));
92 
93 PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer, PetscViewerType *);
94 PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer, PetscViewerType);
95 PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer *);
96 PETSC_EXTERN PetscErrorCode PetscViewerGetSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
97 PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
98 
99 PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
100 PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer, PetscViewer);
101 PETSC_EXTERN PetscErrorCode PetscViewerViewFromOptions(PetscViewer, PetscObject, const char[]);
102 
103 PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer, const char[]);
104 PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer, const char[]);
105 PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer, const char *[]);
106 
107 PETSC_EXTERN PetscErrorCode PetscViewerReadable(PetscViewer, PetscBool *);
108 PETSC_EXTERN PetscErrorCode PetscViewerWritable(PetscViewer, PetscBool *);
109 PETSC_EXTERN PetscErrorCode PetscViewerCheckReadable(PetscViewer);
110 PETSC_EXTERN PetscErrorCode PetscViewerCheckWritable(PetscViewer);
111 
112 /*E
113    PetscViewerFormat - Way a viewer presents the object
114 
115    Values:
116 +    `PETSC_VIEWER_DEFAULT`           - default format for the specific object being viewed
117 .    `PETSC_VIEWER_ASCII_MATLAB`      - MATLAB format
118 .    `PETSC_VIEWER_ASCII_DENSE`       - print matrix as a dense two dimensiona array
119 .    `PETSC_VIEWER_ASCII_IMPL`        - implementation-specific format (which is in many cases the same as the default)
120 .    `PETSC_VIEWER_ASCII_INFO`        - basic information about object
121 .    `PETSC_VIEWER_ASCII_INFO_DETAIL` - more detailed info about object (but still not vector or matrix entries)
122 .    `PETSC_VIEWER_ASCII_COMMON`      - identical output format for all objects of a particular type
123 .    `PETSC_VIEWER_ASCII_INDEX`       - (for vectors) prints the vector  element number next to each vector entry
124 .    `PETSC_VIEWER_ASCII_SYMMODU`     - print parallel vectors without indicating the MPI process ranges that own the entries
125 .    `PETSC_VIEWER_ASCII_VTK`         - outputs the object to a VTK file (deprecated since v3.14)
126 .    `PETSC_VIEWER_NATIVE`            - store the object to the binary file in its native format (for example, dense
127                                         matrices are stored as dense), `DMDA` vectors are dumped directly to the
128                                         file instead of being first put in the natural ordering
129 .    `PETSC_VIEWER_ASCII_LATEX`       - output the data in LaTeX
130 .    `PETSC_VIEWER_BINARY_MATLAB`     - output additional information that can be used to read the data into MATLAB
131 .    `PETSC_VIEWER_DRAW_BASIC`        - views the vector with a simple 1d plot
132 .    `PETSC_VIEWER_DRAW_LG`           - views the vector with a line graph
133 -    `PETSC_VIEWER_DRAW_CONTOUR`      - views the vector with a contour plot
134 
135    Level: beginner
136 
137    Note:
138    A variety of specialized formats also exist
139 
140 .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()`
141 E*/
142 typedef enum {
143   PETSC_VIEWER_DEFAULT,
144   PETSC_VIEWER_ASCII_MATLAB,
145   PETSC_VIEWER_ASCII_MATHEMATICA,
146   PETSC_VIEWER_ASCII_IMPL,
147   PETSC_VIEWER_ASCII_INFO,
148   PETSC_VIEWER_ASCII_INFO_DETAIL,
149   PETSC_VIEWER_ASCII_COMMON,
150   PETSC_VIEWER_ASCII_SYMMODU,
151   PETSC_VIEWER_ASCII_INDEX,
152   PETSC_VIEWER_ASCII_DENSE,
153   PETSC_VIEWER_ASCII_MATRIXMARKET,
154   PETSC_VIEWER_ASCII_PCICE,
155   PETSC_VIEWER_ASCII_PYTHON,
156   PETSC_VIEWER_ASCII_FACTOR_INFO,
157   PETSC_VIEWER_ASCII_LATEX,
158   PETSC_VIEWER_ASCII_XML,
159   PETSC_VIEWER_ASCII_FLAMEGRAPH,
160   PETSC_VIEWER_ASCII_GLVIS,
161   PETSC_VIEWER_ASCII_CSV,
162   PETSC_VIEWER_DRAW_BASIC,
163   PETSC_VIEWER_DRAW_LG,
164   PETSC_VIEWER_DRAW_LG_XRANGE,
165   PETSC_VIEWER_DRAW_CONTOUR,
166   PETSC_VIEWER_DRAW_PORTS,
167   PETSC_VIEWER_VTK_VTS,
168   PETSC_VIEWER_VTK_VTR,
169   PETSC_VIEWER_VTK_VTU,
170   PETSC_VIEWER_BINARY_MATLAB,
171   PETSC_VIEWER_NATIVE,
172   PETSC_VIEWER_HDF5_PETSC,
173   PETSC_VIEWER_HDF5_VIZ,
174   PETSC_VIEWER_HDF5_XDMF,
175   PETSC_VIEWER_HDF5_MAT,
176   PETSC_VIEWER_NOFORMAT,
177   PETSC_VIEWER_LOAD_BALANCE,
178   PETSC_VIEWER_FAILED,
179   PETSC_VIEWER_ALL
180 } PetscViewerFormat;
181 PETSC_EXTERN const char *const PetscViewerFormats[];
182 
183 PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 7, 0, "PetscViewerPushFormat() / PetscViewerPopFormat()", ) PetscErrorCode PetscViewerSetFormat(PetscViewer, PetscViewerFormat);
184 PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer, PetscViewerFormat);
185 PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
186 PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer, PetscViewerFormat *);
187 PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
188 
189 PETSC_EXTERN PetscErrorCode PetscOptionsPushCreateViewerOff(PetscBool);
190 PETSC_EXTERN PetscErrorCode PetscOptionsPopCreateViewerOff(void);
191 PETSC_EXTERN PetscErrorCode PetscOptionsGetCreateViewerOff(PetscBool *);
192 PETSC_EXTERN PetscErrorCode PetscOptionsCreateViewer(MPI_Comm, PetscOptions, const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
193 PETSC_EXTERN PetscErrorCode PetscOptionsCreateViewers(MPI_Comm, PetscOptions, const char[], const char[], PetscInt *, PetscViewer *, PetscViewerFormat *, PetscBool *);
194 #define PetscOptionsViewer(a, b, c, d, e, f) PetscOptionsViewer_Private(PetscOptionsObject, a, b, c, d, e, f)
195 PETSC_EXTERN PetscErrorCode PetscOptionsViewer_Private(PetscOptionItems, const char[], const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
196 
197 PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscViewerDestroy()", ) static inline PetscErrorCode PetscOptionsRestoreViewer(PetscViewer *viewer)
198 {
199   return PetscViewerDestroy(viewer);
200 }
201 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)
202 {
203   return PetscOptionsCreateViewer(comm, op, a, b, v, f, fg);
204 }
205 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)
206 {
207   return PetscOptionsCreateViewers(comm, op, a, b, n, v, f, fg);
208 }
209 PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsGetCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsGetViewerOff(PetscBool *fg)
210 {
211   return PetscOptionsGetCreateViewerOff(fg);
212 }
213 PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsPushCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsPushGetViewerOff(PetscBool fg)
214 {
215   return PetscOptionsPushCreateViewerOff(fg);
216 }
217 PETSC_DEPRECATED_FUNCTION(3, 22, 0, "PetscOptionsPushCreateViewerOff()", ) static inline PetscErrorCode PetscOptionsPopGetViewerOff(void)
218 {
219   return PetscOptionsPopCreateViewerOff();
220 }
221 
222 typedef struct {
223   PetscViewer       viewer;
224   PetscViewerFormat format;
225   PetscInt          view_interval;
226   void             *data;
227 } PetscViewerAndFormat;
228 PETSC_EXTERN PetscErrorCode PetscViewerAndFormatCreate(PetscViewer, PetscViewerFormat, PetscViewerAndFormat **);
229 PETSC_EXTERN PetscErrorCode PetscViewerAndFormatDestroy(PetscViewerAndFormat **);
230 
231 /*
232    Operations explicit to a particular class of viewers
233 */
234 
235 PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer, FILE **);
236 PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer, PetscFileMode *);
237 PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer, PetscFileMode);
238 PETSC_EXTERN PetscErrorCode PetscViewerRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
239 PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
240 PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
241 PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushSynchronized(PetscViewer);
242 PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopSynchronized(PetscViewer);
243 PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
244 PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
245 PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer, PetscBool);
246 PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer, PetscInt);
247 PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer, PetscInt *);
248 PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer, PetscInt);
249 PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer, PetscInt);
250 PETSC_EXTERN PetscErrorCode PetscViewerASCIIRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
251 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer, int *);
252 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer, FILE **);
253 PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
254 PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer, const void *, PetscInt, PetscDataType);
255 PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadAll(PetscViewer, void *, PetscCount, PetscCount, PetscCount, PetscDataType);
256 PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteAll(PetscViewer, const void *, PetscCount, PetscCount, PetscCount, PetscDataType);
257 PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
258 PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer, char[], size_t);
259 PETSC_EXTERN PetscErrorCode PetscViewerStringGetStringRead(PetscViewer, const char *[], size_t *);
260 PETSC_EXTERN PetscErrorCode PetscViewerStringSetOwnString(PetscViewer);
261 PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
262 PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer, PetscBool);
263 PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer, PetscBool *);
264 PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer, PetscReal);
265 PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer, PetscReal *);
266 PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer, const char[], const char[], int, int, int, int);
267 PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer, int, int);
268 PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer, PetscInt, const PetscReal *);
269 PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer, PetscInt *, const PetscReal **);
270 PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer, const char[], int);
271 PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
272 PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipInfo(PetscViewer, PetscBool);
273 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipInfo(PetscViewer, PetscBool *);
274 PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer, PetscBool);
275 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer, PetscBool *);
276 PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer, PetscBool);
277 PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer, PetscBool *);
278 PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer, char ***);
279 PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer, const char *const *);
280 
281 PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer, const char[]);
282 PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer, const char *[]);
283 
284 PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE **);
285 PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool);
286 PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *);
287 PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
288 PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
289 
290 /*@C
291   PetscViewerVUSetMode - Sets the mode in which to open the file.
292 
293   Not Collective
294 
295   Input Parameters:
296 + viewer - The `PetscViewer`
297 - mode   - The file mode
298 
299   Level: deprecated
300 
301   Note:
302   Use `PetscViewerFileSetMode()` instead.
303 
304 .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFileSetMode()`
305 @*/
306 PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFileSetMode()", ) static inline PetscErrorCode PetscViewerVUSetMode(PetscViewer viewer, PetscFileMode mode)
307 {
308   return PetscViewerFileSetMode(viewer, mode);
309 }
310 
311 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void);
312 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
313 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
314 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char[]);
315 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
316 PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
317 
318 PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
319 PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
320 
321 typedef enum {
322   PETSC_VTK_INVALID,
323   PETSC_VTK_POINT_FIELD,
324   PETSC_VTK_POINT_VECTOR_FIELD,
325   PETSC_VTK_CELL_FIELD,
326   PETSC_VTK_CELL_VECTOR_FIELD
327 } PetscViewerVTKFieldType;
328 PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer, PetscObject, PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject, PetscViewer), PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject);
329 PETSC_EXTERN PetscErrorCode PetscViewerVTKGetDM(PetscViewer, PetscObject *);
330 PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
331 
332 /*
333      These are all the default viewers that do not have to be explicitly opened
334 */
335 PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
336 PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm, PetscViewer *);
337 PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
338 PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm, PetscViewer *);
339 PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
340 PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
341 PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
342 PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
343 PETSC_EXTERN PetscViewer    PETSC_VIEWER_HDF5_(MPI_Comm);
344 PETSC_EXTERN PetscViewer    PETSC_VIEWER_GLVIS_(MPI_Comm);
345 PETSC_EXTERN PetscViewer    PETSC_VIEWER_EXODUSII_(MPI_Comm);
346 PETSC_EXTERN PetscViewer    PETSC_VIEWER_PYTHON_(MPI_Comm);
347 PETSC_EXTERN PetscViewer    PETSC_VIEWER_PYVISTA_(MPI_Comm);
348 PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
349 
350 /*MC
351   PETSC_VIEWER_STDERR_SELF  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_SELF)
352 
353   Level: beginner
354 M*/
355 #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
356 
357 /*MC
358   PETSC_VIEWER_STDERR_WORLD  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_WORLD)
359 
360   Level: beginner
361 M*/
362 #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
363 
364 /*MC
365   PETSC_VIEWER_STDOUT_WORLD  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_WORLD)
366 
367   Level: beginner
368 M*/
369 #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
370 
371 /*MC
372   PETSC_VIEWER_STDOUT_SELF  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_SELF)
373 
374   Level: beginner
375 M*/
376 #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
377 
378 /*MC
379   PETSC_VIEWER_DRAW_WORLD  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_WORLD)
380 
381   Level: intermediate
382 M*/
383 #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
384 
385 /*MC
386   PETSC_VIEWER_DRAW_SELF  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_SELF)
387 
388   Level: intermediate
389 M*/
390 #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
391 
392 /*MC
393   PETSC_VIEWER_SOCKET_WORLD  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_WORLD)
394 
395   Level: intermediate
396 M*/
397 #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
398 
399 /*MC
400   PETSC_VIEWER_SOCKET_SELF  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_SELF)
401 
402   Level: intermediate
403 M*/
404 #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
405 
406 /*MC
407   PETSC_VIEWER_BINARY_WORLD  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_WORLD)
408 
409   Level: intermediate
410 M*/
411 #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
412 
413 /*MC
414   PETSC_VIEWER_BINARY_SELF  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_SELF)
415 
416   Level: intermediate
417 M*/
418 #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
419 
420 /*MC
421   PETSC_VIEWER_MATLAB_WORLD  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_WORLD)
422 
423   Level: intermediate
424 M*/
425 #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
426 
427 /*MC
428   PETSC_VIEWER_MATLAB_SELF  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_SELF)
429 
430   Level: intermediate
431 M*/
432 #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
433 
434 #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(), PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
435 
436 PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStart(PetscViewer, PetscInt *, PetscInt *);
437 PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepMain(PetscViewer, PetscInt, PetscInt *, PetscInt);
438 PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndMain(PetscViewer, PetscInt *);
439 PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer, PetscMPIInt, PetscInt *);
440 PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer, PetscInt *);
441 PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlStepMain()", ) static inline PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer, PetscInt i, PetscInt *mcnt, PetscInt cnt)
442 {
443   return PetscViewerFlowControlStepMain(viewer, i, mcnt, cnt);
444 }
445 PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlEndMain()", ) static inline PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer, PetscInt *mcnt)
446 {
447   return PetscViewerFlowControlEndMain(viewer, mcnt);
448 }
449 
450 /*
451    PetscViewer writes to MATLAB .mat file
452 */
453 PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer, int, int, const PetscScalar *, const char *);
454 PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer, int, int, PetscScalar *, const char *);
455 PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer, const char *, void *);
456 
457 #if defined(PETSC_HAVE_SAWS)
458 PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject, PetscViewer);
459 #endif
460 
461 PETSC_EXTERN PetscErrorCode PetscViewerPythonSetType(PetscViewer, const char[]);
462 PETSC_EXTERN PetscErrorCode PetscViewerPythonGetType(PetscViewer, const char *[]);
463 PETSC_EXTERN PetscErrorCode PetscViewerPythonCreate(MPI_Comm, const char[], PetscViewer *);
464 PETSC_EXTERN PetscErrorCode PetscViewerPythonViewObject(PetscViewer, PetscObject);
465 
466 PETSC_EXTERN PetscErrorCode PetscViewerMonitorLGSetUp(PetscViewer, const char[], const char[], const char[], PetscInt, const char *[], int, int, int, int);
467 
468 /*S
469    PetscViewers - Abstract collection of `PetscViewer`s. It is stored as an expandable array of viewers.
470 
471    Level: intermediate
472 
473 .seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`,
474           `PetscViewersGetViewer()`
475 S*/
476 typedef struct _n_PetscViewers *PetscViewers;
477 PETSC_EXTERN PetscErrorCode     PetscViewersCreate(MPI_Comm, PetscViewers *);
478 PETSC_EXTERN PetscErrorCode     PetscViewersDestroy(PetscViewers *);
479 PETSC_EXTERN PetscErrorCode     PetscViewersGetViewer(PetscViewers, PetscInt, PetscViewer *);
480