Actual source code: petscviewertypes.h

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

  5: #pragma once

  7: #include <petscsystypes.h>

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

 12: /*S
 13:   PetscViewer - Abstract PETSc object for displaying in ASCII, saving to a binary file, graphically displaying, etc.
 14:                 PETSc objects and their data

 16:   Level: beginner

 18:   Notes:
 19:   Each PETSc class, for example `Vec`, has a viewer method associated with that class, for example `VecView()`, that can be used
 20:   to view, display, store to a file information about that object, etc. Each class also has a method that uses
 21:   the options database to view the object, for example `VecViewFromOptions()`.

 23:   See `PetscViewerType` for a list of all `PetscViewer` types.

 25: .seealso: [](sec_viewers), `PetscViewerType`, `PETSCVIEWERASCII`, `PetscViewerCreate()`, `PetscViewerSetType()`,
 26:           `VecView()`, `VecViewFromOptions()`, `PetscObjectView()`
 27: S*/
 28: typedef struct _p_PetscViewer *PetscViewer;

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

 33:    Level: beginner

 35: .seealso: [](sec_viewers), `PetscViewerSetType()`, `PetscViewer`, `PetscViewerRegister()`, `PetscViewerCreate()`
 36: J*/
 37: typedef const char *PetscViewerType;
 38: #define PETSCVIEWERSOCKET      "socket"
 39: #define PETSCVIEWERASCII       "ascii"
 40: #define PETSCVIEWERBINARY      "binary"
 41: #define PETSCVIEWERSTRING      "string"
 42: #define PETSCVIEWERDRAW        "draw"
 43: #define PETSCVIEWERVU          "vu"
 44: #define PETSCVIEWERMATHEMATICA "mathematica"
 45: #define PETSCVIEWERHDF5        "hdf5"
 46: #define PETSCVIEWERVTK         "vtk"
 47: #define PETSCVIEWERMATLAB      "matlab"
 48: #define PETSCVIEWERSAWS        "saws"
 49: #define PETSCVIEWERGLVIS       "glvis"
 50: #define PETSCVIEWERADIOS       "adios"
 51: #define PETSCVIEWEREXODUSII    "exodusii"
 52: #define PETSCVIEWERCGNS        "cgns"
 53: #define PETSCVIEWERPYTHON      "python"
 54: #define PETSCVIEWERPYVISTA     "pyvista"

 56: /*E
 57:     PetscViewerGLVisType - indicates what type of `PETSCVIEWERGLVIS` viewer to use

 59:     Values:
 60: +   `PETSC_VIEWER_GLVIS_DUMP`   - save the data to a file
 61: -   `PETSC_VIEWER_GLVIS_SOCKET` - communicate the data to another program via a socket

 63:     Level: beginner

 65: .seealso: [](sec_viewers), `PETSCVIEWERGLVIS`, `PetscViewerGLVisOpen()`
 66: E*/
 67: typedef enum {
 68:   PETSC_VIEWER_GLVIS_DUMP,
 69:   PETSC_VIEWER_GLVIS_SOCKET
 70: } PetscViewerGLVisType;

 72: /*E
 73:    PetscViewerFormat - Way a viewer presents the object

 75:    Values:
 76: +    `PETSC_VIEWER_DEFAULT`           - default format for the specific object being viewed
 77: .    `PETSC_VIEWER_ASCII_MATLAB`      - MATLAB format
 78: .    `PETSC_VIEWER_ASCII_DENSE`       - print matrix as a dense two dimensiona array
 79: .    `PETSC_VIEWER_ASCII_IMPL`        - implementation-specific format (which is in many cases the same as the default)
 80: .    `PETSC_VIEWER_ASCII_INFO`        - basic information about object
 81: .    `PETSC_VIEWER_ASCII_INFO_DETAIL` - more detailed info about object (but still not vector or matrix entries)
 82: .    `PETSC_VIEWER_ASCII_COMMON`      - identical output format for all objects of a particular type
 83: .    `PETSC_VIEWER_ASCII_INDEX`       - (for vectors) prints the vector  element number next to each vector entry
 84: .    `PETSC_VIEWER_ASCII_SYMMODU`     - print parallel vectors without indicating the MPI process ranges that own the entries
 85: .    `PETSC_VIEWER_ASCII_VTK`         - outputs the object to a VTK file (deprecated since v3.14)
 86: .    `PETSC_VIEWER_NATIVE`            - store the object to the binary file in its native format (for example, dense
 87:                                         matrices are stored as dense), `DMDA` vectors are dumped directly to the
 88:                                         file instead of being first put in the natural ordering
 89: .    `PETSC_VIEWER_ASCII_LATEX`       - output the data in LaTeX
 90: .    `PETSC_VIEWER_BINARY_MATLAB`     - output additional information that can be used to read the data into MATLAB
 91: .    `PETSC_VIEWER_DRAW_BASIC`        - views the vector with a simple 1d plot
 92: .    `PETSC_VIEWER_DRAW_LG`           - views the vector with a line graph
 93: -    `PETSC_VIEWER_DRAW_CONTOUR`      - views the vector with a contour plot

 95:    Level: beginner

 97:    Note:
 98:    A variety of specialized formats also exist

100: .seealso: [](sec_viewers), `PetscViewer`, `PetscViewerType`, `PetscViewerPushFormat()`, `PetscViewerPopFormat()`
101: E*/
102: typedef enum {
103:   PETSC_VIEWER_DEFAULT,
104:   PETSC_VIEWER_ASCII_MATLAB,
105:   PETSC_VIEWER_ASCII_MATHEMATICA,
106:   PETSC_VIEWER_ASCII_IMPL,
107:   PETSC_VIEWER_ASCII_INFO,
108:   PETSC_VIEWER_ASCII_INFO_DETAIL,
109:   PETSC_VIEWER_ASCII_COMMON,
110:   PETSC_VIEWER_ASCII_SYMMODU,
111:   PETSC_VIEWER_ASCII_INDEX,
112:   PETSC_VIEWER_ASCII_DENSE,
113:   PETSC_VIEWER_ASCII_MATRIXMARKET,
114:   PETSC_VIEWER_ASCII_PCICE,
115:   PETSC_VIEWER_ASCII_PYTHON,
116:   PETSC_VIEWER_ASCII_FACTOR_INFO,
117:   PETSC_VIEWER_ASCII_LATEX,
118:   PETSC_VIEWER_ASCII_XML,
119:   PETSC_VIEWER_ASCII_FLAMEGRAPH,
120:   PETSC_VIEWER_ASCII_GLVIS,
121:   PETSC_VIEWER_ASCII_CSV,
122:   PETSC_VIEWER_DRAW_BASIC,
123:   PETSC_VIEWER_DRAW_LG,
124:   PETSC_VIEWER_DRAW_LG_XRANGE,
125:   PETSC_VIEWER_DRAW_CONTOUR,
126:   PETSC_VIEWER_DRAW_PORTS,
127:   PETSC_VIEWER_VTK_VTS,
128:   PETSC_VIEWER_VTK_VTR,
129:   PETSC_VIEWER_VTK_VTU,
130:   PETSC_VIEWER_BINARY_MATLAB,
131:   PETSC_VIEWER_NATIVE,
132:   PETSC_VIEWER_HDF5_PETSC,
133:   PETSC_VIEWER_HDF5_VIZ,
134:   PETSC_VIEWER_HDF5_XDMF,
135:   PETSC_VIEWER_HDF5_MAT,
136:   PETSC_VIEWER_NOFORMAT,
137:   PETSC_VIEWER_LOAD_BALANCE,
138:   PETSC_VIEWER_FAILED,
139:   PETSC_VIEWER_ALL
140: } PetscViewerFormat;
141: PETSC_EXTERN const char *const PetscViewerFormats[];

143: /*S
144:   PetscViewerAndFormat - A struct that contains both a `PetscViewer` and a `PetscViewerFormat` plus some optional situation-dependent data

146:   Level: beginner

148:   Note:
149:   Used by most monitor functions including, for example, `KSPMonitorResidual()`

151: .seealso: [](sec_viewers), `PetscViewerType`, `PETSCVIEWERASCII`, `PetscViewerCreate()`, `PetscViewerSetType()`,
152:           `VecView()`, `VecViewFromOptions()`, `PetscObjectView()`, `PetscViewerFormat`, `PetscViewer`,
153:           `PetscViewerAndFormatCreate()`, `PetscViewerAndFormatDestroy()`, `KSPMonitorResidual()`
154: S*/
155: typedef struct {
156:   PetscViewer        viewer;
157:   PetscViewerFormat  format;
158:   PetscInt           view_interval;
159:   void              *data;
160:   PetscCtxDestroyFn *data_destroy;
161: } PetscViewerAndFormat;

163: /*E
164:    PetscViewerVTKFieldType - Categorizes a field that is being written through a `PETSCVIEWERVTK` viewer so that the VTK writer can place it on the correct mesh entity and with the correct component layout

166:    Values:
167: +   `PETSC_VTK_INVALID`            - sentinel for an uninitialized entry
168: .   `PETSC_VTK_POINT_FIELD`        - scalar (or generic multi-component) field stored at mesh points
169: .   `PETSC_VTK_POINT_VECTOR_FIELD` - vector-valued field stored at mesh points
170: .   `PETSC_VTK_CELL_FIELD`         - scalar (or generic multi-component) field stored on mesh cells
171: -   `PETSC_VTK_CELL_VECTOR_FIELD`  - vector-valued field stored on mesh cells

173:    Level: developer

175: .seealso: `PETSCVIEWERVTK`, `PetscViewerVTKAddField()`, `PetscViewerVTKOpen()`, `PetscViewer`
176: E*/
177: typedef enum {
178:   PETSC_VTK_INVALID,
179:   PETSC_VTK_POINT_FIELD,
180:   PETSC_VTK_POINT_VECTOR_FIELD,
181:   PETSC_VTK_CELL_FIELD,
182:   PETSC_VTK_CELL_VECTOR_FIELD
183: } PetscViewerVTKFieldType;

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

188:    Level: intermediate

190: .seealso: [](sec_viewers), `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerType`, `PetscViewer`, `PetscViewersCreate()`,
191:           `PetscViewersGetViewer()`
192: S*/
193: typedef struct _n_PetscViewers *PetscViewers;