Actual source code: petscviewer.h

  1: /*
  2:      PetscViewers are objects where other objects can be looked at or stored.
  3: */
  4: #pragma once

  6: #include <petscsys.h>
  7: #include <petscviewertypes.h>
  8: #include <petscdrawtypes.h>

 10: /* MANSEC = Sys */
 11: /* SUBMANSEC = Viewer */

 13: PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID;

 15: /*J
 16:    PetscViewerType - String with the name of a PETSc `PetscViewer` implementation

 18:    Level: beginner

 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"

 41: PETSC_EXTERN PetscFunctionList PetscViewerList;
 42: PETSC_EXTERN PetscErrorCode    PetscViewerInitializePackage(void);
 43: PETSC_EXTERN PetscErrorCode    PetscViewerFinalizePackage(void);

 45: PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char[], PetscErrorCode (*)(PetscViewer));

 47: PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm, PetscViewer *);
 48: PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
 49: PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm, FILE *, PetscViewer *);

 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

 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);

 70: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
 71: PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);

 73: /*E
 74:     PetscViewerGLVisType - indicates what type of `PETSCVIEWERGLVIS` viewer to use

 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

 80:     Level: beginner

 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 *));

 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 *);

 99: PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
100: PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer, PetscViewer);
101: PETSC_EXTERN PetscErrorCode PetscViewerViewFromOptions(PetscViewer, PetscObject, const char[]);

103: PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer, const char[]);
104: PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer, const char[]);
105: PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer, const char *[]);

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);

112: /*E
113:    PetscViewerFormat - Way a viewer presents the object

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

135:    Level: beginner

137:    Note:
138:    A variety of specialized formats also exist

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[];

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);

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 *);

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: }

222: typedef struct {
223:   PetscViewer        viewer;
224:   PetscViewerFormat  format;
225:   PetscInt           view_interval;
226:   void              *data;
227:   PetscCtxDestroyFn *data_destroy;
228: } PetscViewerAndFormat;
229: PETSC_EXTERN PetscErrorCode PetscViewerAndFormatCreate(PetscViewer, PetscViewerFormat, PetscViewerAndFormat **);
230: PETSC_EXTERN PetscErrorCode PetscViewerAndFormatDestroy(PetscViewerAndFormat **);

232: /*
233:    Operations explicit to a particular class of viewers
234: */

236: PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer, FILE **);
237: PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer, PetscFileMode *);
238: PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer, PetscFileMode);
239: PETSC_EXTERN PetscErrorCode PetscViewerRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
240: PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
241: PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
242: PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushSynchronized(PetscViewer);
243: PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopSynchronized(PetscViewer);
244: PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
245: PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
246: PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer, PetscBool);
247: PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer, PetscInt);
248: PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer, PetscInt *);
249: PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer, PetscInt);
250: PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer, PetscInt);
251: PETSC_EXTERN PetscErrorCode PetscViewerASCIIRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
252: PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer, int *);
253: PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer, FILE **);
254: PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
255: PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer, const void *, PetscInt, PetscDataType);
256: PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadAll(PetscViewer, void *, PetscCount, PetscCount, PetscCount, PetscDataType);
257: PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteAll(PetscViewer, const void *, PetscCount, PetscCount, PetscCount, PetscDataType);
258: PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
259: PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer, char[], size_t);
260: PETSC_EXTERN PetscErrorCode PetscViewerStringGetStringRead(PetscViewer, const char *[], size_t *);
261: PETSC_EXTERN PetscErrorCode PetscViewerStringSetOwnString(PetscViewer);
262: PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
263: PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer, PetscBool);
264: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer, PetscBool *);
265: PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer, PetscReal);
266: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer, PetscReal *);
267: PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer, const char[], const char[], int, int, int, int);
268: PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer, int, int);
269: PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer, PetscInt, const PetscReal *);
270: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer, PetscInt *, const PetscReal **);
271: PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer, const char[], int);
272: PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
273: PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipInfo(PetscViewer, PetscBool);
274: PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipInfo(PetscViewer, PetscBool *);
275: PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer, PetscBool);
276: PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer, PetscBool *);
277: PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer, PetscBool);
278: PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer, PetscBool *);
279: PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer, char ***);
280: PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer, const char *const *);

282: PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer, const char[]);
283: PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer, const char *[]);

285: PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE **);
286: PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool);
287: PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *);
288: PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
289: PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);

291: /*@C
292:   PetscViewerVUSetMode - Sets the mode in which to open the file.

294:   Not Collective

296:   Input Parameters:
297: + viewer - The `PetscViewer`
298: - mode   - The file mode

300:   Level: deprecated

302:   Note:
303:   Use `PetscViewerFileSetMode()` instead.

305: .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFileSetMode()`
306: @*/
307: PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFileSetMode()", ) static inline PetscErrorCode PetscViewerVUSetMode(PetscViewer viewer, PetscFileMode mode)
308: {
309:   return PetscViewerFileSetMode(viewer, mode);
310: }

312: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void);
313: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
314: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
315: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char[]);
316: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
317: PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);

319: PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
320: PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);

322: typedef enum {
323:   PETSC_VTK_INVALID,
324:   PETSC_VTK_POINT_FIELD,
325:   PETSC_VTK_POINT_VECTOR_FIELD,
326:   PETSC_VTK_CELL_FIELD,
327:   PETSC_VTK_CELL_VECTOR_FIELD
328: } PetscViewerVTKFieldType;
329: PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer, PetscObject, PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject, PetscViewer), PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject);
330: PETSC_EXTERN PetscErrorCode PetscViewerVTKGetDM(PetscViewer, PetscObject *);
331: PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);

333: /*
334:      These are all the default viewers that do not have to be explicitly opened
335: */
336: PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
337: PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm, PetscViewer *);
338: PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
339: PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm, PetscViewer *);
340: PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
341: PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
342: PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
343: PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
344: PETSC_EXTERN PetscViewer    PETSC_VIEWER_HDF5_(MPI_Comm);
345: PETSC_EXTERN PetscViewer    PETSC_VIEWER_GLVIS_(MPI_Comm);
346: PETSC_EXTERN PetscViewer    PETSC_VIEWER_EXODUSII_(MPI_Comm);
347: PETSC_EXTERN PetscViewer    PETSC_VIEWER_PYTHON_(MPI_Comm);
348: PETSC_EXTERN PetscViewer    PETSC_VIEWER_PYVISTA_(MPI_Comm);
349: PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;

351: /*MC
352:   PETSC_VIEWER_STDERR_SELF  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_SELF)

354:   Level: beginner
355: M*/
356: #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)

358: /*MC
359:   PETSC_VIEWER_STDERR_WORLD  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_WORLD)

361:   Level: beginner
362: M*/
363: #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)

365: /*MC
366:   PETSC_VIEWER_STDOUT_WORLD  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_WORLD)

368:   Level: beginner
369: M*/
370: #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)

372: /*MC
373:   PETSC_VIEWER_STDOUT_SELF  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_SELF)

375:   Level: beginner
376: M*/
377: #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)

379: /*MC
380:   PETSC_VIEWER_DRAW_WORLD  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_WORLD)

382:   Level: intermediate
383: M*/
384: #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)

386: /*MC
387:   PETSC_VIEWER_DRAW_SELF  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_SELF)

389:   Level: intermediate
390: M*/
391: #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)

393: /*MC
394:   PETSC_VIEWER_SOCKET_WORLD  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_WORLD)

396:   Level: intermediate
397: M*/
398: #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)

400: /*MC
401:   PETSC_VIEWER_SOCKET_SELF  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_SELF)

403:   Level: intermediate
404: M*/
405: #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)

407: /*MC
408:   PETSC_VIEWER_BINARY_WORLD  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_WORLD)

410:   Level: intermediate
411: M*/
412: #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)

414: /*MC
415:   PETSC_VIEWER_BINARY_SELF  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_SELF)

417:   Level: intermediate
418: M*/
419: #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)

421: /*MC
422:   PETSC_VIEWER_MATLAB_WORLD  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_WORLD)

424:   Level: intermediate
425: M*/
426: #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)

428: /*MC
429:   PETSC_VIEWER_MATLAB_SELF  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_SELF)

431:   Level: intermediate
432: M*/
433: #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)

435: #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(), PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)

437: PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStart(PetscViewer, PetscInt *, PetscInt *);
438: PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepMain(PetscViewer, PetscInt, PetscInt *, PetscInt);
439: PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndMain(PetscViewer, PetscInt *);
440: PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer, PetscMPIInt, PetscInt *);
441: PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer, PetscInt *);
442: PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlStepMain()", ) static inline PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer, PetscInt i, PetscInt *mcnt, PetscInt cnt)
443: {
444:   return PetscViewerFlowControlStepMain(viewer, i, mcnt, cnt);
445: }
446: PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlEndMain()", ) static inline PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer, PetscInt *mcnt)
447: {
448:   return PetscViewerFlowControlEndMain(viewer, mcnt);
449: }

451: /*
452:    PetscViewer writes to MATLAB .mat file
453: */
454: PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer, int, int, const PetscScalar *, const char *);
455: PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer, int, int, PetscScalar *, const char *);
456: PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer, const char *, void *);

458: #if defined(PETSC_HAVE_SAWS)
459: PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject, PetscViewer);
460: #endif

462: PETSC_EXTERN PetscErrorCode PetscViewerPythonSetType(PetscViewer, const char[]);
463: PETSC_EXTERN PetscErrorCode PetscViewerPythonGetType(PetscViewer, const char *[]);
464: PETSC_EXTERN PetscErrorCode PetscViewerPythonCreate(MPI_Comm, const char[], PetscViewer *);
465: PETSC_EXTERN PetscErrorCode PetscViewerPythonViewObject(PetscViewer, PetscObject);

467: PETSC_EXTERN PetscErrorCode PetscViewerMonitorLGSetUp(PetscViewer, const char[], const char[], const char[], PetscInt, const char *[], int, int, int, int);

469: /*S
470:    PetscViewers - Abstract collection of `PetscViewer`s. It is stored as an expandable array of viewers.

472:    Level: intermediate

474: .seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`,
475:           `PetscViewersGetViewer()`
476: S*/
477: typedef struct _n_PetscViewers *PetscViewers;
478: PETSC_EXTERN PetscErrorCode     PetscViewersCreate(MPI_Comm, PetscViewers *);
479: PETSC_EXTERN PetscErrorCode     PetscViewersDestroy(PetscViewers *);
480: PETSC_EXTERN PetscErrorCode     PetscViewersGetViewer(PetscViewers, PetscInt, PetscViewer *);