xref: /petsc/include/petscviewer.h (revision edd03b47ed9fa9b7ef9dd67df42d5194593a501d)
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 
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"
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
803f423023SBarry Smith     PetscViewerGLVisType - indicates what type of `PETSCVIEWERGLVIS` viewer to use
818135c375SStefano Zampini 
823f423023SBarry Smith     Values:
833f423023SBarry Smith +   `PETSC_VIEWER_GLVIS_DUMP` - save the data to a file
843f423023SBarry Smith -   `PETSC_VIEWER_GLVIS_SOCKET` - communicate the data to another program via a socket
853f423023SBarry Smith 
8616a05f60SBarry Smith     Level: beginner
8716a05f60SBarry Smith 
883f423023SBarry Smith .seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`
898135c375SStefano Zampini E*/
909371c9d4SSatish Balay typedef enum {
919371c9d4SSatish Balay   PETSC_VIEWER_GLVIS_DUMP,
929371c9d4SSatish Balay   PETSC_VIEWER_GLVIS_SOCKET
939371c9d4SSatish Balay } PetscViewerGLVisType;
948135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisOpen(MPI_Comm, PetscViewerGLVisType, const char *, PetscInt, PetscViewer *);
9577eacf09SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetPrecision(PetscViewer, PetscInt);
968135c375SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetSnapId(PetscViewer, PetscInt);
974cac2994SStefano Zampini PETSC_EXTERN PetscErrorCode PetscViewerGLVisSetFields(PetscViewer, PetscInt, const char *[], PetscInt[], PetscErrorCode (*)(PetscObject, PetscInt, PetscObject[], void *), PetscObject[], void *, PetscErrorCode (*)(void *));
988135c375SStefano Zampini 
9919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer, PetscViewerType *);
10019fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer, PetscViewerType);
101014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer *);
1023f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
1033f08860eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubViewer(PetscViewer, MPI_Comm, PetscViewer *);
104ae39576cSLois Curfman McInnes 
105014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
106014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer, PetscViewer);
107fe2efc57SMark PETSC_EXTERN PetscErrorCode PetscViewerViewFromOptions(PetscViewer, PetscObject, const char[]);
108f69a0ea3SMatthew Knepley 
109014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer, const char[]);
110014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer, const char[]);
111014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer, const char *[]);
112090de74eSSatish Balay 
113e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerReadable(PetscViewer, PetscBool *);
114e24fdd67SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerWritable(PetscViewer, PetscBool *);
115d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckReadable(PetscViewer);
116d01f05b1SVaclav Hapla PETSC_EXTERN PetscErrorCode PetscViewerCheckWritable(PetscViewer);
117e24fdd67SVaclav Hapla 
118*edd03b47SJacob Faibussowitsch #define PETSC_VIEWER_ASCII_VTK_ATTR        PETSC_VIEWER_ASCII_VTK PETSC_DEPRECATED_ENUM(3, 14, 0, "PetscViewerVTKOpen() with XML (.vtr.vts.vtu) format", )
119*edd03b47SJacob Faibussowitsch #define PETSC_VIEWER_ASCII_VTK_CELL_ATTR   PETSC_VIEWER_ASCII_VTK_CELL PETSC_DEPRECATED_ENUM(3, 14, 0, "PetscViewerVTKOpen() with XML (.vtr.vts.vtu) format", )
120*edd03b47SJacob Faibussowitsch #define PETSC_VIEWER_ASCII_VTK_COORDS_ATTR PETSC_VIEWER_ASCII_VTK_COORDS PETSC_DEPRECATED_ENUM(3, 14, 0, "PetscViewerVTKOpen() with XML (.vtr .vts .vtu) format", )
121b9617806SBarry Smith /*E
122b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
123b9617806SBarry Smith 
1243f423023SBarry Smith    Values:
1253f423023SBarry Smith +    `PETSC_VIEWER_DEFAULT` - default format for the specific object being viewed
1263f423023SBarry Smith .    `PETSC_VIEWER_ASCII_MATLAB` - MATLAB format
1273f423023SBarry Smith .    `PETSC_VIEWER_ASCII_DENSE` - print matrix as dense
1283f423023SBarry Smith .    `PETSC_VIEWER_ASCII_IMPL` - implementation-specific format
1293f423023SBarry Smith       (which is in many cases the same as the default)
1303f423023SBarry Smith .    `PETSC_VIEWER_ASCII_INFO` - basic information about object
1313f423023SBarry Smith .    `PETSC_VIEWER_ASCII_INFO_DETAIL` - more detailed info
1323f423023SBarry Smith        about object
1333f423023SBarry Smith .    `PETSC_VIEWER_ASCII_COMMON` - identical output format for
1343f423023SBarry Smith        all objects of a particular type
1353f423023SBarry Smith .    `PETSC_VIEWER_ASCII_INDEX` - (for vectors) prints the vector
1363f423023SBarry Smith        element number next to each vector entry
1373f423023SBarry Smith .    `PETSC_VIEWER_ASCII_SYMMODU` - print parallel vectors without
1383f423023SBarry Smith        indicating the processor ranges
1393f423023SBarry Smith .    `PETSC_VIEWER_ASCII_VTK` - outputs the object to a VTK file (deprecated since v3.14)
1403f423023SBarry Smith .    `PETSC_VIEWER_NATIVE` - store the object to the binary
1413f423023SBarry Smith        file in its native format (for example, dense
1423f423023SBarry Smith        matrices are stored as dense), `DMDA` vectors are dumped directly to the
1433f423023SBarry Smith        file instead of being first put in the natural ordering
1443f423023SBarry Smith .    `PETSC_VIEWER_ASCII_LATEX` - output the data in LaTeX
1453f423023SBarry Smith .    `PETSC_VIEWER_BINARY_MATLAB` - output additional information that can be used to read the data into MATLAB
1463f423023SBarry Smith .    `PETSC_VIEWER_DRAW_BASIC` - views the vector with a simple 1d plot
1473f423023SBarry Smith .    `PETSC_VIEWER_DRAW_LG` - views the vector with a line graph
1483f423023SBarry Smith -    `PETSC_VIEWER_DRAW_CONTOUR` - views the vector with a contour plot
1493f423023SBarry Smith 
15016a05f60SBarry Smith    Level: beginner
15116a05f60SBarry Smith 
1523f423023SBarry Smith    Note:
1533f423023SBarry Smith    A variety of specialized formats also exist
1543f423023SBarry Smith 
155d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()`
156b9617806SBarry Smith E*/
157fb9695e5SSatish Balay typedef enum {
158117016b1SBarry Smith   PETSC_VIEWER_DEFAULT,
159f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
1604ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
161f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
162f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
163456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
164f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
165f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
166f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
167f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
1683c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
1698ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_DEPRECATED,
1708ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_ATTR = PETSC_VIEWER_ASCII_VTK_DEPRECATED,
1718ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_CELL_DEPRECATED,
1728ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_CELL_ATTR = PETSC_VIEWER_ASCII_VTK_CELL_DEPRECATED,
1738ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_COORDS_DEPRECATED,
1748ec8862eSJed Brown   PETSC_VIEWER_ASCII_VTK_COORDS_ATTR = PETSC_VIEWER_ASCII_VTK_COORDS_DEPRECATED,
175493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
176cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
177cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
17867ad5babSMatthew G Knepley   PETSC_VIEWER_ASCII_LATEX,
179bb1d7374SBarry Smith   PETSC_VIEWER_ASCII_XML,
180d0a29bd7SConnor Ward   PETSC_VIEWER_ASCII_FLAMEGRAPH,
1818135c375SStefano Zampini   PETSC_VIEWER_ASCII_GLVIS,
18238144912Sdeepblu2718   PETSC_VIEWER_ASCII_CSV,
183f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
184f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
185bb046f40SHong Zhang   PETSC_VIEWER_DRAW_LG_XRANGE,
186f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
187f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
1884061b8bfSJed Brown   PETSC_VIEWER_VTK_VTS,
189a13bc4e3SShao-Ching Huang   PETSC_VIEWER_VTK_VTR,
190b263465dSJed Brown   PETSC_VIEWER_VTK_VTU,
191a261c58fSBarry Smith   PETSC_VIEWER_BINARY_MATLAB,
192f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
1938aa4816bSVaclav Hapla   PETSC_VIEWER_HDF5_PETSC,
194ffe0aed0SMatthew G. Knepley   PETSC_VIEWER_HDF5_VIZ,
1958aa4816bSVaclav Hapla   PETSC_VIEWER_HDF5_XDMF,
196cbb4c999SVaclav Hapla   PETSC_VIEWER_HDF5_MAT,
197ef5fdb51SBarry Smith   PETSC_VIEWER_NOFORMAT,
198eafd5ff0SAlex Lindsay   PETSC_VIEWER_LOAD_BALANCE,
1997962402dSFande Kong   PETSC_VIEWER_FAILED,
2007962402dSFande Kong   PETSC_VIEWER_ALL
201cfaaf4edSHong Zhang } PetscViewerFormat;
202014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[];
203090de74eSSatish Balay 
204*edd03b47SJacob Faibussowitsch PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 7, 0, "PetscViewerPushFormat() / PetscViewerPopFormat()", ) PetscErrorCode PetscViewerSetFormat(PetscViewer, PetscViewerFormat);
205014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer, PetscViewerFormat);
206014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
207014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer, PetscViewerFormat *);
208014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
2094b0e389bSBarry Smith 
210eb55bdffSLawrence Mitchell PETSC_EXTERN PetscErrorCode PetscOptionsPushGetViewerOff(PetscBool);
211a30ec4eaSSatish Balay PETSC_EXTERN PetscErrorCode PetscOptionsPopGetViewerOff(void);
212eb55bdffSLawrence Mitchell PETSC_EXTERN PetscErrorCode PetscOptionsGetViewerOff(PetscBool *);
21316413a6aSBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetViewer(MPI_Comm, PetscOptions, const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
214e83a5d19SLisandro Dalcin #define PetscOptionsViewer(a, b, c, d, e, f) PetscOptionsViewer_Private(PetscOptionsObject, a, b, c, d, e, f)
2154416b707SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsViewer_Private(PetscOptionItems *, const char[], const char[], const char[], PetscViewer *, PetscViewerFormat *, PetscBool *);
2162bf49c77SBarry Smith 
2179371c9d4SSatish Balay typedef struct {
2189371c9d4SSatish Balay   PetscViewer       viewer;
2199371c9d4SSatish Balay   PetscViewerFormat format;
2209371c9d4SSatish Balay   PetscDrawLG       lg;
2219812b6beSJed Brown   PetscInt          view_interval;
2229371c9d4SSatish Balay   void             *data;
2239371c9d4SSatish Balay } PetscViewerAndFormat;
224d7cbc13eSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatCreate(PetscViewer, PetscViewerFormat, PetscViewerAndFormat **);
225fe01d993SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerAndFormatDestroy(PetscViewerAndFormat **);
226fe01d993SBarry Smith 
22777ed5343SBarry Smith /*
22877ed5343SBarry Smith    Operations explicit to a particular class of viewers
22977ed5343SBarry Smith */
230ed5c6e3eSMatthew Knepley 
231014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer, FILE **);
232014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer, PetscFileMode *);
233014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer, PetscFileMode);
234060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
2353ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
2363ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
2371575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushSynchronized(PetscViewer);
2381575c14dSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopSynchronized(PetscViewer);
239014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
240014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
241014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer, PetscBool);
242014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer, PetscInt);
243014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer, PetscInt *);
244014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer, PetscInt);
245014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer, PetscInt);
246060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerASCIIRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
247014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer, int *);
248014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer, FILE **);
249060da220SMatthew G. Knepley PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer, void *, PetscInt, PetscInt *, PetscDataType);
250f253e43cSLisandro Dalcin PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer, const void *, PetscInt, PetscDataType);
25138b83642SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadAll(PetscViewer, void *, PetscInt, PetscInt64, PetscInt64, PetscDataType);
25238b83642SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteAll(PetscViewer, const void *, PetscInt, PetscInt64, PetscInt64, PetscDataType);
2533ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
25436a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer, char[], size_t);
25536a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringGetStringRead(PetscViewer, const char *[], size_t *);
25636a9e3b9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringSetOwnString(PetscViewer);
257014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
258014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer, PetscBool);
259014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer, PetscBool *);
260014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer, PetscReal);
261014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer, PetscReal *);
262014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer, const char[], const char[], int, int, int, int);
263014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer, int, int);
264014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer, PetscInt, const PetscReal *);
265014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer, PetscInt *, const PetscReal **);
266014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer, const char[], int);
267014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
268807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipInfo(PetscViewer, PetscBool);
269807ea322SDave May PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipInfo(PetscViewer, PetscBool *);
270014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer, PetscBool);
271014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer, PetscBool *);
272014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer, PetscBool);
273014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer, PetscBool *);
274014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer, char ***);
27578fbdcc8SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer, const char *const *);
276c655490fSBarry Smith 
277014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer, const char[]);
278014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer, const char **);
27977ed5343SBarry Smith 
280014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE **);
281014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool);
282014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *);
2833ca90d2dSJacob Faibussowitsch PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char[], ...) PETSC_ATTRIBUTE_FORMAT(2, 3);
284014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
28555dcf840SMatthew Knepley 
2867e4fd573SVaclav Hapla /*@C
2877e4fd573SVaclav Hapla   PetscViewerVUSetMode - Sets the mode in which to open the file.
2887e4fd573SVaclav Hapla 
2897e4fd573SVaclav Hapla   Not Collective
2907e4fd573SVaclav Hapla 
2917e4fd573SVaclav Hapla   Input Parameters:
29287497f52SBarry Smith + viewer - The `PetscViewer`
2937e4fd573SVaclav Hapla - mode   - The file mode
2947e4fd573SVaclav Hapla 
2957e4fd573SVaclav Hapla   Level: deprecated
2967e4fd573SVaclav Hapla 
2977e4fd573SVaclav Hapla   Note:
29887497f52SBarry Smith   Use `PetscViewerFileSetMode()` instead.
2997e4fd573SVaclav Hapla 
3003f423023SBarry Smith .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerFileSetMode()`
3017e4fd573SVaclav Hapla @*/
302*edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFileSetMode()", ) static inline PetscErrorCode PetscViewerVUSetMode(PetscViewer viewer, PetscFileMode mode)
303d71ae5a4SJacob Faibussowitsch {
3049371c9d4SSatish Balay   return PetscViewerFileSetMode(viewer, mode);
3059371c9d4SSatish Balay }
3067e4fd573SVaclav Hapla 
307607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void);
308014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
309014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
310014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char[]);
311014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
312014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
3134ebda54eSMatthew Knepley 
314014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **);
315014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char[]);
316014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
317014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **);
318014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char[]);
319014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
3204ebda54eSMatthew Knepley 
3219371c9d4SSatish Balay typedef enum {
3229371c9d4SSatish Balay   PETSC_VTK_INVALID,
3239371c9d4SSatish Balay   PETSC_VTK_POINT_FIELD,
3249371c9d4SSatish Balay   PETSC_VTK_POINT_VECTOR_FIELD,
3259371c9d4SSatish Balay   PETSC_VTK_CELL_FIELD,
3269371c9d4SSatish Balay   PETSC_VTK_CELL_VECTOR_FIELD
3279371c9d4SSatish Balay } PetscViewerVTKFieldType;
328e630c359SToby Isaac PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer, PetscObject, PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject, PetscViewer), PetscInt, PetscViewerVTKFieldType, PetscBool, PetscObject);
329a8f87f1dSPatrick Sanan PETSC_EXTERN PetscErrorCode PetscViewerVTKGetDM(PetscViewer, PetscObject *);
330014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm, const char[], PetscFileMode, PetscViewer *);
3314061b8bfSJed Brown 
33277ed5343SBarry Smith /*
333d70abbfaSBarry Smith      These are all the default viewers that do not have to be explicitly opened
33477ed5343SBarry Smith */
335014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
336014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm, PetscViewer *);
337014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
338014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm, PetscViewer *);
339014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
340014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
341014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
342014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
343a75e6a4aSMatthew G. Knepley PETSC_EXTERN PetscViewer    PETSC_VIEWER_HDF5_(MPI_Comm);
3448135c375SStefano Zampini PETSC_EXTERN PetscViewer    PETSC_VIEWER_GLVIS_(MPI_Comm);
3451e50132fSMatthew G. Knepley PETSC_EXTERN PetscViewer    PETSC_VIEWER_EXODUSII_(MPI_Comm);
346014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
3475311e20fSBarry Smith 
348f09f0971SVáclav Hapla /*MC
34987497f52SBarry Smith   PETSC_VIEWER_STDERR_SELF  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_SELF)
350f09f0971SVáclav Hapla 
351f09f0971SVáclav Hapla   Level: beginner
352f09f0971SVáclav Hapla M*/
353b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
354f09f0971SVáclav Hapla 
355f09f0971SVáclav Hapla /*MC
35687497f52SBarry Smith   PETSC_VIEWER_STDERR_WORLD  - same as `PETSC_VIEWER_STDERR_`(PETSC_COMM_WORLD)
357f09f0971SVáclav Hapla 
358f09f0971SVáclav Hapla   Level: beginner
359f09f0971SVáclav Hapla M*/
360b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
36130de9b25SBarry Smith 
36230de9b25SBarry Smith /*MC
36387497f52SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_WORLD)
36430de9b25SBarry Smith 
36530de9b25SBarry Smith   Level: beginner
36630de9b25SBarry Smith M*/
36730de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
36830de9b25SBarry Smith 
36930de9b25SBarry Smith /*MC
37087497f52SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as `PETSC_VIEWER_STDOUT_`(PETSC_COMM_SELF)
37130de9b25SBarry Smith 
37230de9b25SBarry Smith   Level: beginner
37330de9b25SBarry Smith M*/
37430de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
37530de9b25SBarry Smith 
37630de9b25SBarry Smith /*MC
37787497f52SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_WORLD)
37830de9b25SBarry Smith 
37930de9b25SBarry Smith   Level: intermediate
38030de9b25SBarry Smith M*/
381b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
38230de9b25SBarry Smith 
38330de9b25SBarry Smith /*MC
38487497f52SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as `PETSC_VIEWER_DRAW_`(PETSC_COMM_SELF)
38530de9b25SBarry Smith 
38630de9b25SBarry Smith   Level: intermediate
38730de9b25SBarry Smith M*/
38830de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
38930de9b25SBarry Smith 
39030de9b25SBarry Smith /*MC
39187497f52SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_WORLD)
39230de9b25SBarry Smith 
39330de9b25SBarry Smith   Level: intermediate
39430de9b25SBarry Smith M*/
395b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
39630de9b25SBarry Smith 
39730de9b25SBarry Smith /*MC
39887497f52SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as `PETSC_VIEWER_SOCKET_`(PETSC_COMM_SELF)
39930de9b25SBarry Smith 
40030de9b25SBarry Smith   Level: intermediate
40130de9b25SBarry Smith M*/
402b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
40330de9b25SBarry Smith 
40430de9b25SBarry Smith /*MC
40587497f52SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_WORLD)
40630de9b25SBarry Smith 
40730de9b25SBarry Smith   Level: intermediate
40830de9b25SBarry Smith M*/
409b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
41030de9b25SBarry Smith 
41130de9b25SBarry Smith /*MC
41287497f52SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as `PETSC_VIEWER_BINARY_`(PETSC_COMM_SELF)
41330de9b25SBarry Smith 
41430de9b25SBarry Smith   Level: intermediate
41530de9b25SBarry Smith M*/
416b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
41730de9b25SBarry Smith 
418cbb32127SBarry Smith /*MC
41987497f52SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_WORLD)
420cbb32127SBarry Smith 
421cbb32127SBarry Smith   Level: intermediate
422cbb32127SBarry Smith M*/
423cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
424cbb32127SBarry Smith 
425cbb32127SBarry Smith /*MC
42687497f52SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as `PETSC_VIEWER_MATLAB_`(PETSC_COMM_SELF)
427cbb32127SBarry Smith 
428cbb32127SBarry Smith   Level: intermediate
429cbb32127SBarry Smith M*/
430cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
431cbb32127SBarry Smith 
4327eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(), PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
43365ef3172SBarry Smith 
4344a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStart(PetscViewer, PetscInt *, PetscInt *);
4359dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepMain(PetscViewer, PetscInt, PetscInt *, PetscInt);
4369dddd249SSatish Balay PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndMain(PetscViewer, PetscInt *);
4374a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer, PetscMPIInt, PetscInt *);
4384a5f5e6cSBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer, PetscInt *);
439*edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlStepMain()", ) static inline PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer, PetscInt i, PetscInt *mcnt, PetscInt cnt)
440d71ae5a4SJacob Faibussowitsch {
4419371c9d4SSatish Balay   return PetscViewerFlowControlStepMain(viewer, i, mcnt, cnt);
4429371c9d4SSatish Balay }
443*edd03b47SJacob Faibussowitsch PETSC_DEPRECATED_FUNCTION(3, 15, 0, "PetscViewerFlowControlEndMain()", ) static inline PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer, PetscInt *mcnt)
444d71ae5a4SJacob Faibussowitsch {
4459371c9d4SSatish Balay   return PetscViewerFlowControlEndMain(viewer, mcnt);
4469371c9d4SSatish Balay }
447e03d165dSBarry Smith 
44877ed5343SBarry Smith /*
449a5057860SBarry Smith    PetscViewer writes to MATLAB .mat file
450cbb32127SBarry Smith */
451014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer, int, int, const PetscScalar *, const char *);
452014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer, int, int, PetscScalar *, const char *);
453014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer, const char *, void *);
454cbb32127SBarry Smith 
455e04113cfSBarry Smith #if defined(PETSC_HAVE_SAWS)
456e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject, PetscViewer);
457bfb97211SBarry Smith #endif
458bfb97211SBarry Smith 
459b9617806SBarry Smith /*S
4603f423023SBarry Smith    PetscViewers - Abstract collection of `PetscViewer`s. It is stored as an expandable array of viewers.
461b9617806SBarry Smith 
462b9617806SBarry Smith    Level: intermediate
463b9617806SBarry Smith 
464d1f92df0SBarry Smith .seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`,
465db781477SPatrick Sanan           `PetscViewersGetViewer()`
466b9617806SBarry Smith S*/
46795fbd943SSatish Balay typedef struct _n_PetscViewers *PetscViewers;
468014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersCreate(MPI_Comm, PetscViewers *);
469014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersDestroy(PetscViewers *);
470014dd563SJed Brown PETSC_EXTERN PetscErrorCode     PetscViewersGetViewer(PetscViewers, PetscInt, PetscViewer *);
471d132466eSBarry Smith 
472cb5b572fSBarry Smith #endif
473